Fangames > Programming Questions

FMOD Help

(1/1)

lawatson:
I'm not trying to absolutely rewrite the game's sound system to FMOD, but instead just use it to play some specific sounds. No matter what I try, though, it won't play the sound when I try to get it to. Here's the steps I use:

Make a new object similar to the Seph Engine's FMOD loader.
Initialize FMOD correctly.
Add the sound with the SoundAdd function, correct directory and all.
Now switching to the World object.
In End Step Event, I use the FMODUpdate function.

Now I play the sound through a different object, like the player object. It doesn't play. I know it's something with the specific sound and not with FMOD, because when I do it in the Seph Engine which already has everything done, and I add the sound and play it, it doesn't play. Can anyone help me out here?

Another thing to add, I'm taking the sound effects from the K3 sound effects folder. The sounds don't load in Audacity and they can't be converted with an online converter, so I'm wondering if this changes anything.

klazen108:
You might need to get the correct codec if audacity won't open the file, but then that leads to the question of what format are these files in? Go get this and try again: K-Lite Codec Pack If you still can't open the file after that, then it's probably a protected file. Or maybe it's a sign that you shouldn't be using K3 sound effects in your game :MVGame:

It's also possible that you missed something in the code. You mention that you tried this in a clean version of the Seph engine - do the other sound effects work correctly even if you copy them somewhere else? What about loading a completely different sound, one not from the K3 files, does that one work? Just for reference:

1) Once, on game start, you load the sound into a global variable:

--- Code: ---global.sndPlayerJump = FMODSoundAdd("sfx/sndPlayerJump.wav",false,false);
--- End code ---
This takes a file in the sfx directory named sndPlayerJump.wav (make sure everything matches, idk if it's case sensitive but better safe than sorry) - and leave the two false values as-is, they specify 3D/Streaming capabilities which you won't need for this. (Although streaming is nice for BGM - keeps the huge files out of memory and loads instantly on startup)

2) When you want to play the sound, pass in the global variable you created:

--- Code: ---FMODSoundPlay(global.sndPlayerJump);
--- End code ---
And that's all there is to it.

lawatson:

--- Quote from: klazen108 on July 12, 2015, 11:49:14 AM ---what format are these files in?
--- End quote ---
.wav format. probably an odd wav format, though, since other ones work just fine. might go full circle back to K3 sounds being fucky wackos :Kappa:


--- Quote from: klazen108 on July 12, 2015, 11:49:14 AM ---It's also possible that you missed something in the code. You mention that you tried this in a clean version of the Seph engine - do the other sound effects work correctly even if you copy them somewhere else? What about loading a completely different sound, one not from the K3 files, does that one work?
--- End quote ---

Moved the working sounds to a different directory, those sounds still played. I used a different sound that worked in regular gamemaker sound functions, and it worked as well.


--- Quote from: klazen108 on July 12, 2015, 11:49:14 AM ---1) Once, on game start, you load the sound into a global variable:

--- Code: ---global.sndPlayerJump = FMODSoundAdd("sfx/sndPlayerJump.wav",false,false);
--- End code ---
This takes a file in the sfx directory named sndPlayerJump.wav (make sure everything matches, idk if it's case sensitive but better safe than sorry) - and leave the two false values as-is, they specify 3D/Streaming capabilities which you won't need for this. (Although streaming is nice for BGM - keeps the huge files out of memory and loads instantly on startup)

2) When you want to play the sound, pass in the global variable you created:

--- Code: ---FMODSoundPlay(global.sndPlayerJump);
--- End code ---
And that's all there is to it.

--- End quote ---

Did exactly that.

I'm guessing that the conclusion is that I shouldn't take sound files from K3. Damn.

Navigation

[0] Message Index

Go to full version