This project has moved. For the latest updates, please go here.

Streaming WaveMixerStream32 instead of microphone input

Mar 28, 2014 at 10:43 AM
Edited Mar 28, 2014 at 10:46 AM
I'm trying to stream a WaveMixerStream32 output over the network. I started first by testing the stream by using WasapiCapture. This works fine
_wasapiIn = new WasapiCapture(selectedDevice);
_wasapiIn.DataAvailable += Capture_DataAvailable;
_wasapiIn.StartRecording();
private void Capture_DataAvailable(object sender, WaveInEventArgs e)
{
    var inputStream = new MemoryStream();
    inputStream.Write(e.Buffer, 0, e.BytesRecorded);

    var inputStreamFormat = new WaveFormat(_wasapiIn.WaveFormat.SampleRate, 16, _wasapiIn.WaveFormat.Channels);
    using (var inputWaveStream = new RawSourceWaveStream(inputStream, inputStreamFormat))
    {
        var outputStreamFormat = new WaveFormat(_clockRate, 16, _channels);
        using (var outputStream = new WaveFormatConversionStream(outputStreamFormat, inputWaveStream))
        {
            var output = new byte[outputStream.Length];
            outputStream.Read(output, 0, (int)outputStream.Length);
            Send(new AudioBuffer(output, 0, (int)outputStream.Length));
        }
    }
}
But now I want to use a WaveStream/WaveMixerStream32 instead. How can I send such stream just as if it was comming from a capture device?
Apr 2, 2014 at 11:58 AM
Edited Apr 2, 2014 at 11:58 AM
No one who can give me a hint into the right direction? I just need to know how to make this work with a WaveStream/WaveMixerStream32 as it contains the whole audio stream instead of smaller packets. Is there a way of packetizing the audiostream into smaller chunks? How to choose the right chunk size?