I’ve been using FMod for a long time using software mode without problems. Now I’ve got an SBLive (with h/w channels).
When I open a sample, I set it to loop (FSOUND_SampleLoad(chn,fname,FSOUND_LOOP_NORMAL|FSOUND_HW3D)).
At playback time, for one-shot samples (no looping) I do:
This works in the software engine, but not with the SB Live drivers (8/31/2001, 3509.1.0.0, admittedly a bit old, but it was a pain to get it working). With the hardware channel, the sample keeps on looping. After a bunch of sample trigger, it even appears to hang later on (perhaps running out of channels).
Does this sound familiar to anyone? Any ideas where to hunt for, or do you see an obvious mistake?
Thanks for any ideas.
- Mentos asked 14 years ago
To answer myself, 2 stupid things:
– Loading using a channel (1st arg to FSOUND_Sample_Load()); I needed to use FSOUND_UNMANAGED for example instead (although it didn’t really hurt)
– The delayed LOOP_OFF only works on software channels, as indicated by the docs. Instead, I now have to use FSOUND_Sample_SetMode(sample,FSOUND_LOOP_OFF) before playing.
That seems to do the trick…
- Mentos answered 14 years ago
So I want to play a machine gun sound. When someone stops shooting, I’d like there to be a trailing sound…
While a machine gun is going “ra-ta-ta-ta-ta”, I’ve got a small looping sound. When it’s time to stop I was planning on stopping the looping sound, and playing a last burst with tail: “ta-ta-<longer sound tail, possibly with secondary noises that would not have been heard while the gun was actually going off>”.
But when I stop the first looping sound… it can stop anywhere in the sample in a way that makes it sound stupid. Such as “ra-ta-t”. It would be good if I could tell the hardware to finish with the repeat-sample sound at the very end of the sample.
Either that, or there has got to be an easier way to do this.
In the old sound engine, I’d have just a single sound (with sound trail), and while the gun kept on firing, we’d just bounce the playback position to the beginning of the sample, and when the gun stopped, we’d just let the entire sound play on through to the very end.
Is there any nice way of doing this using the hardware 3D sound buffers? I’m guessing I’m missing something that would make this easier.
Maybe the thing to solve this, is to use FSOUND_Streams with FSOUND_STREAMCALLBACK, and fill in samples from an FSOUND_Sample…
So while the machine gun was firing, I’d copy the repeating sound portion, and when it was time to stop, I’d feed in the rest of the sound (or the trail part of a second sample)…
Please login first to submit.