Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@MagicMau
Copy link
Contributor

@MagicMau MagicMau commented Nov 3, 2017

Hi,

I am using the SilenceProvider to keep my mixer running and noticed it's using a for-loop to zero out the buffer. I replaced it with Array.Clear() as it is much faster (https://msdn.microsoft.com/en-us/library/system.array.clear%28v=vs.110%29.aspx).
Might be of use to others as well?

Replace the for loop in Read() by Array.Clear() for a faster implementation to zero out the buffer.
@markheath
Copy link
Contributor

thanks for this. there are a few nasty gotchas around using Array.Clear() with the WaveBuffer class but in this case we are safe as it is operating on a byte[] not float[].

@markheath markheath merged commit a239f9f into naudio:master Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants