Answer the question
In order to leave comments, you need to log in
How to simultaneously play (N)BufferedWaveProvider and control volume level for each in NAudio?
(N) - the number of providers, supposedly no more than 20.
The situation is as follows, I have (N) BufferedWaveProvider.
In these providers, I write the bytes received over the network.
I need to somehow start playing them, and also control the volume level for each BufferedWaveProvider.
Tried each BufferedWaveProvider to allocate its own WaveOut, but this way the sound is controlled for the entire application, and not for a specific provider in particular.
I have no idea how this can be checked.
Answer the question
In order to leave comments, you need to log in
Resolved the issue.
Just threw the received bytes into a function.
private unsafe void VolumeSetter(byte[] destBuffer, int bytesRead, short loudnessDivider)
{
fixed (byte* pDestBuffer = &destBuffer[0])
{
short* pfDestBuffer = (short*)pDestBuffer;
int samplesRead = bytesRead / 2;
for (int n = 0; n < samplesRead; n++)
{
pfDestBuffer[n] /= loudnessDivider;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question