Hi, friends, hello everyone.
I am using bass.dll in Delphi and want to switch sound cards through the Tcombox dropdown method.
But it's useless for me to use the following code. I have tried using bass_ It is possible to directly initialize init to the specified device ID.
But this is clearly not elegant enough.
At the same time, I have also looked at a similar issue recently and tried to solve it according to that, but it still hasn't improved.
I saw Mutil's DEMO in the demo and it worked normally. That DEMO is more similar to VC style message programming,
So I want to ask, if there are multiple sound cards on a computer, I want to play different content on different devices simultaneously,
Is it necessary to use message based programming, or is it possible to use single threading, but is my code incorrect?
function TBass.test(DeviceIndex: Integer; ssFileName: string): Boolean;
var
hs: HSTREAM;
begin
BASS_StreamFree(hs);
BASS_SetDevice(DeviceIndex);
hs := BASS_StreamCreateFile(False, PAnsiChar(Ansistring(ssFileName)), 0, 0, 0);
if not BASS_ChannelPlay(hs, False) then
begin
result := False;
end
else
begin
result := true;
end;
end;