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

New Post: NAudio eating memory

$
0
0

I am using NAudio to play Mp3 files in my .NET 4 app. First of all I initialize WaveOut:

 

IWavePlayer^ waveOutDevice = gcnew WaveOut();

 

Then I have 2 buttons. Play button :(code)

 

volumeStream = gcnew WaveChannel32(gcnew Mp3FileReader(gcnew IO::FileStream(path, IO::FileMode::Open, IO::FileAccess::Read, IO::FileShare::ReadWrite)));
mainOutputStream = volumeStream;
waveOutDevice->Init(mainOutputStream);
waveOutDevice->Play();

It loads MP3 form FileStream and plays it. 2nd button is Stop :(code)

 

waveOutDevice->Stop();

t just stops playing.

When I start my app it eats 5.344 KB. But when i hit 2 buttons (Play then Stop) (imagine i'm playing different MP3's) about 10 times app eats 14.912 KB!

And I don't know how to release this memory. To play MP3 I am using these NAudio objects:

 

IWavePlayer^ waveOutDevice;
WaveStream^ mainOutputStream;
WaveChannel32^ volumeStream;

Viewing all articles
Browse latest Browse all 5831


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