问题
I have a WaveStream, and I can read WaveFormat to obtain number of channels. When I read from that WaveStream am I reading the first channel or data from all the channels mixed?
I want to do a user control to display WaveForm, but I'm not sure if my control displays it properly.
回答1:
When you are reading from WaveStream, you are reading all channel samples, one by one. First you are reading the first channel, and the second sample is the first sample of the second channel.
If you put them in an array, then the first index is the first channel, the second index is the second channel, the third index is the third channel. So if you are displaying the left channel in your waveform, you should display indexes 0, 2, 4, and 6 and if you are displaying the right channel indexes 1, 3, 5, and 7 (if you have a stereo wave file of course).
来源:https://stackoverflow.com/questions/11408185/naudio-wavestream-and-multiple-channels