s23697 / practicesharp

Automatically exported from code.google.com/p/practicesharp
0 stars 0 forks source link

NAudio WaveOutEvent never goes to Stopped state when playing FLAC files using FLACFileReader #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run attached program, using a few .mp3, .wav and .flac files in playlist.

What is the expected output? What do you see instead?
When playing wav and mp3 files the player enters Stopped state and playback 
continues to the next track.
When playing flac file it never ends, always playing the last buffer.
Flac files should behave the same as mp3 and wav files.

What version of the product are you using? On what operating system?
Version 1.6.4 and commit 349 from the subversion repository.
Windows 7 64bit.

Please provide any additional information below.
The method DoPlayback in NAudio WaveOutEvent class calls buffer.OnDone. OnDone 
calls Read on the wavestream and expects it to return 0 on the end of stream. 
Method Read in FlacFileReader always returns numBytes passed in parameter of 
the method.

Read should check the state of FLAC decoder and return a value of 
flacBytesCopied instead of numBytes. 

LibFLACSharp needs two more imports: FLAC__stream_decoder_get_state and 
StreamDecoderState (see attached file)

Also, a quick fix for the Read method is in the attachment.

    Cheers, 
    Tom

Original issue reported on code.google.com by tomislav...@gmail.com on 4 Jun 2013 at 8:40

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Tom,
Thanks for the detailed description and fix!
I'll test it, and incorporate it to the next build.
Yuval

Original comment by yuva...@gmail.com on 10 Jun 2013 at 2:29

GoogleCodeExporter commented 9 years ago

Original comment by yuva...@gmail.com on 10 Jun 2013 at 3:03

GoogleCodeExporter commented 9 years ago
Merged code provided tomislavtustonic, tested, and committed

Original comment by yuva...@gmail.com on 10 Jun 2013 at 3:04