0
0

Hey all,

I’ve been trying to follow sample code found in this forum but things aren’t really working out that well. I’m writing an mp3 player in C++ for windows mobile devices, using fmodce. Naturally, I’d like to know when a stream reaches it’s end, to jump to the next track. Everything seems to be set up properly, but it refuses to work. I’ve included my code below, hope someone can help:

//This is my callback function, it should exit the app when called
FSOUND_STREAMCALLBACK Callback(FSOUND_STREAM *stream,void *buff,int len,int param){
PostQuitMessage(0);
return 0;
}

//The code below is in my WM_CREATE message for my main window

if (FSOUND_Init(44100, 32, 0) == FALSE)
MessageBox(hWnd, (LPCWSTR)L"Fmod Init Call Failed!", NULL, MB_OK | MB_ICONEXCLAMATION);

 FSOUND_STREAM *test = FSOUND_Stream_Open("test.mp3", 0,0,0);


 if (FSOUND_Stream_SetEndCallback(test,(FSOUND_STREAMCALLBACK)Callback,0) == FALSE)
    MessageBox(hWnd,L"CALLBACK NOT! SET!", NULL, MB_OK | MB_ICONEXCLAMATION);

FSOUND_Stream_Play(FSOUND_FREE,test);

The mp3 plays perfect, but when it’s done playing, the callback function isn’t executed. None of the messageboxes above pop up to indicate there was a problem, the Stream_SetEndCallback function returned TRUE. Any ideas? At a real loss here.

-Chad

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.