0
0

Hi
I have a sound processed by the DSP effects.
When using sound.@lock I get the sound without the DSP effects on it. My question is – How to accuire the final sound proccessed by the effects (The same which i’m hearing in the speakers).Thanks for any help

  • You must to post comments
0
0

You would create a custom DSP effect, then use System::addDSP to put it into the pipeline.

Your custom DSP would just copy the input to output, and inbetween you can save it to a file or whatever.

  • You must to post comments
0
0

Ok I’ve added this custom DSP effect. Which methods should I use, to obtain sound data?

  • You must to post comments
0
0

In the DSP you’ve added, just copy the data, something like this

FMOD_RESULT F_CALLBACK Process(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels)
{
memcpy(outbuffer, inbuffer, length * inchannels * sizeof(float));
fwrite(outbuffer, sizeof(float), length * inchannels, gFileHandle);
}

Something like that I guess..

  • You must to post comments
0
0

I’m using c# and net.framework 2.0

[code:4sd391sb]
InitializeComponent();
FMOD.Factory.System_Create(ref fmod_system);
fmod_system.setOutput(FMOD.OUTPUTTYPE.ASIO);
fmod_system.setDriver(0);
fmod_system.setRecordDriver(0);
fmod_system.init(2, FMOD.INITFLAG.NORMAL, (IntPtr)null);
FMOD.CREATESOUNDEXINFO desc_buf = new FMOD.CREATESOUNDEXINFO();
desc_buf.cbsize = 96;
desc_buf.numchannels = 2;
desc_buf.format = FMOD.SOUND_FORMAT.PCM16;
desc_buf.defaultfrequency = 44100;
desc_buf.length = (uint)(desc_buf.defaultfrequency * 2desc_buf.numchannels2);
fmod_system.createSound((string)null, (FMOD.MODE._2D | FMOD.MODE.SOFTWARE | FMOD.MODE.OPENUSER |FMOD.MODE.LOOP_NORMAL), ref desc_buf, ref sound);
file_stream = new FileStream("nag.wav", FileMode.Create, FileAccess.Write);
desc.read = new FMOD.DSP_READCALLBACK(READ_CALLBACK);
desc.channels = 2;
fmod_system.createDSP(ref desc,ref dsp);
fmod_system.recordStart(sound, true);
fmod_system.playSound(FMOD.CHANNELINDEX.REUSE, sound, false, ref channel);

    }

    FMOD.RESULT READ_CALLBACK(ref FMOD.DSP_STATE dsp_state,IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, int outchannels)
    {
        outbuffer = inbuffer;
        byte[] buf = new byte[length*4*2];
        Marshal.Copy(inbuffer, buf, 0, (int)(length*4*2));
        file_stream.Write(buf, 0, (int)(length*4*2));
        return FMOD.RESULT.OK;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        fmod_system.addDSP(dsp);
        dsp.setActive(true);
        recording = true;
        button1.Enabled = false;
        button2.Enabled = true;
    }

[/code:4sd391sb]

  • After clicking on button1, the sound stops playing – Did I made sth wrong with the outbuffer in callback?

*file_stream.Write writes only null values to my file.

can anybody help?

  • You must to post comments
0
0

I’m not sure about C#, but FMOD supplies the outbuffer, and has to be filled in. Unless your outbuffer=inbuffer; statment does that, it would explain why you hear no sound?

  • You must to post comments
0
0

I’ve putted this instead of my previous READ_CALLBACK body.. (this is exactly the same as in the dsp_custom example)

[code:8wwtb11d]
FMOD.RESULT READ_CALLBACK(ref FMOD.DSP_STATE dsp_state,IntPtr inbuf, IntPtr outbuf, uint length, int inchannels, int outchannels)
{
uint count = 0;
int count2 = 0;

        unsafe
        {
            float* inbuffer = (float*)inbuf.ToPointer();
            float* outbuffer = (float*)outbuf.ToPointer();

            for (count = 0; count < length; count++)
            {                    
                for (count2 = 0; count2 < outchannels; count2++)
                {                       
                    outbuffer[(count * outchannels) + count2] = inbuffer[(count * inchannels) + count2] * 0.2f;
                }
            }
        }
        return FMOD.RESULT.OK;
    }

[/code:8wwtb11d]

and.. still the sound stops playing after clicking button1. Also I’ve found out that my inbuffer values are all null, all the time. really can’t get it…

  • You must to post comments
0
0

I’ve notice very weird thing. All started to work, after setting in the description of dsp the channel value to 0.

desc_dsp.channel = 0 – All works great. The out_channel parameter in READ_CALLBACK has the value of 2.

desc_dsp.channel =1 – All works great. The out_channel parameter in READ_CALLBACK has the value of 1.

desc_dsp.channel = 2 – Everything stopped. The in_buffer parameter has only null values. The out_channel parameter in READ_CALLBACK has the value of 2.

I don’t know why this is happening, and I don’t want to think about it anymore 😕 Watch out for this channel value! See ya.

  • You must to post comments
0
0

channel=0 will not check to see if it can send ‘X’ channels to you, and just sends them. How many channels are you getting sent, is it 2 or 6 (5.1)?

  • You must to post comments
0
0

the sound that gets into mydsp unit has 2 channels.

ps. I’ve made a mistake earlier – desc_dsp.channel =1 don’t work either.

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.