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

New Post: AudioFileReader position property always returns zero

$
0
0

The problem seems to be threading related.  I'm running NAudio out of a console app (it will ultimately be a service) and I use a .NET timer to periodically check the value of the AudioFileReader Position attribute.  As a test, I read the Position attribute one second after I invoked the Play method (by putting the thread to sleep).  I was able to get a correct value for Position.  It appears that the .NET timers run the "Elapsed" event on a separate thread and is subsequently not providing the correct value for Position or CurrentTime. 

The demo apps appear to use the Windows Forms timers which execute their "Tick" method on the same thread as the GUI, so they are working correctly.  Does anyone have any thoughts on how to make this work? 

 

Regards,

-John

 


Viewing all articles
Browse latest Browse all 5831

Trending Articles



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