Saturday, 15 February 2014

c# - Threadsafe read from a stream -


How to read from a stream - without using heavy buffestream Locks ? I am reading audio data from the file using the NAudio because the NAudio stream read is locked on the methods, I have the BufferedStream < / Code> is used as a cover I need to read the data However, I lost thread - security Unfortunately, I can not read data in large blocks, because the interface I use is Float GetSample (long) at only 1 sample at a time The Dhti.

I have not used that library anytime, but if I understand you correctly, then your disk file is locked. Because you have to read it, so no other application can read it, is this correct?

In this case, this is not your app that is multi-threaded, and you should not need the locks within your app. You have to make sure that the file has been opened for reading only, which allows read-only access to other applications.

If a file opens the full set of NAudio parameters when you open it, you will be able to open the file with permission to share, otherwise if a stream can be passed to read the NAudio, You will be able to open the file, and then pass the stream to NAudio.


No comments:

Post a Comment