0
0

I’m sure there is a simple explaination for this, but I’ll ask anyway.

What I’m trying to do is to have two streaming samples loaded and at some point (currently a button press) have one stop and the other one start.

The problem I’m having is that this isn’t working – I’ve started prototyping this idea by modifying the ‘playstream’ example to allow two streams to be playing at once (to allow for the fact that there will be other channels being used in the project) and when the button press occurs I stop the first sample (the one thats playing) and start the second one.

Now the second sound starts streaming fine, but the first sample doesn’t stop, and a call to the assigned channel::isPlaying is returning false (mind you this check was done after the call to channel::stop() ).

here is the code I changed
[code:f3v517ym]channel->isPlaying( &bChan1Playing );
channel2->isPlaying( &bChan2Playing );

    if (paddata & SCE_CTRL_CROSS & ~lastpaddata)
    {
        if( !bChan1Playing && bChan2Playing ) {
            result = channel2->stop();
            ERRCHECK(result);
            result = system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
            ERRCHECK(result);
        }
        else {
            bool paused;
            channel->getPaused(&paused);
            channel->setPaused(!paused);
        }
    }

    else if (paddata & SCE_CTRL_CIRCLE & ~lastpaddata)
    {
        if( bChan1Playing && !bChan2Playing ) {
            result = channel->stop();
            ERRCHECK(result);
            result = system->playSound(FMOD_CHANNEL_FREE, sound2, false, &channel2);
            ERRCHECK(result);
        }
        else {
            bool paused;
            channel2->getPaused(&paused);
            channel2->setPaused(!paused);
        }
    }

    else if (paddata & SCE_CTRL_SQUARE & ~lastpaddata)
    {
        channel2->stop();
    }

    else if (paddata & SCE_CTRL_TRIANGLE & ~lastpaddata)
    {
        channel->stop();
    }[/code:f3v517ym]

The streams are created the exact same way, one is using the examples default sample (stream.at3) and the other stream is one I created (also .at3). They are created using the flag FMOD_CHANNEL_FREE.

Now I realise I could use the reuse flag, but I’d rather see if I can do this without having to rethink the way we are currently implementing streaming audio (as this is a special case only for the bonus levels in our project)

Just wanting to get some insight on what might be causing this. Worst case I’ll have to use the reuse flag and keep track of the channel used for the streaming audio.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.