0
0

I am using the FMOD C# API in a WPF app, and I am having problems getting a channel callback when a sound is done playing. I took code directly from the "3d" project in the ‘examples_csharp’ solution provided with the API.

If I modify the "3d" project to use a channel callback, it works fine. If I cut and paste the same code into my WPF project, I don’t get the callback. The sound plays fine in both apps. Here is the modified section of the ‘3d’ project:

[code:2w7b07vr]
private void button3_Click(object sender, System.EventArgs e)
{
FMOD.RESULT result;
result = system.playSound(FMOD.CHANNELINDEX.FREE, sound3, false, ref channel3);
ERRCHECK(result);
result = channel3.setCallback(CHANNEL_CALLBACK); //my code
ERRCHECK(result); //my code
}

  //my code 
  public RESULT CHANNEL_CALLBACK(IntPtr channelraw, CHANNEL_CALLBACKTYPE type, IntPtr commanddata1, IntPtr commanddata2)
    {
        MessageBox.Show("I received a callback");
        return RESULT.OK;
    }

[/code:2w7b07vr]

Running the 3d example, I get the callback without a problem. If I run the same thing in my WPF project, I don’t get any callback. The sound plays with no error and the result of the setCallback call is ‘OK’. I noticed that when it is time for the callback to happen, I get a first-chance exception "Remote Procedure Call was cancelled".

Anyone have any idea what is preventing the callback from working in this situation?

Thanks in advance!

Edit: SOLVED
Nothing helps solve a problem quite as much as typing out a long post. I simply needed to call ‘system.update()’ during the idle cycles of my WPF app in order to start getting callbacks.

  • You must to post comments
0
0

Welcome to the forums Ben, I’m glad you solved your problem.

  • You must to post comments
0
0

thats for pointing that out i bet that took you ages to work out..ya got nutin better to do with ya time?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.