hey folks,
i’m trying to build a simple audio program that takes the input from microphone and outputs it using soundstream classes, something like mixing AudioInputExample and AudioOutputExample (oF 0.062).
here’s the code:
void testApp::setup()
{
ofSoundStreamSetup(2,2,this, 44100, 512, 4);
left = new float[512];
right = new float[512];
}
void testApp::audioReceived (float * input, int bufferSize, int nChannels)
{
for (int i = 0; i < bufferSize; i++)
{
left[i] = input[i*2] ;
right[i] = input[(i*2)+1];
}
}
void testApp::audioRequested (float * output, int bufferSize, int nChannels)
{
for (int i = 0; i < bufferSize; i++)
{
output[i*2] = left[i] ;
output[(i*2)+1] = right[i];
}
}
my problem is that mixed with the mic’s output appears some strange noises (flickering?) that were not expected…
at first, i thought it could be something related to the buffer size or the sample rate, but even using lower sample rates (eg 22050) i get exactly the same thing…
another strange thing is that the same code works perfectly on oF 0.06, without any problem (in fact, it came out to me when i was trying to reuse some old code on the 0.062)…
any hint?
by the way, i’m using ubuntu 10.04 and codeblocks!
thanks in advance!