From c4e2e2cfa438205154e7a074e46bd0fb267bb35d Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Sat, 5 Apr 2014 17:52:11 +0000 Subject: mRadio "Quick Open" added git-svn-id: http://svn.miranda-ng.org/main/trunk@8863 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/mRadio/rbass.pas | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'plugins/mRadio/rbass.pas') diff --git a/plugins/mRadio/rbass.pas b/plugins/mRadio/rbass.pas index 77957f4a46..ebdb33f913 100644 --- a/plugins/mRadio/rbass.pas +++ b/plugins/mRadio/rbass.pas @@ -10,6 +10,7 @@ procedure BassError(text:PWideChar); procedure OpenURL(url:PWideChar); cdecl; procedure StopStation; function GetMusicFormat:PAnsiChar; +function ConstructFilter:pointer; procedure EQ_ON; procedure EQ_OFF; @@ -1115,4 +1116,71 @@ begin end; end; +function MakeFilter(dst,descr,full,filter:PWideChar;show:bool=true):pWideChar; +var + p:PWideChar; +begin + if full<>nil then + begin + p:=StrEndW(full); + p^:=';'; + StrCopyW(p+1,filter); + end; + + dst:=StrCopyEW(dst,TranslateW(descr)); + if show then + begin + dst^ :=' '; + (dst+1)^:='('; + dst:=StrCopyEW(dst+2,filter); + dst^:=')'; + inc(dst); + dst^:=#0; + end; + inc(dst); + result:=StrCopyEW(dst,filter)+1; +end; + +function ConstructFilter:pointer; +var + pc:pWideChar; + ph:PDWord; + Info:PBASS_PLUGININFO; + i:integer; + full:array [0..511] of WideChar; + tmpbuf1,tmpbuf2:array [0..127] of WideChar; +begin + mGetMem(pc,4096); +// FillChar(pc^,4096,0); + result:=pc; + full[0]:=#0; + pc:=MakeFilter(pc,'All files' ,nil ,'*.*',false); + pc:=MakeFilter(pc,'Playlist files',full,'*.pls;*.m3u;*.m3u8;*.asx'); + pc:=MakeFilter(pc,'BASS built-in' ,full,'*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif'); + + if BassStatus=rbs_null then + MyLoadBass; + + if BassStatus<>rbs_null then + begin + ph:=pointer(BASS_PluginGetInfo(0)); + if ph<>nil then + begin + while ph^<>0 do + begin + Info:=BASS_PluginGetInfo(ph^); + for i:=0 to Info^.formatc-1 do + //!! need to translate Ansi -> wide + with Info^.Formats[i] do + begin + pc:=MakeFilter(pc,FastAnsiToWideBuf(name,tmpbuf1),full,FastAnsiToWideBuf(exts,tmpbuf2)); + end; + inc(ph); + end; + end; + end; + pc:=MakeFilter(pc,'All supported formats',nil,full,false); + pc^:=#0; +end; + end. -- cgit v1.2.3