0
0

Hello Brett,
Is there a way to get with precision a position during the playback?
Because I have a lot of functions which require
to play from a position A and make something to a position B precisely.
I have tried this:
code:
void __fastcall TForm1::PlaySound(FMOD_SOUND snd)
{
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, snd, 0, &channel);
ERRCHECK(result);
// attacher un callback pour surveiller la fin du morceau
/

FMOD_Channel_SetCallback(
channel,
FMOD_CHANNEL_CALLBACKTYPE_END,
MyCallback, 0);
*/

result = FMOD_Channel_IsPlaying(channel, &playing);
ERRCHECK(result);
result = FMOD_Channel_GetPaused(channel, &pausing);
ERRCHECK(result);

while (playing)
{
FMOD_Channel_GetPosition(channel, &pos, FMOD_TIMEUNIT_MS);
if (pos == 1000)
{

       Beep(440, 50);

    FMOD_Channel_Stop(channel);
FMOD_Channel_IsPlaying(channel, &playing);           
    // make something ...
}
  Application->ProcessMessages();

}

}
//—————————————————————————

The problem is sometimes the system has no time to determine the exact position playback.
But, if I do this:
code:
while (playing)
{
if (pos >= 1000)
// do some thing …

}
It works very fine.

Thanks !!!

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.