Hi folks,
here is a wrapper unit to dynamic load bass_vst.dll (thks to Chris/Se).
Let me know if something doesn't work.
Axel
(*************************************************************
Delphi Header translation bass_vst.dll v2.4.0.1 (13/01/2008) by AxelLang
For Version History, Documentation see bass_vst.h!
Original Source : Bass_vst.h by Bjoern Petersen
Bjoern Petersen Software Design and Development, Hamburg, Germany.
VST PlugIn Interface Technology by Steinberg Media Technologies GmbH.
Contact: drsilver@silverjuke.net - http://www.silverjuke.net
How to install
----------------
Copy DYN_BASSVST.PAS to the \LIB subdirectory of your Delphi path or your project dir
Call Load_BASSVST (eg. in FormCreate) to load bass_vst.dll before using any functions, and
Unload_BASSVST (eg. in FormDestory) to unload it when you're done.
I AM NOT RESPONSIBLE FOR ANYTHING! USE AT YOUR OWN RISK!
**************************************************************)
Unit dyn_Bassvst;
interface
uses
Windows;
const
BASS_VST_PARAM_CHANGED = 1;
BASS_VST_EDITOR_RESIZED = 2;
BASS_VST_AUDIO_MASTER = 3;
BASS_VST_ERROR_NOINPUTS = 3000; // the given effect has no inputs and is probably a VST instrument and no effect
BASS_VST_ERROR_NOOUTPUTS = 3001; // the given effect has no outputs
BASS_VST_ERROR_NOREALTIME = 3002; // the given effect does not support realtime processing
BASS_VST_KEEP_CHANS = 1; (*By default, mono effects assigned to stereo channels
are mixed down before processing and converted back
to stereo afterwards. Set this flag to avoid this
behaviour in which case only the first channel is
affected by processing.*)
type
BASS_VST_PARAM_INFO = record
name : array [0..15] of Char; // examples: Time, Gain, RoomType
FUnit : array [0..15] of Char; // examples: sec, dB, type
Display : array [0..15] of Char; // the current value in a readable format, examples: 0.5, -3, PLATE
defaultValue : single; // the default value
end;
BASS_VST_INFO = record
ChannelHandle : DWORD; // the channelHandle as given to BASS_VST_ChannelSetDSP()
uniqueID :DWORD; // a unique ID for the effect (the IDs are registered at Steinberg)
effectName : array [0..79] of Char; // the effect name
effectVersion : DWORD; // the effect version
effectVstVersion : DWORD; // the VST version, the effect was written for
hostVstVersion : DWORD; // the VST version supported by BASS_VST, currently 2.4
productName : array [0..79] of Char; // the product name, may be empty
vendorName: array [0..79] of Char; // the vendor name, may be empty
vendorVersion : DWORD; // vendor-specific version number
chansIn : DWORD; // max. number of possible input channels
chansOut : DWORD; // max. number of possible output channels
initialDelay : DWORD; // for algorithms which need input in the first place, in milliseconds
hasEditor : DWORD; // can the BASS_VST_EmbedEditor() function be called?
editorWidth : DWORD; // initial/current width of the editor, also note BASS_VST_EDITOR_RESIZED
editorHeight : DWORD; // initial/current height of the editor, also note BASS_VST_EDITOR_RESIZED
aeffect : Pointer; // the underlying AEffect object (see the VST SDK)
end;
VSTPROC = procedure (vstHandle : DWORD; Action : DWORD; Param1,Param2 : DWORD; User : Pointer); stdcall;
var
BASS_VST_ChannelSetDSP : function(ChanHandle : DWORD; const DLLFile : PChar; flags: DWORD; priority: Integer): DWORD; stdcall;
BASS_VST_ChannelRemoveDSP : function(ChanHandle : DWORD; vstHandle : DWORD) : BOOL; stdcall;
BASS_VST_EmbedEditor : function(vstHandle : DWORD; ParentWindow : hwnd) : BOOL; stdcall;
BASS_VST_SetScope : function(vstHandle : DWORD, scope : DWORD) : BOOL; stdcall;
BASS_VST_GetInfo : function(vstHandle : DWORD; pInfo: Pointer) : BOOL; stdcall;
BASS_VST_GetParam : function(vstHandle : DWORD; paramIndex : integer) : single; stdcall;
BASS_VST_SetParam : function(vstHandle : DWORD; paramIndex : integer; value : single) : BOOL; stdcall;
BASS_VST_GetParamCount : function(vstHandle : DWORD) : integer; stdcall;
BASS_VST_GetParamInfo : function(vstHandle : DWORD; paramIndex : Integer; var Info : BASS_VST_PARAM_INFO): boolean; stdcall;
BASS_VST_Resume : function(vstHandle : DWORD) : BOOL; stdcall;
BASS_VST_SetCallback : function(vstHandle : DWORD; VSTPROC, user : Pointer;) : BOOL; stdcall;
BASS_VST_SetLanguage : function(const Lang : PChar) : BOOL; stdcall;
BASS_VST_GetBypass : function(vstHandle : DWORD): DWORD; stdcall;
BASS_VST_SetBypass : function(vstHandle : DWORD; state : boolean) : BOOL; stdcall;
BASS_VST_GetProgramParam : function(vstHandle : DWORD; programIndex : Integer) : PSingle; stdcall;
BASS_VST_SetProgramParam : function(vstHandle : DWORD; programIndex : Integer; const param : PSingle) : BOOL; stdcall;
BASS_VST_GetProgramCount : function(vstHandle : DWORD) : Integer; stdcall;
BASS_VST_GetProgram : function(vstHandle : DWORD) : Integer; stdcall;
BASS_VST_SetProgram : function(vstHandle : DWORD; programIndex : Integer) : BOOL; stdcall;
BASS_VST_GetProgramName : function(vstHandle : DWORD; programIndex : Integer) : PChar; stdcall;
BASS_VST_SetProgramName : function(vstHandle : DWORD; programIndex : Integer; const name : PChar) : BOOL; stdcall;
var BASSVST_Handle : Thandle = 0;
function Load_BASSVST(const dllfilename : string) : boolean;
procedure Unload_BASSVST;
implementation
function Load_BASSVST(const dllfilename : string) : boolean;
var
oldmode : integer;
begin
if BASSVST_Handle <> 0 then
result := true
else begin
oldmode := SetErrorMode($8001);
BASSVST_Handle := LoadLibrary(pchar(dllfilename));
SetErrorMode(oldmode);
if BASSVST_Handle <> 0 then
begin
@BASS_VST_ChannelSetDSP := GetProcAddress(BASSVST_Handle, 'BASS_VST_ChannelSetDSP');
@BASS_VST_ChannelRemoveDSP := GetProcAddress(BASSVST_Handle, 'BASS_VST_ChannelRemoveDSP');
@BASS_VST_EmbedEditor := GetProcAddress(BASSVST_Handle, 'BASS_VST_EmbedEditor');
@BASS_VST_SetScope := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetScope');
@BASS_VST_GetInfo := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetInfo');
@BASS_VST_GetParam := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetParam');
@BASS_VST_SetParam := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetParam');
@BASS_VST_GetParamCount := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetParamCount');
@BASS_VST_GetParamInfo := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetParamInfo');
@BASS_VST_Resume := GetProcAddress(BASSVST_Handle, 'BASS_VST_Resume');
@BASS_VST_SetCallback := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetCallback');
@BASS_VST_SetLanguage := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetLanguage');
@BASS_VST_GetBypass := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetBypass');
@BASS_VST_SetBypass := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetBypass');
@BASS_VST_GetProgramParam := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetProgramParam');
@BASS_VST_SetProgramParam := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetProgramParam');
@BASS_VST_GetProgramCount := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetProgramCount');
@BASS_VST_GetProgram := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetProgram');
@BASS_VST_SetProgram := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetProgram');
@BASS_VST_GetProgramName := GetProcAddress(BASSVST_Handle, 'BASS_VST_GetProgramName');
@BASS_VST_SetProgramName := GetProcAddress(BASSVST_Handle, 'BASS_VST_SetProgramName');
if (@BASS_VST_ChannelSetDSP = nil) or
(@BASS_VST_ChannelRemoveDSP = nil) or
(@BASS_VST_EmbedEditor = nil) or
(@BASS_VST_SetScope = nil) or
(@BASS_VST_GetInfo = nil) or
(@BASS_VST_GetParam = nil) or
(@BASS_VST_SetParam = nil) or
(@BASS_VST_GetParamCount = nil) or
(@BASS_VST_GetParamInfo = nil) or
(@BASS_VST_Resume = nil) or
(@BASS_VST_SetCallback = nil) or
(@BASS_VST_SetLanguage = nil) or
(@BASS_VST_GetBypass = nil) or
(@BASS_VST_SetBypass = nil) or
(@BASS_VST_GetProgramParam = nil) or
(@BASS_VST_SetProgramParam = nil) or
(@BASS_VST_GetProgramCount = nil) or
(@BASS_VST_GetProgram = nil) or
(@BASS_VST_SetProgram = nil) or
(@BASS_VST_GetProgramName = nil) or
(@BASS_VST_SetProgramName = nil) then
begin
FreeLibrary(BASSVST_Handle);
BASSVST_Handle := 0;
end;
end;
result := (BASSVST_Handle <> 0);
end;
end;
procedure Unload_BASSVST;
begin
if BASSVST_Handle <> 0 then
FreeLibrary(BASSVST_Handle);
BASSVST_Handle := 0;
end;
end.