Ok, so I’ve asked about this before … but I seem to have found an issue
with looping streaming sounds.
What I want to do is to load a streaming sound at the start of the program
Then have the option of playing the stream in a looped or un-looped mode
The way I am currently doing this is:
( I’ve omitted bits of code here (in case you hadn’t guessed 😉 ))
// Load function
stream = FMSStream::OpenFile( "media/music.mp3", FSOUND_NORMAL, 0);
// The following is in some other part of the class
// Play the stream
int channel = FMSStream::Play( FSOUND_FREE, stream );
// Set the stream to loop
FMSChannel::SetLoopMode( channel, true );
So basically I start the stream, storing the channel handle, then set the
loop mode on the channel.
THIS DOES NOT WORK 😕
The stream plays briefly … then stops.
Is there some sort of function like the FSOUND_Sample_SetMode, but for
streams. That way I could set the loop mode of the stream before I play it.
I guess I could just open the stream each time it is called to be played, and
set the loop mode on load … but opening the stream each time I want to
play it seems bad
Just to let you know, if I open the stream with FSOUND_LOOP_NORMAL, it
loops as expected when I play it ….. but as I said I don’t want to open it
with this flag to allow the option of playing it either looped, or unlooped
[quote:1wgyzjiq]Its usually a good idea to keep handles on your streams instead of letting them roam free [/quote:1wgyzjiq]
LOL – yeah fair enough
I am holding onto them …. I was just asking in the case that a class that
hasn’t started the stream, and doesn’t know about the class that did start
it, wants to then do stuff with it – an unlikely case, but there are some
situations where this could occur.
thanks for the link anyway – that was the function I’m after
Out of curiousity, how difficult would it be to modify FMOD’s looping behavior for samples, streams and modules such that instead being a simple boolean “play once” vs. “loop forever” value, you could specify an integer loop count (with 0 representing “loop endlessly” and values >0 being the number of times to play the sound)?
I’m trying to use FMOD to provide a alternative sound implementation for [url=http://www.etc.cmu.edu/projects/panda3d:1mu5ms2b]an open-source 3D engine[/url:1mu5ms2b], and the inability to set a sound’s specific loop count is one of the only things keeping my implementation from feature-completeness…any help would be appreciated!
- cort answered 15 years ago
Ok, that’s fine.
So I have two questions:
If I open a stream with the FSOUND_NORMAL flag, is there a way to then play the stream as a looping stream?
(this is what I was trying to do by setting the loop mode after playing the stream)
- You can change the loop mode with samples by calling FSOUND_Sample_SetMode before you start the sample
- Is there a way to do the same thing with streams?
If there is no anwser for the above question ….
What is the overhead in opening a stream each time I want to play it, and closing the stream after I am done with it.
- This way I can specify the loop mode of the stream upon opening it
- If using this method in our game, it is likely that a new stream will need to be opened every 10-40 seconds
Please login first to submit.