0
0

Its me again. :roll:
I am now trying to solve this problem for several hours and it seems, as i had taken the wrong path.
This is, what i do : I start playing several looped samples. I can now stop one of them, but thats it, the rest keeps on playing… I want a way to kill one after another. Can anybode tell me the right approach ?
THX

Wolf

  • You must to post comments
0
0

Not specifig enough, i think :
Here is some source-code :

my play-function :

void Play_Sample(int Piece, bool loop, int Volume)
{
if (x < 16)
{
if (loop)
{
FSOUND_Sample_SetLoopMode(Sound_Sample[Piece], FSOUND_LOOP_NORMAL);
}
else
{
FSOUND_Sample_SetLoopMode(Sound_Sample[Piece], FSOUND_LOOP_OFF);
}

    for (int i = 0; i &lt; NUM_OF_CHANNELS; i++)
    {
        if (Sample[i].channel == -1)
        {

            Sample[i].channel = x;
            Sample[i].number = Piece;
            FSOUND_PlaySound(x, Sound_Sample[Piece]);
            x++;
            break;
        }
    }

}
else x = 1;

}

The Stop-Function :
void Stop_Sample(int number)
{
for (int i = 0; i <= NUM_OF_CHANNELS; i++)
{
if (Sample[i].number == number)
{
FSOUND_StopSound(Sample[i].channel);
break;
}
}
}

So, all i do in the playfunction, is specifying my own channel (i count through them, but this doesnt seem to work, am i right ? It always uses channel 0) and let it play the previously loaded soundfile.
The stop-function searches in my struct, where i stored the channel- and type variables and deletes one of the searched ones (not the most exactly method, i know ;))

  • You must to post comments
0
0

Ok, i solved it. Just replaced my way of giving channel-numbers (the x) with the option FSOUND_FREE, now everything works finde

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.