0
0

Since I received no response to the last query, I’ll try again.

If I am playing an MP3 file through WinAmp or RealOne player (or streaming a radio station), and I start my game, when I get to the FSOUND_Stream_OpenFile() line to load the background music for my game, my game crashes.
This does not occur if I’m streaming with the QuickTime player (for example, streaming the NPR radio station through QT). In fact, the stream will load and play properly in that case.

I’ve created a small sample application that opens a window and attempts to play an mp3 file located in a /music subdirectory.

I’ve not included the app entirely below, but enough that anyone resourceful could piece one together quickly.

My first FMOD lines, called with WM_CREATE in WindowProc:

FSOUND_SetDriver(0);
//FSOUND_SetOutput( FSOUND_OUTPUT_WINMM );
FSOUND_Init(44100, 32, 0);
FSOUND_SetPan(FSOUND_ALL, FSOUND_STEREOPAN);

Since the problem occurs in a game I’m making, for this sample app I have a while(TRUE) loop in WinMain which calls my main game loop

while( TRUE )
{
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
if( msg.message == WM_QUIT )
break;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
GameLoop();
}
}

And in my GameLoop:

void GameLoop()
{

if( GameState == 0 )
{
stream = FSOUND_Stream_OpenFile("./music/pipedreamsloop.mp3", FSOUND_LOOP_NORMAL | FSOUND_MPEGACCURATE, 0);
streamchannel = FSOUND_Stream_Play(FSOUND_FREE, stream);
FSOUND_SetVolume(streamchannel, 200 );
GameState = 1;
}
}

If I run the app while RealOne or WinAmp is streaming or playing an mp3 from the harddisk, this app crashes at FSOUND_Stream_OpenFile (no crash if that line is commented out). When Quicktime is streaming or playing, this crash does not occur.

I’ve also tried loading and playing a sound sample. This does not produce a crash.

I’m curious to know if anyone else can reproduce this. If interested, I can send you the full sample code.

  • You must to post comments
0
0

We had this happen with our game as well. Firstly, we told our developers to stop running WinAmp while testing the game. This fixed a lot of the problems. :smile:

Secondly, I believe we used DSOUND output. This is from memory, so it may not be correct. I think DSOUND allowed two applications to access the soundcard simultaneously. WinAmp can be told to use either WINMM or DSOUND in Preferences/Plug-ins/Output.

  • You must to post comments
0
0

You should also have checked the result of FSOUND_Init, you could have seen that it was unable to initialize before you used any other FSOUND function so your program wouldn’t crash.
I have had the problem also, but it depends on the computer or sound card it seems.
On a sb live with winXP winamp and my application can run together, but on my sbPCI128 with win98 it wouldn’t. I have recently upgraded that computer to win2k and now winamp and fmod can work together…

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.