I’m trying to minimize my game’s filesize by using loops within the music – for example, a song might be composed of two sound clips, and one might loop three times followed by the other playing once. Right now, to transition between the sounds I just stop one sound’s channel and have the system play the other sound. The transition usually isn’t seamless – how bad the gap is varies, but it’s almost always noticeable. I think it might just be because the game’s main loop only repeats 100 times per second. Is there any other way to do something like this (maybe some kind of event w/ event handler that fires when a sound has looped x times?), or am I just going to have to accept larger filesizes?
Btw, I’m really new to FMOD, and also I’m doing this all via a C# wrapper, so have patience with me :p
- Flecko asked 11 years ago
I don’t mind using FSB, but is it possible using the C# wrapper of EX? The FSB help file says to use FMUSIC_LoadSong to load the FSBs, but I can’t find anything like that in fmod.cs. I’ll try and write a wrapper of the FMUSIC API myself if I can figure out how, but not being familiar with FMOD I wouldn’t know where to look at this point.
Ok, there’s something I’m missing here, and I think it has to do with versions.
Right now I’m using FMOD EX. As far as I can tell, there is no FSOUND API in it, because it’s not mentioned in the docs and definitely isn’t in the C# wrapper. I started using EX because I couldn’t get Demsey’s wrapper working (exception where couldn’t find an entry point, I guess he was using an older version of fmod.dll?). I was looking at the C# examples and tried to open it like in the playstream example, but all I got was static. Am I going to have to find a way to get FMOD 3 working in C#, or is there some way I can do this in EX?
Thanks for all your help so far, btw, I really appreciate it.
Ok, I’ve got fmod 3 working using goldfix’s wrapper. In case anyone else stumbles across this and has the same problem, I had to make a small change to the wrapper: FSOUND_Stream_SetSubStreamSentence wants an integer array of sound indices, but goldfix’s code wants a ref int. I couldn’t find a way to get C# to give me a pointer to a managed array, so I made it ask for an int* instead – the Stream class has to be declared unsafe and to make your int* you’ll need an unsafe block in the client code, but it works.
Also, you need the 3.73 dll, which I’d be glad to supply to anyone who wants it.
I have one more question: is there any way to get the stream to loop after calling SetSubStreamSentence? It loops fine if you don’t call that, but if you do it just breaks off once done. I guess I could make the array contain very, very many copies of the sentence, but that seems like a bit of a waste of memory.
Please login first to submit.