filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.14k stars 450 forks source link

Pitch effect bug - after sometimes generate muted audio #455

Closed victorvhpg closed 2 years ago

victorvhpg commented 3 years ago

The audio stay "mute" after sometime using effect Pitch with differents sources many times.

https://github.com/filoe/cscore/blob/13bbebb4f0a8c3e12fc54a01c3485098bf13ba9c/CSCore/DSP/PitchShifterInternal.cs

victorvhpg commented 2 years ago

My application run in many threads, there are concurrent access to pitch effect, And that class (PitchShifterInternal) uses static Fields

https://github.com/filoe/cscore/blob/13bbebb4f0a8c3e12fc54a01c3485098bf13ba9c/CSCore/DSP/PitchShifterInternal.cs

At sometime a thread change the value of a Field that is shared in ALL threads, then occurs the bug.

@filoe To solve this bug, dont use static fields in PitchShifterInternal (field: _gRover)

filoe commented 2 years ago

Thanks for reporting! Can you submit a pull request?

victorvhpg commented 2 years ago

Thanks for reporting! Can you submit a pull request?

ok, 54e4008

victorvhpg commented 2 years ago

@filoe
please merge theses changes too #458 https://github.com/filoe/cscore/pull/458