Finding the no of channels in a wav file

Hi, I am new to juce and trying to create an audio application which controls the routing of data from multiple input channels(multiple inp channels, input wav file) to multiple out channels(channels, storing in a wav file).

I am able to route inp channels to out channels. But I am facing problem with input wav files since the file may contain more than one channel stream. As of now, I am making a restriction on the input wav files(only mono wav files are allowed). So I have a question in this.


1) How to find the no. of channels in a wav file?? Any class to do that?? (I will check for inp files and if it contains more than one channel, I want to throw error)


Can someone please help me on this?? Thanks in advance!!!

You can do this with the AudioFormatReader class which has a numChannels member variable. To create the format reader use createReaderFor functions and call registerBasicFormats at the beginning of your app.

Hi Fabian,

Thanks a lot for the info. This makes my job very easy :)