0
0

Hello everybody,
to transform a buffer during the playback (still like Sound Forge),
I have a good idea to try to understand how the DspCallBack works?
But since this good idea, I can’t play my New Buffer.
Someone can explain me please ?

code :
int iChannel =1;
FSOUND_SAMPLE *dspSamp;
FSOUND_DSPUNIT *dspUnit;

struct TStereo16Bits // pour séparer les canaux
{
short leftChannel;
short rightChannel;
};

dspSamp = FSOUND_Sample_Load(FSOUND_UNMANAGED, “presentation.wav”, (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_STEREO | FSOUND_2D), 0, 0);

void * F_CALLBACKAPI __stdcall DspCallback(void *originalbuffer, void *newbuffer, int length, void *userdata)
{

int start =0;
length =880; // for 20 miliseconds
TStereo16Bits * truc = (TStereo16Bits *)newbuffer;

for (int i=start; i<length/2; i++)
{
truc[i].leftChannel = truc[length-i].leftChannel;
truc[i].rightChannel = truc[length-i].rightChannel;
}

return newbuffer;

}
//—————————————————————————

void * __fastcall CreateDsp()
{
dspUnit = FSOUND_DSP_Create(DspCallback, FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT, 0);
FSOUND_DSP_SetActive(dspUnit, true);

    return dspUnit;

}
//—————————————————————————

void __fastcall PlayDsp()
{
FSOUND_SetVolume(iChannel, 120);
CreateDsp();
FSOUND_PlaySoundEx(iChannel, dspSamp, dspUnit, false);
}
//—————————————————————————

That’s all!
When I call PlayDsp() function, it plays the wav without transformations.

Thanks for your help !!!

  • You must to post comments
0
0

Hi Brett,
that’s right, Sound Forge works in ofline process in this Process Menu,
but in the Effect Menu, you can check a box for Real-time or non real-time, and it works realy well. Like a chorus or reverb…
I found out it’s a good idea since in the future, I would like to include a lot of effects and presets.

How do you think Sound Forge do that in Real-Time.
Maybe I can do this with Fmod Ex which is for me a great, great audio engine for the possibility to include VST and DirectX plugin.
Congradulations !!!
And when had you the time to do all that in Fmod Ex?

Thanks for all !!!

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.