0
0

After not being able to find any c# examples in the documentation for addSyncPoint i decided to give it go by myself. I used the following Code in a console App:

delegate void MyFunctionCallback();
static void Main(string[] args)
{
MyFunctionCallback d = new MyFunctionCallback(DoSomething);
FMOD.System _system = null;
FMOD.RESULT result = FMOD.Factory.System_Create(ref _system);
result = _system.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null);
FMOD.Sound _sound = null;
result = _system.createSound(@"C:\AudioTest.mp3", MODE.HARDWARE, ref _sound);
FMOD.Channel _channel = null;
result = _system.playSound(CHANNELINDEX.FREE, _sound, true, ref _channel);
uint length = 0;
result = _sound.getLength(ref length, TIMEUNIT.MS);
if (length > 15000)
{
IntPtr ptr = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(d);
result = _sound.addSyncPoint(10000, TIMEUNIT.MS, "FadeInPoint", ref ptr);
}
Play(_channel);
Console.ReadLine();
result = _sound.release();
result = _system.release();
}

private static void Play(FMOD.Channel channel)
{
FMOD.RESULT result = channel.setPaused(false);
}
private static void DoSomething()
{
Console.WriteLine("Reached SyncPoint");
}

I have removed some Console.WriteLines, and ERRCHECK calls after every FMOD function, and here is my output:
Creating System…
Result: No errors. – OK
Initializing System…
Result: No errors. – OK
Loading Sound…
Result: No errors. – OK
Playing Sound in Paused Mode…
Result: No errors. – OK
Getting Length of Sound…
Result: No errors. – OK
Adding SyncPoint…
Result: No errors. – OK
Unpausing Sound…
Result: No errors. – OK

So my syncpoint never get’s hit, when it should do after 10 seconds? am i doing something wrong?

  • You must to post comments
0
0

you’re never calling system::update

  • You must to post comments
0
0

For some reason c# samples are hardly available. I sure hope someone steps up and shows us some examples.

gr. Harold

  • You must to post comments
0
0

FMOD Ex ships with 27 C# example programs. Look in the examples_csharp directory.

  • You must to post comments
0
0

But none of them shows how to use the AddSyncPoint function, and how to handle the callbacks.

gr. Harold

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.