View Full Version : Syncrhonization help needed!!

10-09-2003, 01:52 AM
Im trying to sync some music to some effects using FMod, but I can't get it to work. Im using FSOUND_Stream_SetSynchCallback to read RIFF markers inside the stream file. (in this case, a wav file.. ;))

Here is the C code for making it work, located in the FMod documentation:

signed char endcallback(FSOUND_STREAM *stream, void *buff, int len, int param)

// end of stream callback doesn't have a 'buff' value, if it doesn't it could be a synch point.
if (buff)
printf("\nSYNCHPOINT : \"%s\"\n", buff);


return TRUE;


I tried to do a conversion of this to delphi, but it was rather unsuccesfull.
All I need is the string value of the RIFF markers so I can do a basic IF/case of in my mainloop...
Please help me.. Thanks in advance.

11-09-2003, 08:25 PM
Ok, so i've managed to come up with the following code:

procedure TForm1.Timer1Timer(Sender: TObject);
Point: Pointer;
Point2: PChar;
Number: integer;
PcmOffset: Cardinal;
Marker: string;

PcmOffset:=FSOUND_XADPCM; //This is probably wrong.. ;)
Marker:=FSOUND_Stream_GetSyncPointInfo(point,PcmOf fset);


This code does work, but it doesen't do what I want it to do. ;)
I want the RIFF markers to be read as the file plays along, but this just gets the total number of markers in the file, and stores the label of the last marker in the variable Marker. So the question is: what do I have to do to create a program to read the markers in realtime? well, I have to use FSOUND_Stream_SetSynchCallback. But, the parameters of this function, (stream: Pointer to the stream to callback when a synch point is reached, callback: Function to call when synch point is reached, and userdata: user data that is passed into the callback.) gives me a VERY hard time.. :( so please, if you know how to do this, help me out.. Thanks.