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

How can I copy or clone SoundInSource instances? #464

Closed Lijnx closed 2 years ago

Lijnx commented 2 years ago

I am making a programm which applies different effects to the recording sound in real-time. And I need to split input signal by frequency ranges and apply effects to each of these groups with different intensity. Generally, I've already done this but, as I think, in a quite stupid way. So I have an WasapiCapture class and then I initialize SoundInSource instance. But if I try to apply, for example, bandpass filters to the source and then mix filtered sources with SimpleMixer, it plays only last frequency group that has been filtered. To solve this problem, I've just created more instances of SoundInSource class and apply only one bandpass filter to each of them. And it worked, but the more effects I do the more instances I create and I think it may slow my programm down. And also it's getting harder to work with the code. So, the question is what can I do to solve my problem without initializing more instances of SoundInSource? Can I clone or copy SoundInSource instances?

P.S. Im sorry for this probably silly question and my bad english