0
0

The code below is not working please help me to get it work.
How can ı run FSOUND_DSP_Create command in c#? Thanks…

public long mixertype;
public int taillen;
public long startlen;
public long EchoBuff;
public int EchoOffset;
public int EchoLen;
public IntPtr EchoUnit;
public const int OutputFreq = 44100;
public const long MaxEchoLen = (500 * OutputFreq / 1000);
public long LShift(long lThis, long lBits)
{
return (lThis * (2 ^ lBits));
}
public long RShift(long lThis, long lBits)
{
return (lThis * (2 ^ lBits));
}
public delegate int CallbackDelegate(int originalbuffer, int newbuffer, int length, int param);
public int Callback(int originalbuffer, int newbuffer, int length, int param)
{
mixertype = FmodFunction.FSOUND_GetMixer();
taillen = EchoLen – EchoOffset;
startlen = length – taillen;
if (EchoOffset + length > EchoLen)
{
FmodFunction.FSOUND_DSP_MixBuffers(newbuffer, EchoBuff + LShift(EchoOffset, 2), taillen, OutputFreq, 128, FSOUND_MISC_VALUES.FSOUND_STEREOPAN, FSOUND_MODES.FSOUND_STEREO | FSOUND_MODES.FSOUND_16BITS);
FmodFunction.FSOUND_DSP_MixBuffers(newbuffer + LShift(taillen, 2), EchoBuff + startlen, taillen, OutputFreq, 128, FSOUND_MISC_VALUES.FSOUND_STEREOPAN, FSOUND_MODES.FSOUND_STEREO | FSOUND_MODES.FSOUND_16BITS);
memory.CopyMemory(EchoBuff + LShift(EchoOffset, 2), newbuffer, LShift(taillen, 2));
memory.CopyMemory(EchoBuff, newbuffer + LShift(taillen, 2), LShift(startlen, 2));
}
else
{
FmodFunction.FSOUND_DSP_MixBuffers(newbuffer, EchoBuff + LShift(EchoOffset, 2), length, OutputFreq, 128, FSOUND_MISC_VALUES.FSOUND_STEREOPAN, FSOUND_MODES.FSOUND_STEREO | FSOUND_MODES.FSOUND_16BITS);
memory.CopyMemory(EchoBuff + LShift(EchoOffset, 2), newbuffer, LShift(length, 2));
}

        EchoOffset = EchoOffset + length;
        if (EchoOffset >= EchoLen)
        {
            EchoOffset = EchoOffset - EchoLen;
        }

        return newbuffer;
    }
    private void initdsp()
    {
        EchoOffset = 0;
        EchoBuff = memory.GlobalAlloc(0x40 | 0x0, LShift(MaxEchoLen, 2));
        EchoUnit = FmodFunction.FSOUND_DSP_Create(new CallbackDelegate(Callback), 303, 0);
        FmodFunction.FSOUND_DSP_SetActive(EchoUnit, true);
        FmodFunction.FSOUND_Stream_SetBufferSize(250);
    }
  • You must to post comments
0
0

OK There are many problems in my code. Can someone give me a sample code about FSOUND_DSP_CREATE in c# that is working.
Im using c# net and pocket pc 2003.
İf there is a sample c# project about dsp and dsp create i will be happy.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.