0
0

I’m playing an mp3 as an FSOUND_STREAM in c++.

To open the file, I’m passing minimal arguments.

[code:206t99ga]
stream = FSOUND_Stream_Open( filename.c_str(), FSOUND_NORMAL, 0,0 );
[/code:206t99ga]

The output of FMOD_ErrorString(FSOUND_GetError()); reads:

No errors

I proceed to retrieve the mode: FSOUND_Stream_GetMode(stream);

16720

When I initialized fmod, I made 32 channels available.

1 Try it using the built in find free channel.

[code:206t99ga]
channel = FSOUND_Stream_Play(FSOUND_FREE,stream);
[/code:206t99ga]

2 Try each one manually until success:

[code:206t99ga]

// Has a channel already been assigned?
if( channel >= 0 )
{
channel = FSOUND_Stream_Play(channel,stream);

    // Confirm channel
    if( channel != -1 ) 
    {
            return true;
    }

}

// Find an available channel
for(int i=0; i < 32; i++)
{
channel = FSOUND_Stream_Play( i, stream );

    if( channel != -1 )
    {
           return true;
    }

}

return false;
[/code:206t99ga]

Unfortunately, neither work. False is returned because the channel is always equal to -1. I’ve confirmed that it tries every number from 0 – 31 and each one fails.

This problem has occurred inside of a class. The stream is opened in the constructor and the loop to open is inside play(). This class encapsulates a single stream, while another class is composed of a collection of the single sound streams. (Just fyi)

I can confirm having success independent of this class architecture in a test file. I’m using 3.7.5

Please help! How can this be?

Thank you,
Alex

  • You must to post comments
0
0

there is a stream example which does this already, just have a look at that code.

  • You must to post comments
0
0

I mentioned I didn’t have a problem using streams independently of the class. My problem was memory allocation because I’m not the wisest programmer yet. I was storing the Stream wrapper class as:

vector<StreamWrapper> * sounds;

instead of:

vector<StreamWrapper*> sounds;

no problems now 😉

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.