Hey guys, I’ve got a question: is there a way I could make a function to disable a specific event? I’m currently using .bank files for my sound in a JavaScript game but I can’t stop seem to stop some sounds.
For example: I want to load a battle theme, but my normal background theme gets in the way (My battle music and background music are better apart: they don’t share the instruments and parameters).
Much thanks in advance for helping!
Thank you! Now I can fix my game!
Now I’m getting a new error that I cannot seem to fix:
ReferenceError: Studio is not defined.
Code references to this line in the code: Studio.gEventInstance.stop(FMOD_STUDIO_STOP_IMMEDIATE)
This is my code on the matter:
export function stopSound(stopSoundVar) {
if (stopSoundVar === 1) {
Studio.gEventInstance.stop(FMOD_STUDIO_STOP_ALLOWFADEOUT)
} else if (stopSoundVar === 2) {
Studio.gEventInstance.stop(FMOD_STUDIO_STOP_IMMEDIATE)
}
}
How do I declare this variable? I can’t just say:
var Studio
Right?
Do you or anyone else know the answer?
I thank you in advance
Why doesn’t this one work (this one is in the documentation):
FMOD_STUDIO_STOP_IMMEDIATE
And this one does?
FMOD.STUDIO_STOP_IMMEDIATE
example (it works now the way it should for me):
CHECK_RESULT(gEventInstance2.stop(FMOD.STUDIO_STOP_IMMEDIATE))
It’s a namespacing difference. The C# and JS enums (such as STUDIO_STOP_IMMEDIATE) are in the FMOD namespace, whereas the C and C++ enums are not.