deskjet / chiptune2.js

much like chiptune.js - but newer and neater
378 stars 50 forks source link

Disabling channels/instruments #41

Open Ep8Script opened 3 years ago

Ep8Script commented 3 years ago

It would be great if it were possible to disable specific channels or instruments with this library (or libopenmpt), but there doesn't seem to be a way to do it. I've tried a lot of things (including reading up on some information here), but I've unfortunately been unable to get it to work.

Is there something I'm missing, or is this not doable here? Thanks!

deskjet commented 3 years ago

I'm sure it can be done. libopenmpt can supports muting channels using the set_channel_mute_status function. However, I can't figure out how to call openmpt_module_ext_get_interface from JS correctly to obtain the mod_ext pointer. I'll experiment later today if there is time.

Ep8Script commented 3 years ago

Yeah that's where I got stuck unfortunately. Appreciate you taking the time anyway, good luck and thanks for creating this project!

christiancodes commented 3 years ago

I'm investigating this too. Doesn't look like set_channel_mute_status has made it into the libopenmpt.js conversion.

deskjet commented 3 years ago

I did a bit of research and I think we might have to create some bindings so we can access the openmpt_module_ext_interface_interactive struct from JS and call the functions pointers there using Emscripten's dynCall. Not sure whether it'll work though.

ramdanirfox commented 1 year ago

@deskjet i prefer to use wasmTable.get(functionPointer) because i can apply argument more flexible.