Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SilenceWaveProvider.cs #257

Merged
merged 1 commit into from
Nov 3, 2017
Merged

Update SilenceWaveProvider.cs #257

merged 1 commit into from
Nov 3, 2017

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