summaryrefslogtreecommitdiff
path: root/plugins/mRadio/i_bass.inc
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mRadio/i_bass.inc')
-rw-r--r--plugins/mRadio/i_bass.inc40
1 files changed, 36 insertions, 4 deletions
diff --git a/plugins/mRadio/i_bass.inc b/plugins/mRadio/i_bass.inc
index e52d7f377a..b4df5cfc39 100644
--- a/plugins/mRadio/i_bass.inc
+++ b/plugins/mRadio/i_bass.inc
@@ -210,6 +210,29 @@ begin
MyStopBASS;
end;
+function GetDeviceNumber:integer;
+var
+ i:integer;
+ info:BASS_DEVICEINFO;
+begin
+ // default device
+ result:=-1;
+ i:=1;
+ repeat
+ if not BASS_GetDeviceInfo(i,info) then
+ break;
+ if (info.flags and BASS_DEVICE_ENABLED)<>0 then
+ if StrCmp(info.name,usedevice)=0 then
+ begin
+ // not default device
+ if (info.flags and BASS_DEVICE_DEFAULT)=0 then
+ result:=i;
+ break;
+ end;
+ inc(i);
+ until false;
+end;
+
function MyInitBASS:int;
var
fd:TWin32FindDataW;
@@ -218,6 +241,7 @@ var
// buf1:array [0..31] of WideChar;
pc:PWideChar;
p:Bool;
+ num:integer;
begin
if Inited then
begin
@@ -227,11 +251,19 @@ begin
Inited:=true;
BASS_Free;
- p:=BASS_Init(-1,44100,BASS_DEVICE_3D,0,nil);
- if not p then
- p:=BASS_Init(-1,44100,0,0,nil);
+
+ num:=GetDeviceNumber;
+ p:=BASS_Init(num,44100,BASS_DEVICE_3D,0,nil);
if not p then
- p:=BASS_Init(1,44100,0,0,nil);
+ p:=BASS_Init(num,44100,0,0,nil);
+ // not default device choosed - check default now
+ if (not p) and (num>=0) then
+ begin
+ p:=BASS_Init(-1,44100,BASS_DEVICE_3D,0,nil);
+ if not p then
+ p:=BASS_Init(-1,44100,0,0,nil);
+ end;
+
if not p then
begin
ErrorCustom('Can''t initialize device');