Hi,
I am a Delphi user. I want to send different sounds to the speakers of the same or different sound cards installed in the computer, but I was not successful. I would like to point out that I am very new to this business.
I've been dealing with database applications before, but I'm very new to hardware management.
I am sharing my sample codes below. I would be very grateful if you could guide me.
Best Regards
unit unitMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxStatusBar, bass, cxContainer, cxEdit,
Vcl.Menus,
Vcl.StdCtrls, cxButtons, cxTextEdit;
type
TForm1 = class(TForm)
dxStatusBar1: TdxStatusBar;
cxTextEdit1: TcxTextEdit;
btnPlay1: TcxButton;
btnStop1: TcxButton;
btnStop2: TcxButton;
btnPlay2: TcxButton;
cxTextEdit2: TcxTextEdit;
procedure FormCreate(Sender: TObject);
procedure btnPlay1Click(Sender: TObject);
procedure btnStop1Click(Sender: TObject);
procedure btnPlay2Click(Sender: TObject);
procedure btnStop2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
FChannel1: HSTREAM;
FChannel2: HSTREAM;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnPlay1Click(Sender: TObject);
begin
FChannel1 := BASS_StreamCreateFile(False, PChar(cxTextEdit1.Text), 0, 0, BASS_SPEAKER_REAR2RIGHT); //FRONT, REAR, CENLFE, SIDE, LEFT, RIGHT ETC.
BASS_ChannelPlay(FChannel1, False);
end;
procedure TForm1.btnStop1Click(Sender: TObject);
begin
BASS_ChannelStop(FChannel1);
BASS_StreamFree(FChannel1);
end;
procedure TForm1.btnStop2Click(Sender: TObject);
begin
BASS_ChannelStop(FChannel2);
BASS_StreamFree(FChannel2);
end;
procedure TForm1.btnPlay2Click(Sender: TObject);
begin
FChannel2 := BASS_StreamCreateFile(False, PChar(cxTextEdit2.Text), 0, 0, BASS_UNICODE); //only BASS_UNICODE works. but it's also stereo. I want to send separate sound for each speaker in mono.
BASS_ChannelPlay(FChannel2, False);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BASS_Init(-1, 44100, 0, 0, NIL);
end;
end.