How to do this in VB I don't know.
The Delphi code however has been posted before.
This code will give you the idea, keep in mind that FVSTForm is a simple (empty) form.
// Open and load the VST plugin
procedure LoadVST;
begin
VSTOpenDialog.Execute;
FVSTHandle := BASS_VST_ChannelSetDSP(FStream, PChar(VSTOpenDialog.FileName), 0, 0)
end;
procedure ShowVST;
var
VSTPlugInfo: BASS_VST_INFO;
begin
if not Assigned(FVSTForm) then
FVSTForm := TVSTForm.Create(Application);
if BASS_VST_GetInfo(FVSTHandle, @VSTPlugInfo) then
begin
if VSTPlugInfo.hasEditor then
begin
FVSTForm.Caption := ' ' + string(VSTPlugInfo.effectName) + ' - ' + string(VSTPlugInfo.vendorName);
if VSTPlugInfo.editorHeight = 0 then
FVSTForm.ClientHeight := 150
else FVSTForm.ClientHeight := VSTPlugInfo.editorHeight;
if VSTPlugInfo.editorWidth = 0 then
FVSTForm.ClientWidth := 300
else FVSTForm.ClientWidth := VSTPlugInfo.editorWidth;
if (VSTPlugInfo.editorHeight = 0) or (VSTPlugInfo.editorWidth = 0) then
FVSTForm.BorderStyle := bsSizeable
else FVSTForm.BorderStyle := bsDialog;
BASS_VST_EmbedEditor(FVSTHandle, 0); // un-embed first!!
if BASS_VST_EmbedEditor(FVSTHandle, FVSTForm.Handle) then
begin
if FVSTForm.Visible then
FVSTForm.BringToFront
else FVSTForm.Visible := True;
end;
end;
end;
end;
// to unload the plugin (make sure the editor window is closed before you do this)
procedure UnloadVST;
begin
if Assigned(FVSTForm) then
FVSTForm.Hide;
BASS_VST_ChannelRemoveDSP(FStream, FVSTHandle);
end;
Hi,
Having trouble with your code:
Build
[Error] Unit1.pas(30): Undeclared identifier: 'VSTOpenDialog'
[Error] Unit1.pas(30): Missing operator or semicolon
[Error] Unit1.pas(31): Undeclared identifier: 'FVSTHandle'
[Error] Unit1.pas(31): Undeclared identifier: 'BASS_VST_ChannelSetDSP'
[Error] Unit1.pas(31): Undeclared identifier: 'FStream'
[Error] Unit1.pas(31): ')' expected but identifier 'FileName' found
[Error] Unit1.pas(36): Undeclared identifier: 'BASS_VST_INFO'
[Error] Unit1.pas(38): Undeclared identifier: 'FVSTForm'
[Error] Unit1.pas(39): Undeclared identifier: 'TVSTForm'
[Error] Unit1.pas(41): Undeclared identifier: 'BASS_VST_GetInfo'
[Error] Unit1.pas(41): Undeclared identifier: 'FVSTHandle'
[Error] Unit1.pas(43): 'THEN' expected but identifier 'hasEditor' found
[Error] Unit1.pas(45): Missing operator or semicolon
[Error] Unit1.pas(45): ')' expected but identifier 'effectName' found
[Error] Unit1.pas(46): Missing operator or semicolon
[Error] Unit1.pas(46): 'THEN' expected but identifier 'editorHeight' found
[Error] Unit1.pas(50): 'THEN' expected but identifier 'editorWidth' found
[Error] Unit1.pas(54): ')' expected but identifier 'editorHeight' found
[Error] Unit1.pas(59): Undeclared identifier: 'BASS_VST_EmbedEditor'
[Error] Unit1.pas(59): 'THEN' expected but identifier 'Handle' found
[Error] Unit1.pas(61): 'THEN' expected but identifier 'Visible' found
[Error] Unit1.pas(72): Incompatible types
[Error] Unit1.pas(73): Missing operator or semicolon
[Error] Unit1.pas(75): Undeclared identifier: 'BASS_VST_ChannelRemoveDSP'
[Error] Unit1.pas(75): Undeclared identifier: 'FStream'
[Error] Unit1.pas(79): Record, object or class type required
[Error] Unit1.pas(81): 'END' expected but end of file found
[Error] Unit1.pas(12): Unsatisfied forward or external declaration: 'TForm1.Button1Click'
[Fatal Error] babyavst.dpr(6): Could not compile used unit 'Unit1.pas'
Can you do a sample containg the code, so I can then load VST plugins?