0
0

Hi all, first sorry for mu little English!,
I’ve a little problem with FMOD and CallBacks in C#, the RESULT returns OK, but when the sound ends the callbacks don’t start.

Here is the code:

[code:k66e4ro0]public FMOD_Sonido(string Ruta)
{

        MiRuta = Ruta;  

    try{

        MainClass.MiServidorDeSonidosFMOD.MiSistema.createStream(MiRuta,FMOD.MODE.SOFTWARE | FMOD.MODE.CREATECOMPRESSEDSAMPLE | FMOD.MODE.LOOP_OFF, ref MiSonido);
        MainClass.MiServidorDeSonidosFMOD.MiSistema.playSound(FMOD.CHANNELINDEX.FREE, MiSonido, true, ref MiCanal);
        MiCanal.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, new FMOD.CHANNEL_CALLBACK(ev_end), 0);

        Reproducir();

        }
        catch(Exception ex)
        {
              Console.WriteLine(ex);
        }

    }[/code:k66e4ro0]

It’s the constructor…, and now the ev_end() Function:

[code:k66e4ro0] public FMOD.RESULT ev_end(IntPtr channelraw, FMOD.CHANNEL_CALLBACKTYPE type, int command, uint commanddata1, uint commanddata2)
{
Console.WriteLine("ooooooooooooooooooooooooooooooh");

        OnTermina(EventArgs.Empty);

        return FMOD.RESULT.OK;
    }  [/code:k66e4ro0]

And the: "oooooooooooooooooooooooh" isn’t appear when the songs end..:(

Any ideas?

Thanks!!

  • You must to post comments
0
0

Do you call to [b:3ro8q9m8]system.update[/b:3ro8q9m8] regularly? This update the fmod engine and polls the callbacks.

  • You must to post comments
0
0

It’s for a fps game, when I should call system.update(); after the callback asignation, or every fps?

I have tried do the update(); after ever fps but the callback doesn’t work:(

  • You must to post comments
0
0

Right… now I have a little(or big :P) problem, I’ve written a Timer that update the system every 250ms, but when the callbacks should execute, I have an acess violation problem:

[code:2j8yu21p]************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at FMOD.System.FMOD_System_Update(IntPtr system)
at PlasmaBrick.ServidorDeSonidosFMOD.OnMiTimer(Object o, EventArgs e) in c:\Documents and Settings\Xavier\Mis documentos\SharpDevelop Projects\PlasmaBrick\ServidorDeSonidos.cs:line 560
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)[/code:2j8yu21p]

if I don’t do the setcallback this error don’t apparear, it’s vary similar that this:

http://52.88.2.202/forum/viewtopic.php … 601a01b0f0

Thanks for all

  • You must to post comments
0
0

You should just call system.update() every frame. Calling it from a different thread will cause problems.

  • You must to post comments
0
0

I do it but the acess violation continues… :S

And too, now I can’t do: Chanel.stop(); Chanel.setPaused(false); I obtain the acess violation error too

  • You must to post comments
0
0

A timer is not in the same thread as the main thread, unless you have ALL of your logic in that timer including loading/game logic/everything.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.