0
0

Hello,

whats my Problem:
I have wriitten a software synthesizer that uses a stream callback to generate samples. To play the synth sound I use

FSOUND_Stream_Play().

The thing is: I dont want to hear the sound, I want to make an fft-transformation and an inverse-fft. the dsp-nodes, so I set up SoundOutput with

FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND_NONREALTIME)

So I have to do the playing with

FSOUND_Update()

All performs correct but that routine I want to be done automatically with a lot of synth sounds sequentially.
But there is the problem: the used memory of my application increases every time FSOUND-Update() is called.

Where can I free the memory used, say, when one loop is finished and inverse-fft-dsp file is written to disk.

I want to have some kind of reset of the used memory, couse its there no longer used.

Please help me!!

Thanks a lot.

CHRIS

Heres a little code fragment, when there are other quests please post it!

stream = FSOUND_Stream_Create(streamcallback, 6*2048, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 44100, 1);

FSOUND_Stream_SetEndCallback(stream, endcallback, 0);


// DSP_resultsound_fft node creation and activating
fft_dsp2 = FSOUND_DSP_Create(&DSP_FFTCallback, 801, 2);
ifft_dsp2 = FSOUND_DSP_Create(&DSP_IFFTCallback, 810, 2);
FSOUND_DSP_SetActive(fft_dsp2, true);
FSOUND_DSP_SetActive(ifft_dsp2, true);


// play attack + decay
int channel;
channel = FSOUND_Stream_Play(FSOUND_FREE, stream);
if(channel != -1)
    {   
    do {
        FSOUND_Update();
        reorderFFT(1);
    } while(dcaEnv.getEnvPart() < 3 || dcfEnv.getEnvPart() < 3);
    }

// play sustain
sampleCounter = 0; // will be incremented in callback function, while stream is computed
long maxSamplesSustain = (long)(sustainLength * 44100);       
    //sustainLength = genome.gene(24)
while (sampleCounter <= maxSamplesSustain)
    {
    FSOUND_Update();
    reorderFFT(1);
    }

// end stream
dcaEnv.startRelease();
dcfEnv.startRelease(); 
do 
    {    
    FSOUND_Update();
    reorderFFT(1);
    } 
while(dcaEnv.getEnvPart() == 4 || dcfEnv.getEnvPart() == 4);

// DSP_resultsound_fft node disactivating and deletion
FSOUND_DSP_SetActive(fft_dsp2, false);
FSOUND_DSP_SetActive(ifft_dsp2, false);
FSOUND_DSP_Free(fft_dsp2);
FSOUND_DSP_Free(ifft_dsp2); 

FSOUND_Stream_Close(stream);
  • You must to post comments
0
0

have you tried FSOUND_SetMute() ?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.