0
0

Hi all,

Platform – WinXP
FMOD – 3.75
Language: C++

I want to write an 10 band equalizer affecting all sounds played

The initialization:

The Init is done in a seperate class responsible for setting up the sound environment. I call it CSNDCard

Here is a code snippet:

[code:23y1zlyl]

define MIXRATE 44100

FSOUND_SetBufferSize(100);
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
FSOUND_SetSpeakerMode(FSOUND_SPEAKERMODE_STEREO);

if (!FSOUND_Init(MIXRATE , 32, FSOUND_INIT_GLOBALFOCUS | FSOUND_INIT_ENABLESYSTEMCHANNELFX))
throw InitException(FE_CODE_MSSInit, FE_MSG_MSSInit);

FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL,true);
nFXID = FSOUND_FX_Enable(FSOUND_SYSTEMCHANNEL,FSOUND_FX_PARAMEQ);

FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL,false);

[/code:23y1zlyl]

Sounds are played by use of CSound Class:

The Sample is loaded in that way:

[code:23y1zlyl]
pSoundSample = FSOUND_Sample_Load(FSOUND_FREE, pSoundData, FSOUND_LOADMEMORY|FSOUND_HW2D | FSOUND_ENABLEFX, 0, filesize);
[/code:23y1zlyl]

and here is the play method:

[code:23y1zlyl] nChannel = FSOUND_PlaySoundEx(FSOUND_FREE, pSoundSample, NULL, true);

FSOUND_SetPaused(nChannel, false);
[/code:23y1zlyl]

Whenever I modify the equalizer setting I do like following:
[code:23y1zlyl]#define MIN_LIMIT_GAIN -15

define MAX_LIMIT_GAIN 15

void CBASESound::SetEqualizer(int nCenterFrq, int nBandWidth, int nGain)
{

if (nGain < MIN_LIMIT_GAIN)
nGain = MIN_LIMIT_GAIN;

if (nGain > MAX_LIMIT_GAIN)
nGain = MAX_LIMIT_GAIN;

if (nCenterFrq>MIXRATE/3)
nCenterFrq=MIXRATE/3;

FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL, true);
bool eqresult = (bool)FSOUND_FX_SetParamEQ(nFXID,nCenterFrq, nBandWidth, nGain);
FSOUND_SetPaused(FSOUND_SYSTEMCHANNEL, false);
}
[/code:23y1zlyl]

and now (finally) my question:

When I load the sound with (FSOUND_HW2D) no equalizer FX are working
and when I load it with FSOUND_NORMAL the equalizer is working but there is a latency when starting the sound. That means that it takes approx 1sec from starting the sound until I hear it.

Any help is greatly appreciated…

  • You must to post comments
0
0

Parameq is available on DX 8 or later. It doesn’t work well on slow machines. Even a single parameq instance almost doubles cpu usage on my PIII. I think it computes an FFT and IFFT for every instance. That’s not good at all.

  • You must to post comments
0
0

[quote="Quantum":1jclbtlk]Parameq is available on DX 8 or later. It doesn’t work well on slow machines. Even a single parameq instance almost doubles cpu usage on my PIII. I think it computes an FFT and IFFT for every instance. That’s not good at all.[/quote:1jclbtlk]
The target platform runs on Pentium M/1 GHz. You think I should forget that equalizer?

  • You must to post comments
0
0

[quote="bommel":3v1qoa7f]The target platform runs on Pentium M/1 GHz. You think I should forget that equalizer?[/quote:3v1qoa7f]
There are some other cons in using that equalizer:
Lowest center frequency is just 80Hz. That’s not enough for some applications.
Setting gain to 0 (default) attenuates the signal. It shouldn’t but it does.
The only pro is it’s availability (for free) on DX8.

Finally, to answer your question, if it’s too slow on the target platform, try optimizing your DirectSound output. There’s a very nice (a bit out of date) paper by Peter Clare: h**p://www.sensaura.com/whitepapers/pdfs/devpc014.pdf

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.