0
0

[b:fltehm31]My enviroment: .NET 2.0 with C# and VisualStudio 2005 Express[/b:fltehm31]

I have test to write my own dsp functions with
FMODEx and C#. To play a sound is no problem!
But my own callback method would never
called…

Furthermore, I think there is an error / bug in your fmod_dsp.cs
file. See your “public struct DSP_DESCRIPTION”: all “DSP_”-types
miss a public. [b:fltehm31]Result? The developer can’t see all them.
They are not visible.[/b:fltehm31]

I fixed that for me… because otherwise I can never write my own
dsp function ==> I can’t write my DSP_READCALLBACK to the struct
otherwise!

I hope anyone can help me. Maybe my way is
completely wrong?!? I see no reason, why my
callback never was called. Okay, here is my
short example code:

[code:fltehm31]
using System;
using System.Windows.Forms;
using FMOD;

namespace FMODDSPTest
{
public class Test
{
private static FMOD.System system;
private static Sound sound;
private static Channel channel;
private static DSP_DESCRIPTION dspDesciption;
private static DSP dsp;

    [STAThread]
    public static void Main(string[] args)
    {
        // Create all the things
        new Test();

        // To keep open the program until
        // press enter...
        Console.ReadLine();

        // Free system
        channel.stop();
        sound.release();
        dsp.release();
        system.release();
    }

    public Test()
    {
        // Lets choose a MP3-File
        OpenFileDialog open = new OpenFileDialog();
        open.Multiselect = false;
        open.Filter = "MP3 files|*.mp3";
        open.ShowDialog();

        // Was a file selected?
        if (open.FileName == null || open.FileName == string.Empty)
        {
            // No!
            throw new Exception("No file selected!");
        }

        // Create system...
        Error(Factory.System_Create(ref system));

        // Init system...
        Error(system.init(1, INITFLAG.NORMAL, IntPtr.Zero));

        // Create Stream...
        Error(system.createStream(open.FileName, MODE.SOFTWARE, ref sound));

        // Play Sound
        Error(system.playSound(CHANNELINDEX.FREE, sound, false, ref channel));

        // DSP informations
        dspDesciption = new DSP_DESCRIPTION();
        dspDesciption.channels = 0;
        dspDesciption.name = "My DSP";
        dspDesciption.read = new DSP_READCALLBACK(MyDSP);

        // Create my DSP
        Error(system.createDSP(ref dspDesciption, ref dsp));

        // No bypass
        dsp.setBypass(false);

        // Active!
        dsp.setActive(true);

        // Add the DSP
        system.addDSP(dsp);
    }


    // Here my callback-method! But there is no call back...
    private RESULT MyDSP(ref DSP dsp, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, int outchannels)
    {
        Console.WriteLine("Call my DSP function...");
        return RESULT.OK;
    }

    public void Error(FMOD.RESULT result)
    {
        if (result != RESULT.OK)
        {
            throw new Exception(result.ToString());
        }
    }
}

}

[/code:fltehm31]

  • You must to post comments
0
0

Hi, yes, the fmod_dsp.cs file was out of date. This has been fixed in the latest version we just released today. It also includes a c# version of the dsp_custom example, which does what you are trying to do.

  • You must to post comments
0
0

A big “thanks” from europe 😀

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.