Click to See Complete Forum and Search --> : Using 8 channel sound card through DirectSound


eckmul
January 13th, 2005, 06:41 AM
Hi,

I'm trying to use a sound card that have 8 channels, through DirectSound.
I have searched in the DirectSound API but I have not found how to select the channel with which I want to work.

Does anyone knows ?

Thanks

Gyannea
January 16th, 2005, 08:32 AM
How are these 8 channels formatted and are you talking about playback or recording? Direct Sound sets up buffers which are loaded to and read from the soundcard hardware. The standard 16-bit stereo data used by most CD quality music programs order the left and right channel one after the other, thus each stereo data 'element' is 32 bits.

Where do these 8 channels go or come from and how are they physically available as jacks on your soundcard? Though sounding stupid this is important because it might tell you something about what devices are available.

However, in the end, its the possible WAVEFORMATEX structures supported. It is in this structure the channels are specified, but I do not know of any agreed upon format that supports more than two channels.

Sound cards tha support multiple sets of stereo channels probably have multiple sets of primary hardware buffers each ahndled by their own DIrecrtSound object, but I am not sure. Maybe you have to look at the DirectSound3D stuff which has support for multiple systems for those soundcards that can handle it. But I have only used DirectSOund so I cna't help you. Try http://www.gamedev.net/community/forums/
It's mostly Direct X but there is some info about sound playback. Sound recording, however, is hard to find anywhere!

Brian

eckmul
January 17th, 2005, 01:59 AM
I don't understand what you mean about how the channels are formated, but I can answer to some of your questions.
First of all, I need to choose the channels for recording and playback.

The 8 channels are available as jacks of the sound card (thus 16 jacks for inputs and output), and there is 4 devices (one for two channels) to access to the inputs/outputs. I have made some tests, and recording for the channels 1, 3, 5 and 7 doesn't cause any problem. Now, my problem is "only" to access to the channels 2, 4, 6 and 8.

When I ask the device for its capabilities, it "answers" that it has 2 channels which could mean that it is stereo. However, I have read the hardware documentation of the soundcard, and it is specified that stereo is not supported, and I hope that if I can separate the two channels for recording, I will access to the second channel of the device.
At the moment, I can playback only on the first channel of the soundcard, but I guess that I have not chosen properly the device I want in my software...

I have looked at the structure WAVEFORMATEXTENSIBLE. It seems interesting for my problem as one of the parameter seems to permit to filter (is it english or franglais...) the channel you want. The point is that this structure is made for more than 2 channels, and I'm not sure it will solve my problem. Anyway, I'm going to try today...as it is the only thing I have found in the API which could be interesting.

Thanks a lot for your help.

Gyannea
January 17th, 2005, 06:46 AM
I think we have a confusion in our understanding of the term 'channels'. In DirectSound, the meaning of 'channels' is as mundane as one channel for mono sound and two channels for stereo sound, and for some fancy systems there may be more channels. But these 'channels' are output or input on a single 'line'. A 'line' would correspond to a jack in the soundcard. For example 'line in', 'line out', 'mic', 'aux', etc. Those are all 'lines'. I use the terminology 'lines' because that is what is used in the WIndows mixer API. DirectSound, as far as I know has no control over the mixer. That is understandable as the mixer sets up what lines goes to from what sources and destinations, and there is no need for fast access. You do it once and then you do you sound analysis (which needs fast hardware access).

I am not too familiar with the mixer API but soon I am going to have to deal with it to make sure that my program records from the correct input source and plays back to the correct output. Occassionally I will need to switch to make the input go from 'line in' to 'mic'. But that is all mixer stuff and not DirectSound. The standard windows colume control is a good example of the mixer interface. My sound card (a soundblaster live) has its own mixer program and it has several lines from which I can choose. One line has only one channel (the mic input) but all the others have two channels.

If that is the case for you, what you need to look at is the mixer API in order to set up (and identify) all the lines, sources, and destinations available on your soundcard and each of the line properties. You can have the lines go from multiple sources to a single destination and vice versa and everything in beween. Its up to you. Once you have the lines going to the right place (recording from the correct source(s), playing back to the correct destination(s)) then you use direct sound to actually handle the incoming or outgoing sound data. That sound data may have one or more channels, but the information on those channels will bear no resemblence to what is coming in from or going out of individual sources and destinations.

In my case I am writing a controller for digitally coded signals over radio, so all my sound output is synthesized by the controller and is that which is transmitted, and the recorded sound is that received from the radio.

Brian

mmscg
January 17th, 2005, 11:41 AM
The WAVEFORMATEXTENSIBLE structure allows for playback and/or recording of multi-channel sound without the use of DirectSound.

The "multi-channel effect" will be evident even on a standard "stereo" soundcard.

eckmul
January 22nd, 2005, 04:18 AM
I have taken a look at the mixer API, and it will solve my problem I think, but I can't try for the moment.
Thanks for your explanations about lines and channels. I'm a beginner in sound management, and it's a little confused in my mind....

Gyannea
January 22nd, 2005, 05:03 AM
I have not used the API either, and it doesn't look too easy. But I also need to do it to make sure that everything is organized in the right manner!

eckmul
January 22nd, 2005, 09:03 AM
You can make sure that I will send information to you as soon as I have some.

Gyannea
January 24th, 2005, 08:53 AM
I got a C++ example of a project using the mixer API at the Code Project site. Its at www.codeproject.com

If I knew how to attach the zip file I would send it directly to you as I have already downloaded it. It's called 'msmixer.zip' and its an imporived and commented version of the version provided by microsoft which I guess is pretty hard to make sense of.

Its a good start in any case. I also found an excellent description of how the mixer works on the web and I copied the stuff to a word document. It has all that junk about Lines, SOurces, Destinations, etc. Don't remeber where I got it but it might also be the code project.

eckmul
March 1st, 2005, 08:10 AM
Finally, my manager has decided not to use this solution, I cannot thus provide you more information on this API.

Nevertheless, it appears that my 8 lines sound card is in fact an 4*2 lines. Each line is mono; to obtain stereo, you must plug on two lines ...

I have used this API only for control volume, and for this point, it's not very difficult ... If you want, I can provide what I have done to you...

I had also started a little sample to understand the management of lines; I have succeed in listing all the lines managed by one of my device, but I have stopped since my manager didn't want to continue.