diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-10 20:02:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-10 20:02:14 +0000 |
commit | bd7fe0980cf5974c432b789323a3fe2f68a107d3 (patch) | |
tree | 907609038c666de3c2ef59f18f2b036e0781ea4e /plugins/mRadio/i_bass.inc | |
parent | 503d82db45bf24f4739d126d43bfbeee4828a882 (diff) |
mRadio merge
git-svn-id: http://svn.miranda-ng.org/main/trunk@3965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/mRadio/i_bass.inc')
-rw-r--r-- | plugins/mRadio/i_bass.inc | 40 |
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');
|