Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: Playing Short Audio Files [16377]

$
0
0
I'm writing a game and I'd like to use NAudio to add sound to it. I followed a few examples and was rather pleased with NAudio's API and performance.

I ran into the following issue: NAudio will not play short audio files. I've used WaveChannel32.Length to get the following numbers.
Files with length 755712 or less will not play.
Files with length 5935104 do play.
I'm not sure where the exact limit is. There are no exceptions thrown. I was hoping to use NAudio to play files of about 1 second long. Is anyone else having this issue? Is there a fix? Do I need to find a different library?
Comments: It may be that you are running out of input data. If Read ever returns 0 then the playback automatically ends. One thing that I didn't get round to adding to MixingSampleProvider was an automatic way to ensure Read always returns the number of samples requested. I've checked in a new property (ReadFully) that you can set to true to do this. Or you can have create a trivial SilenceSampleProvider which is a mixer input that always returns 0s, and then playback will never end until you explicitly request it to.

Viewing all articles
Browse latest Browse all 738

Trending Articles



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