Buffers

Feb 23, 2010 at 1:32 AM
Edited Feb 23, 2010 at 6:33 AM

Hi, Im using the sinewaveoscillator and am wondering about the buffers. When you change amplitude will it finish the current buffer and then increase the next buffer or will it stop the current buffer and increase it in realtime?

What is SampleAggregator?

Also I have this code to get the input level and display it on the volume meter. It works sort of, but not accurately and repeatablly. I cannot get a consistent lvl reading. I have the input looped to the output and a sinewave playing from the sinewaveoscillator. When I stop the sinewaveoscillator and restart it, it will be a completely different reading. Its never consistent.

public float sample32;    .....
 
waveInStream.DataAvailable += waveIn_DataAvailable;   .....



void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
            label11.Text = (sample32.ToString());   //to see the actuall float value
            volumeMeter1.Amplitude = sample32;
            for (int index = 0; index < e.BytesRecorded; index += 2)
            {
                short sample = (short)((e.Buffer[index + 1] << 8) | e.Buffer[index + 0]);
                float sample32 = sample / 32768f;  
            }
            
        }


Thanks for any input in advance,
John