Multiple Sound-Cards (ones again)

Started by fredvs,

fredvs

Hello folks.
In a last thread, you expain us how to use more that one sound-card.

///////////////////////////////
If you mean using 2 soundcards with delphi then just make a copy of bass.dll
- rename it to ie bass2.dll then rename the bass.pas file to bass2.pas and
change all references to bass2.dll and all functions/procedures
from ie bass_streamplay to bass_streamplay2 and wolla it works.- simple or what?
/////////////////////////////////


(PS i think he will say :
from ie bass_streamplay to bass2_streamplay.)

Ok i did that but when i load bass2_init i receive a error message : "A link to bass2.dll, bass_init is missing."

Here folow one line of my bass2.pas, where is the problem ?

function bass2_Init(device: Integer; freq, flags: DWORD; win: HWND): BOOL; stdcall; external 'bass2.dll' name 'bass_Init';




WingZero

QuoteHere folow one line of my bass2.pas, where is the problem ?

function bass2_Init(device: Integer; freq, flags: DWORD; win: HWND): BOOL; stdcall; external 'bass2.dll' name 'bass_Init';


  That should be BASS_Init. Function names are case-sensitive.

fredvs

Hello and thanks a lot but then, what must i do ?

WingZero

On this line:

function bass2_Init(device: Integer; freq, flags: DWORD; win: HWND): BOOL; stdcall; external 'bass2.dll' name 'bass_Init';

You have to change name 'bass_Init' to name 'BASS_Init'.

fredvs

O my God... it is case sensitive...
Thanks a lot.

fredvs

Bravo, it works, i have just recompiled my program, it works...Tank youuuuuuuuuuuuuu.
Now i can be a real DJ, i a have monitoring.
Bass Still The Best.

fredvs

One litle question more...
Ok i can play 2 soundcards, but whow will i know a much cards are installed ?
Perhaps first load bass_init, then see if more that 1 sound cards, then load bass2_init, bass2_init,... depend how much sound-cards find by the first bass_init ?


FormulaV8

Use api to find out how many devices they have.

Private Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long


It will return the number of mixer devices available.


    Jason

fredvs

Thanks and then, BASS dont give the sames devices... ????

Ian @ un4seen

See the BASS_GetDeviceDescription docs for how to get the number of devices present. And, if you wish, subtract 1 (for the "Primary Sound Driver") to get the real number (but then add 1 when you call BASS_Init).

fredvs

#10
>:( Yes i know that, the problem is DirectX, BASS give me DirectX for device 1, all the other liB that i use do not consider DirectX for a device :-/   >:( >:(

Ian @ un4seen

BASS simply returns what the drivers say the device is called. If you're adding the device names to a listbox, make sure you have not got sorting enabled. See the 3DTEST example for what the device list should look like.

fredvs

#12
Hello Ian, i think you think im stupid. Perhaps it is true, or perhaps you dont understand what i want (or Both).
I have learn that a device is hardware.
I use Amixer, a very good Delphi component and others audio liB.

I have 2 soundcards installed, all other liB say that, i have only 2 devices (for me it is logic), device 0 and device 1. Bass find 3 devices : device 0, device 1 (directx), device 2. Then to use the second card, i must say device 2 in Bass init. If i put device 1 (like all other liBs) in Bass init, the second card dont play. (logic for Bass). Why Bass consider directx as a device.????? :o


Ian @ un4seen

See this thread...
http://un4seen.com/YaBB.cgi?board=bass&action=display&num=1026119772#1

Device 0 is the same thing as device -1, which is "Primary Sound Driver". So, device 1 is the 1st real device, device 2 is the 2nd, etc... You can just discard device 0 from your list if you really want to.

fredvs

#14
OK, ;) i will do that : forget device 0, (and i will understand that DirectX device 1 ??? later...)

Chris

#15
try this

procedure TForm1.FormActivate(Sender: TObject);
var
  c: Integer;
  str: string;
  name: PChar;
begin
 c := 0;
  while (BASS_GetDeviceDescription(c) <> nil) do
  begin
    name := BASS_GetDeviceDescription(c);
    str := name;
    if BASS_Init(c, 44100, BASS_DEVICE_3D or BASS_DEVICE_NOTHREAD, Application.handle) then
    begin
      BASS_Free;
      Combobox1.Items.Add(str);
    end;
    c := c + 1;
    end;
    combobox1.Items.Delete(0);
    combobox1.ItemIndex := 0;
end;

So now you dont see the Default Device
to access the soundcard   Combobox1.Itemindex +1

Greets Chris

fredvs

#16
Thanks Chris, i understand now  :idea:

BASS_DEVICE_3D or BASS_DEVICE_NOTHREAD, means that BASS consider DirectX for a virtual device...  :-*

I will well sleep this night...