Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: Asio Sample type returns wrong value

$
0
0
Hi mark,

I used your code from the NAudio Demo. This is the AudioAvailable Function:
void asioOut_AudioAvailable(object sender, AsioAudioAvailableEventArgs e)
                {
                    // audio output is dumped to wav file
                    // output format is ALWAYS 32Bit float, convert with sox if required
                    var samples = e.GetAsInterleavedSamples();
                  
                    wavWriter.WriteSamples(samples, 0, samples.Length);
                
                    sampleType = e.AsioSampleType ;
                    //Console.WriteLine((int)sampleType);
                }
The Wav-Writer is initialized with fixed settings, maybe that's the trick?!
this.wavWriter = new WaveFileWriter(wavPath, new WaveFormat(sampleFrq, channels));
And when hitting the "Stop"button:
private void Stop()
        {
            this.asioOut.Stop();
            //this.asioOut.Pause();
            if (this.wavWriter != null)
            {
                this.asioOut.AudioAvailable -= asioOut_AudioAvailable;
                this.wavWriter.Flush();//test
                this.wavWriter.Close();//test
                this.wavWriter.Dispose();
                this.wavWriter = null;
            }
            this.recStateTimer.Enabled = false;
            CleanUp();
            gbDevice.Enabled= true;
            SetButtonStates();
        }
Cheers
Jan

Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>