multi channel

Mar 12, 2011 at 7:59 PM

Excellent project! Thank you. I try to play quad sound. The sound cart is supports up to 8 channels. The problem is when I create waveprovider with 4 channels WaveOut.Init generates exeption "WaveBadFormat calling waveOutOpen". 2 channels are OK. Does the NAudio support any number of channels or there is a limitation?

Coordinator
Mar 14, 2011 at 10:56 AM

it probably depends on your sound card driver. it might not support multi-channel output using WaveOut (or you might need to open multiple WaveOut devices). How about trying DirectSound or WASAPI. In an ideal world I would say ASIO, but unfortunately the ASIO support in NAudio is unreliable at the moment.

Mark

Mar 14, 2011 at 6:10 PM

I suspected a driver, but as I see now the root of the problem is WaveFormat. In accordance with msdn it is able to play only mono or stereo. To play more channels it has to be WaveFormatExtensible then you are able to define more then two channels different bit resolution etc. I am afraid it is impossible to define the structure within c#.

typedef struct {
  WAVEFORMATEX  Format;
  union {
    WORD  wValidBitsPerSample;
    WORD  wSamplesPerBlock;
    WORD  wReserved;
  } Samples;
  DWORD   dwChannelMask; 
  GUID    SubFormat;
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;

I will try as well ASIO.