0
0

Hi!
I have a loop in an large audio file.
After the end of the loop, I want to stop the playback of the audio file. How do I do this?

  • You must to post comments
0
0

[code:73lu38de]
IntPtr p = new IntPtr();
...
sound.addSyncPoint(Convert.ToInt32(_end_position + 0.001), FMOD.TIMEUNIT.MS, "EndPoint", ref p);[/code:73lu38de]

And how do I create the callback? Because untill now there’s no different behaviour…

  • You must to post comments
0
0

Finally I know how to do a callback:
[code:292djgqm]private static FMOD.RESULT SyncCallback(IntPtr channel, FMOD.CHANNEL_CALLBACKTYPE type,
int command, uint commanddata1, uint commanddata2)

    {
        if(commanddata1 != 0 && commanddata1 != 1) // only when a syncpoint is passed....but does not work
            MessageBox.Show("Now");
        return FMOD.RESULT.OK;
    }

FMOD.CHANNEL_CALLBACK ChannelCallback = new FMOD.CHANNEL_CALLBACK(SyncCallback);

....
sound.addSyncPoint(Convert.ToInt32(_end_position + 0.001), FMOD.TIMEUNIT.MS, "EndPoint", ref p);

channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.SYNCPOINT, ChannelCallback, 0);
[/code:292djgqm]

But the callback function triggers about 100 times when the sync point is played…
AND the callback function is static, so how do I pause the audio playback instantly when the callback is issued?

  • You must to post comments
0
0

[quote="maximilian.schaller":2ivzb729]Hi!
I have a loop in an large audio file.
After the end of the loop, I want to stop the playback of the audio file. How do I do this?[/quote:2ivzb729]

then why are you looping it?? Just play it once

  • You must to post comments
0
0

Okay, I set a couple of things to static, and it works…

But if I use
[code:10zjtlj8]sound.deleteSyncPoint(p);[/code:10zjtlj8]
The applications stalls….

  • You must to post comments
0
0

Because I do not loop the large audio file, I have a loop in it.

I don’t want to loop the audio file with a duration of 185 mins. I just want to loop 5 secs, and then stop the playback.

  • You must to post comments
0
0

Stream it, and then setposition back to 0, every 5 seconds?

  • You must to post comments
0
0

The problem is not the looping. The problem ist that it does not stop the playback when the loop is finished. And I need an accuracy of a few milliseconds.

  • You must to post comments
0
0

How are you doing it currently? I think I would:
Create sound
Add a sync point on the loop point at time
Create callback
Play sound
On sync point, loop or stop?

Is that correct…?

  • You must to post comments
0
0

I’ll do it like this:

[code:1ew83q62]
FMOD.RESULT result;
result = system.createSound(openFile_mp3.FileName, (FMOD.MODE._2D | FMOD.MODE.HARDWARE | FMOD.MODE.CREATESTREAM | FMOD.MODE.ACCURATETIME), ref sound);
ERRCHECK(result);

...

            Pause();

            SetPlayPosition(_start_position);

            FMOD.RESULT result;
            result = channel.setLoopPoints(_start_position, FMOD.TIMEUNIT.MS, _end_position, FMOD.TIMEUNIT.MS);
            ERRCHECK(result);


            result = channel.setLoopCount(1);
            ERRCHECK(result);

            result = channel.setMode(FMOD.MODE.LOOP_NORMAL);
            ERRCHECK(result);

            Resume();[/code:1ew83q62]

Can you please tell me how to do it?

Add a sync point on the loop point at time
Create callback
And on sync point: cut off

  • You must to post comments
0
0

Could you add a sync point just after the loop marker, to end the sound?

  • You must to post comments
0
0

[quote="a1psx":3g9qk9ec]Could you add a sync point just after the loop marker, to end the sound?[/quote:3g9qk9ec]
But how do I do this? And how do I restore the default after the loop has finished?

Edit:
addSyncPoint() is the right function. But I do not understand the first argument…

  • You must to post comments
0
0

Sound.addSyncPoint(_end_position+0.001, FMOD.TIMEUNIT.MS, "EndPoint", NULL);

I’ve never created one, but the info is in the .chm, all my markers come embedded in the wav’s.

  • You must to post comments
Showing 12 results
Your Answer

Please first to submit.