0
0

Hi Gang,

I was trying to stream a 2m:36s mp3 file. I noticed that the playback constantly repeats the first 1 second or so of the piece even though I made no changes to the loop settings. I then tried to play back a regular .wav file and it appears to do the same thing.

The following listing is a chronological log of the FMOD calls invoked by my code. I’ve checked the return values of every call and everything was successful.

//=================================
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
// no error
FSOUND_SetDriver(0);
// no error
FSOUND_SetMixer(FSOUND_MIXER_QUALITY_MMXP6);
// no error
FSOUND_SetHWND(hwnd);
// no error
FSOUND_SetMaxHardwareChannels(12);
// no error

FSOUND_Init(44100,10,0);
// no error,
// Notice that FSOUND_INIT_STREAM_FROM_MAIN_THREAD is not used.
// My code is not required to – and does not – call FSOUND_Update() every frame. I tried calling it
// for kicks but it made no difference.

FSOUND_File_SetCallbacks(..,..,..,..,..);
// no error

sound->stream = FSOUND_Stream_Open(file,FSOUND_2D | FSOUND_LOOP_OFF,0,0);
// no error, file exists and the callbacks are called properly

FSOUND_Stream_GetLength(stream);
// returns 2512063, actual file length is 2514111
FSOUND_Stream_GetLengthMs(stream);
// returns 156988, looks correct

FSOUND_Stream_SetEndCallback(stream,StreamEndCallback,sound);
// no error

sample = FSOUND_Stream_GetSample(sound->m_stream);
// no error
sound->channel = FSOUND_PlaySoundEx(FSOUND_FREE,sample,NULL,true);
// no error, paused

FSOUND_SetVolume(sound->m_channel,255); // no error
FSOUND_SetPaused(sound->m_channel,false); // no error, sound plays
//=================================

Again, the stream is audible but only loops the first one second or so of the mp3 and wav. The installed stream end handler is never called. I’ve stepped through all my file IO callbacks and while I didn’t know what data FMOD was reading, the filesystem was performing properly. I noticed that no file IO callbacks are made after the initial call to SOUND_Stream_Open().

I wanted to make sure the internal FMOD threads were working as intended. I monitored my process’ threads before and after my call to FSOUND_Init() and noticed four threads being created. I broke into the debugger at various points of execution and found that they were stopped at different addresses, indicating that the threads were in fact running.

Am I missing something? Maybe I’m just tired. =) I’ve used FMOD in one previous commercial project and didn’t have any problems whatsoever. I’m hoping someone will take one look at this and instantly see the problem because I unfortunately don’t.

Thanks in advance!
Jeff

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.