0
0

Hi,
I am using FMOD 3.75 to play MIDIs. When I load my first MIDI, everything works perfectly: I can play it, change the volume, etc…
When I am finished doing my stuff with this midi, I stop it (with [i:2giyr6ch]FMUSIC_StopSong[/i:2giyr6ch]) and free it (with [i:2giyr6ch]FMUSIC_FreeSong[/i:2giyr6ch]).
If I then try to load the same MIDI file (or a different one), [i:2giyr6ch]FMUSIC_LoadSong[/i:2giyr6ch] fails with the error [i:2giyr6ch]Unknown file format[/i:2giyr6ch].

What did I do wrong?

I initialize FMOD like this: FSOUND_Init (44100, 32, 0);
(if I initialize FMOD with [i:2giyr6ch]FSOUND_INIT_USEDEFAULTMIDISYNTH[/i:2giyr6ch] the midi doesn’t play correctly (the MIDI loads correctly, but there is no sound)).

  • You must to post comments
0
0

Post your code. Not all of it, just the part where you load and unload the midi, and initialize and debunk the ss.

  • You must to post comments
0
0

Before I post my code, I want to ask a question.

The first time I load the midi, it loads immediatly. The second time I load the midi, there’s already the first midi playing so I put the 2nd midi in a queue so that I can fade in & fade out.
In parrallel, there’s a function called by a timer that reduces the volume of the midi that is playing, if there’s a midi in the queue. When the volume of the 1st midi reaches 0, I free the 1st midi and load the 2nd midi.

My question is:
Is it possible that the midi fails to load because it is loaded from a function called by a timer ? I am asking that because I have read that fmod isn’t thread safe.

  • You must to post comments
0
0

Wow, moving the loading of the midis out of the timer did the trick.

Now, how do I possibly code elegant fade in/fade out without using threads or timers??

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.