Hi Every Body
I Try to use Bass_VST with Delphi. For that i uses an example on this site
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Bass, BAssVST;
type
TMyForm = class(TForm)
VSTOpenDialog: TOpenDialog;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure LoadVST;
procedure ShowVST;
procedure UnloadVST;
Function Init_Bass : Boolean;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FVSTForm: TForm; // make a standard form & name it VSTForm, add it to your project
FVSTHandle: HSTREAM;
FStream:HStream;
public
{ Déclarations publiques }
end;
var
MyForm: TMyForm;
implementation
{$R *.dfm}
procedure TMyForm.LoadVST;
begin
VSTOpenDialog.Execute;
FVSTHandle := BASS_VST_ChannelSetDSP(FStream, PChar(VSTOpenDialog.FileName), 0, 0)
end;
procedure TMyForm.ShowVST;
var
VSTPlugInfo: BASS_VST_INFO;
begin
if not Assigned(FVSTForm) then
FVSTForm := TForm.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 TMyForm.UnloadVST;
begin
if Assigned(FVSTForm) then
FVSTForm.Hide;
BASS_VST_ChannelRemoveDSP(FStream, FVSTHandle);
end;
procedure TMyForm.Button1Click(Sender: TObject);
begin
LoadVST;
end;
procedure TMyForm.Button2Click(Sender: TObject);
begin
ShowVST
end;
procedure TMyForm.Button3Click(Sender: TObject);
begin
UnloadVST
end;
procedure TMyForm.FormCreate(Sender: TObject);
begin
//On vérifie l'initialisation
If not Init_Bass Then Exit;
//On crée Metronome_MidiStream
FStream:=BASS_StreamCreateFile(FALSE,PChar('C:\Intro.MP3'),0,0,BASS_SAMPLE_FLOAT);
//Si on ne peut pas charger la SoundFont on stoppe le métronome et on sort
//On joue le morceau
BASS_ChannelPlay(FStream,True);
end;
I have problems :
When i call procedure TMyForm.LoadVST; I have an access violation. I don't understand why : The file that i use is
http://www.freesoundeditor.com/downloads/vst/ambience_demo_win_vst_2003_10_25.zipWhat is the problem ? I don't understand
Thank you for your anwsers