Is this possible ?



Before i try to do this., i just want to know if you guys think this is possible to do.
Imagine a game where sound of the game changes as the action changes.
Supose i have 2 mp3, with the exact same size and the same music.
Environment.mp3 is the normal sound of the game.
EnvironemtStress.mp3 contains the same music as the other one, but it has some diferent sounds on top of the basic music.
So, imagine that Environment.mp3 is playing in the background, and the player just opens a door! Now, i want to switch to EnvironmentStress.mp3 but i want to start the mp3 in the exact same place where i was in Environment.mp3!
Can this be done ? Starting an mp3 in a specified place ?



You’d load the two mp3’s pauzed (with LoadFileEx I believe), start playing one, when it’s time to switch set the position of the second mp3 to the position of the first mp3, pauze the first mp3 and resume the second one.
To make the switch sound smooth tho, you’d have to switch right between two measures, otherwise it’ll sound plain wrong. So you’d find the exact time it takes for one measure to play and switch the sounds only the next time a new measure is started (so you’d check if “getlength MOD (time it takes to play one measure) <= limit”, where limit is something close to 0, preferably exactly as much ms as it takes from one check to the next).


Fmod has mixing support built-in (no special hardware needed). So I would think the best way to do this is to just play your normal environment sounds, then when something happens simply play the effect on another channel. Fmod will mix the two channel for you. In other words, you can easily overlay one sound on another.



The downside to that is that it would take more CPU power, especially when playing MP3 music. And really, it wouldn’t make the whole thing a whole lot easier than the pausing/resuming method.


I am not speaking from a positon of authority because I haven’t tried the pause/resume technique, but given that all systems have latency it would seem difficult to stop one sound and start another without having a noticable gap.

I’d suggest at least testing the CPU usage of mixing 2 channels. Its not much more than just playing 1 unmixed channel of mp3 (at least on my system). I guess it depends what you can spare.