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

New Post: waveout get notification after elapsed time

$
0
0
Hi,

i am working on a project where i need to play an audiofile (mp3) and after a specific amount of time i need to trigger some kind of a signal. Therefore i wrote my own AudioFileReader.
    public class TimeElapsedAudioFileReader : AudioFileReader
    {
        public event Action<TimeSpan> Elapsed;

        public TimeElapsedAudioFileReader(string filename):base(filename)
        {
            
        }

        public override int Read(byte[] buffer, int offset, int count)
        {
            if (Elapsed != null)
                Elapsed(this.CurrentTime);
            return base.Read(buffer, offset, count);
        }
    }
The Problem with that approach is that it is not precise enough. I wanna have the elapsed Signal triggered after each millisecond for example, therefore i thought i have to set the buffersize that is read but i cant find anything to set the buffersize. Maybe I am wrong with my thoughts? Hope for help!

KR Manuel

Viewing all articles
Browse latest Browse all 5831

Trending Articles



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