-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add a volume adjust to the player please [eob] #2
Comments
YO! I like these kind of projects. Though I'm not really proficient in JS and don't know Next.js. But I think I'll go passionate about this. So in order to contribute, can you give me a basic guideline about how can I struggle with this issue? |
Hey!
I'm glad to hear someone's interested in this project!
Of course. Basically what we need is adjusting the volume via calling the libopenmpt functions. We're using a web assembly file for importing these. (See /bin) Last time I checked, I couldn't find any function related to adjusting volume but I cannot say I made a in-depth search. Maybe we should update the version of the library, I don't know. So you can start by diving into Then we can basically update the front-end. e.g. Adding another slider to the |
Thank you for your precious response. I did some researches how you guided. Most of the tools above are new to me. |
Sounds nice. Any ideas how can we implement that into our current player? |
openmpt_module_set_render_param and // chiptune2.js
const OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL = 1
...
function ChiptuneJsConfig(repeatCount, volume) {
...
this.volume = volume;
}
/**
* Set player volume
* @param volume Integer, empiric -6000 (silence) .. 2000 (too loud)
*/
ChiptuneJsPlayer.prototype.setVolume = function (volume) {
this.config.volume = volume
if (this.currentPlayingNode != null) {
libopenmpt._openmpt_module_set_render_param(
this.currentPlayingNode.modulePtr,
OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL,
volume,
);
}
};
ChiptuneJsPlayer.prototype.createLibopenmptNode = function(buffer, config) {
...
libopenmpt._openmpt_module_set_render_param(
processNode.modulePtr,
OPENMPT_MODULE_RENDER_MASTERGAIN_MILLIBEL,
config.volume,
);
...
} |
Also, @deskjet in Volume support #17 offer the hackish approach with // create a GainNode
var gain = player.context.createGain()
// wire gain to speaker output
gain.connect(player.context.destination)
// disconnect internal ScriptProcessorNode from speakers
player.currentPlayingNode.disconnect()
// wire script processor to gain
player.currentPlayingNode.connect(gain)
// make it quieter
gain.gain.value = 0.5 |
* feat: Add volume adjust to PlayerBig (#2) * feat: Move volume adjust to the left side (#2) * fix: PlayerBig random thickness w style width: 93% (#2) * style: Add animation to volume slider Co-authored-by: cthulhu <> Co-authored-by: Orhun Parmaksız <[email protected]>
* feat: Add volume icon n percent label (#2) * feat: Increase distance for volume items, 5px -> 10px Move percent label on the top of slider * feat: Mute on volume icon click * feat: Volume keyboard shortcuts (a up, z down, x mute) --------- Co-authored-by: cthulhu <>
No description provided.
The text was updated successfully, but these errors were encountered: