// Läd ein Winamp DSP Plugin und übergibt das handle
// Koordinaten und ein User Callback können übergeben werden
function BASS_WADSP_Load(
const dspfile: PChar; x, y, Width, Height: integer;
proc: WINAMPWINPROC): HDSP;
stdcall;
var
winampDsp: WINAMPPLUGINPROPDSP;
cnt: integer;
begin
winampDsp := AllocMem(sizeof(WINAMPPLUGINPROPDSP));
FillChar(winampDsp, 0, sizeof(winampDsp));
Saved8087CW := Default8087CW;
//FPU - Exceptions deaktivieren
Set8087CW($133f);
// Library laden
// zuerst mit unicode versuchen
winampDsp^.hDll := LoadLibraryW(PWideChar(dspfile));
if (
not winampDsp^.hDll) <> 0
then
begin
// ansonsten Ansi
winampDsp^.hDll := LoadLibrary(dspfile);
end;
// Exceptions zurück auf Defaultwert
Set8087CW(Saved8087CW);
Result := 0;
if winampDsp^.hDll <> 0
then
begin
FreeMem(winampDsp);
pGetMod := GetProcAddress(winampDsp^.hDll, '
winampDSPGetHeader2');
if pGetMod <>
nil then
begin
// Fake Winamp Window erstellen
if (Create_Winamp_Window(winampDsp, x, y, Width, Height, proc)) = True
then
begin
cnt := 0;
winampDsp^.pModule := pGetMod;
if winampDsp^.pModule <>
nil then
begin
// Schleife durchlaufen bis kein Modul mehr gefunden wurde
repeat
Inc(cnt);
until winampDsp^.pModule^.getModule(cnt) =
nil;
// Anzahl der Module speichern
winampDsp^.NumberOfModules := cnt;
winampDsp^.module := -1;
InitializeCriticalSection(winampDsp^.csh);
// Addiere ein neues Winamp DSP Plugin
AddDSP(winampDsp);
// Übergebe das Handle
Result := winampDsp^.handle
end else
// Bei Fehler Winamp Fake Window beenden
Destroy_Winamp_Window(winampDsp);
end else
// Library freigeben
FreeLibrary(winampDsp^.hDll);
end
end
end;