|
Hi Mark again,
I have implemented my won BufferedWaveProvider as you said, and it was successfully worked. First of all thank you for your advice.
I want to ask another question.
I have multiple analog inputs and I have to sum all of these inputs to route the sum to other waveOut devices.
I have created a list of bufferedwaveProviders that each element is serving for each wave input (recording). ( I have to have an ability to return back to n seconds in any time, so I have used bufferedWaveprovider with some editing)
Now I can route one waveIn analog device to waveOut analog device with the help of this bufferredWaveProvider.
And for summing the audios I have coded like the one below.
private void SumProviders(int length)
{
byte[] last = new byte[length];
byte[] temp = new byte[length];
int bytesPerSample = 4;
for (int index = 0; index < bufferedWaveInProviders.Count; index++)
{
//read wave providers one by one
bufferedWaveInProviders[index].Read(temp, 0, length);
//add all...
for (int i = 0; i < length / bytesPerSample; i++)
{
float sampleTemp = BitConverter.ToSingle(temp, i * bytesPerSample);
float sampleLast = BitConverter.ToSingle(last, i * bytesPerSample);
sampleLast = sampleLast + sampleTemp;
byte[] bytes = BitConverter.GetBytes(sampleLast);
Array.Copy(bytes, 0, last, i * bytesPerSample, bytesPerSample);
}
}
bufferedWaveForPlaying.AddSamples(last, 0, length);
}
I am calling this function on sourceStream_DataAvailable event handler of my waveIn devices for each input.
Here bufferedWaveForPlaying is the buffer that I have initilized my waveOut device with.
Now I am hearing the mixed audio, but playing speed is too slow? What can be the problem?
|