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

New Post: Error when play/stop recording

$
0
0

Hi Mark,
I have a problem with start/stop playing recording.
I have to play a sample which have to be recorded to disk every time it is played because it could be set with different volume level. I do the following:
Play recording:

recorder = new WaveRecorder(file, recordingFileName);
playbackDevice.Init(recorder);
playbackDevice.Play();

Stop playing:
playbackDevice.Stop();

The problem is that if the user press start/stop several times in a hurry. the following error occurred:
NAudio.MmException: AlreadyAllocated calling waveOutOpen

I know that I must avoid Init() waveOut every time I play but I have to do the recording every time because I need it for later use.
How can I properly release these objects when stop playing?


Viewing all articles
Browse latest Browse all 5831

Trending Articles



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