Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Non-linear volume control #6

Closed
SlouchyButton opened this issue Sep 20, 2021 · 3 comments
Closed

[FEATURE REQUEST] Non-linear volume control #6

SlouchyButton opened this issue Sep 20, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request resolve dependency Paused or unable to fix till dependency gets resolved

Comments

@SlouchyButton
Copy link

No description provided.

@duzda
Copy link
Owner

duzda commented Sep 23, 2021

should be implemented in 83970df

volume 0.0 to 0.1, step = 0.01
volume 0.1 to 0.2, step = 0.02
volume 0.2 to 0.3, step = 0.03
and so on...

The feature is not fully implemented, as dynamic volume should be implemented not only in the tray icon, but also in the deezer's inbuilt controls #4

@duzda duzda added enhancement New feature or request resolve dependency Paused or unable to fix till dependency gets resolved labels Sep 23, 2021
@duzda
Copy link
Owner

duzda commented Oct 23, 2021

Will be scrapped, as better idea is to just hook the volume controller, to use logarithmic function.

setVolume: function(e, t) {
    try {
        if (lt.chromecast.isLoading())
            return !1;
        if (st(lt.getPlayerType()))
            return !1;
        lt.isMuted() && e > 0 && lt.control.mute(!1),
            t = t || !1,
        lt.volume = e,
        lt.trigger("audioPlayer_setVolume", [e]),
        D.a.trigger(D.a.player.volume_changed, Math.round(100 * e)),
        t && V.default.set("volume", lt.volume)
    } catch (e) {
        N.a.error(e)
    }
},

For anybody in the future, this is the setVolume function, it's pretty straightforward, all that's important for hooking the volume is lt.trigger("audioPlayer_setVolume", [e]) which can be rewritten as dzPlayer.trigger("audioPlayer_setVolume", [e]) all that is left is just to replace [e] with log of e. The rest probably should be kept as it's, because otherwise it would break the controls itself (user still should be able to drag linearly, just the volume should be managed by logarithmic function

Currently it's at 30789 line after prettying the code.

@duzda duzda self-assigned this Oct 23, 2021
@duzda
Copy link
Owner

duzda commented Oct 23, 2021

implemented in ddbc8c0

@duzda duzda closed this as completed Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resolve dependency Paused or unable to fix till dependency gets resolved
Projects
None yet
Development

No branches or pull requests

2 participants