[WaveAudio] 2 soundcards

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

[WaveAudio] 2 soundcards

Hi there,

I am working on an application that can record 2 different audiostreams to two different wave-files. Therefore i have installed 2 audio cards and i am using the component WaveAudio Version 1.52.

I have assigned AudioMixer0 to MixerId=0 and the second AudioMixer1 to MixerId=1 in the code, since one cannot set those at runtime. Besides those 2 components i am using WaveStorage (twice) and the StockAudioRecorder (twice). I have connected the WaveStorage and the StockAudioRecorder to eachother, but i cannot connect one of those components to a Mixer. This is where it goes wrong in my opinion, because i get an error as soon as i try to record the second audiostream. "Device is busy or something like that".

So, is there a workaround for this or am I doing something wrong?
It's nice to be important, but it is more important to be nice
jhakroeze
Member

Posts: 2
Joined: June 5th, 2004, 1:14 pm
Location: Renkum, Netherlands

Hi,

You have to use DeviceID property of the component to select the proper device on one of the mixers. Unfortunately, there's no straight way to find DeviceID's of a mixer. However, using the similarity between name of the Mixer and name of the Device you can find the right Device.

The following code lists the available input/output devices in two listboxes.

Code: Select all
uses  mmSystem;procedure TForm1.FormCreate(Sender: TObject);var  I: Integer;begin  // Lists the available input devices in the first ListBox  ListBox1.Items.Clear;  for I := Integer(WAVE_MAPPER) to AudioRecorder1.NumDevs - 1 do  begin    AudioRecorder1.DeviceID := I;    ListBox1.Items.Add(AudioRecorder1.DeviceName);  end;  // Lists the available output devices in the second ListBox  ListBox2.Items.Clear;  for I := Integer(WAVE_MAPPER) to AudioPlayer1.NumDevs - 1 do  begin    AudioPlayer1.DeviceID := I;    ListBox2.Items.Add(AudioPlayer1.DeviceName);  end;end;

By the way, the default value for DeviceID is WAVE_MAPPER (Microsoft Sound Mapper).

Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

It's working! Great, thanks for the quick response. I got confused with the MixerId. I did not look good enough in the documentation to see that there was a DeviceID as well.

Thanks again!
It's nice to be important, but it is more important to be nice
jhakroeze
Member

Posts: 2
Joined: June 5th, 2004, 1:14 pm
Location: Renkum, Netherlands

Re: [WaveAudio] 2 soundcards

but why this always make the sound as sterio mix and cant talk from microphone ?
drama22
Member

Posts: 3
Joined: June 21st, 2014, 8:08 pm

Re: [WaveAudio] 2 soundcards

drama22, it depends on your device's capabilities.
Kambiz

Kambiz