0
0

Hi

What I’m trying to do is to decompress a zip file containing a single mp3 by parts, and stream it with fmod. Ex.: Decompress the first 100KB of data, send to fmod, play it, kill it, then the next 100KB and so on…

I managed to do this with a standard stream, but when switching buffers there is a notible small gap, so I moved to custom streams, but all I hear is a constant hiss:

===THE PLAY FUNCTION===

[code:1o3u8hjd]
void play()
{

stream = FSOUND_Stream_Create(my_callback, DA_BUFFER_SIZE, FSOUND_NORMAL | FSOUND_LOADMEMORY | FSOUND_STREAMABLE, 44100, (void *) 12345);

if (!stream)
{ cout << "Error loading stream..." << endl;
  FSOUND_Close();
}

cout << "Channel Result: " << FSOUND_Stream_Play(FSOUND_FREE, stream) << ", Play function" << endl;

}
[/code:1o3u8hjd]

===THE CALLBACK===
(just want to play the first 100KB)

[code:1o3u8hjd]
signed char F_CALLBACKAPI my_callback(FSOUND_STREAM *stream, void *buff, int len, void *param)
{

cout << "This is the my_callback function" << endl;

GetZipItem(hz, a, &ze2); //Part of unzipping process
cout << "ZipItem name: " << ze2.name << endl;

cout << "Contents of buff BEFORE the unzipping: " << (char *)buff << endl;


UnzipItem(hz, a, buff, len); //Unzip part of mp3 to membuffer routine

cout << "Contents of buff AFTER the unzipping" << (char *)buff << endl;

cout << "Contents of MP3: " << (char*)buff << endl;

return 1;
}
[/code:1o3u8hjd]

What is wrong?

PS.: When I put a .wav file inside the zip it works, but then how do I make this work with mp3, ogg, wma, etc. ?

  • You must to post comments
0
0

[quote="brett":3t6do5dz]A stream callback is for PCM data and you are passing in compressed mpeg data? That is what is wrong.[/quote:3t6do5dz]

OK.. I see it, stupid question… it was my first time playing with fmod. Do you know if this fmod ex has stream callback capabilities of handling compressed audio data?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.