0
0

Ok, first of all I know I can use FSOUND_Stream_Open to do this but I am going to be using a virtual file system and want to get my callback working with normal file functions (fopen, fseek etc) first before using the actual vfs. My code is shown below but it produces just a hissing noise.

[code:3oeb6d5p]

include <fmod.h>

include <fmod_errors.h>

include <stdio.h>

include <conio.h>

FILE *fp;
int pos;
FSOUND_STREAM *stream;

signed char F_CALLBACKAPI streamcallback(FSOUND_STREAM *stream, void *buff, int len, void *param)
{
fread(buff,len,1,fp);

fseek(fp,len,pos);
pos = pos + len;

printf(&quot;Pos: %d\n&quot;,pos);
printf(&quot;callback: buff = %p, len = %d\n&quot;, buff, len);

return 1;

}

int main()
{

FSOUND_Init(44100,16,0);
pos = 0;    
fp = fopen(&quot;main.mp3&quot;,&quot;rb&quot;);

stream = FSOUND_Stream_Create(streamcallback, 6*2048, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 44100, (void *)12345);

FSOUND_Stream_Play(FSOUND_FREE,stream);

getch();

FSOUND_Stream_Close(stream);

FSOUND_Close();

fclose(fp);

return 0;

}
[/code:3oeb6d5p]

I tried to adapt the Stream2 sample to achieve my goal of streaming an mp3/ogg from disk. Could you please suggest what I am doing wrong.

Thanks

  • You must to post comments
0
0

A stream callback is PCM data only, try the file callbacks instead

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.