Hey everyone. I have been trying to figure this out for months now and can find no samples. Is there anyone who can correct my code - I am not sure how BASS does it's thing and how the parts fit together.
I am trying to load an instrument VST and then play a note though that VST using MIDI data. What I have so far is:
var
Stream : HStream;
vstHandle : dword;
VstPlugInfo: BASS_VST_INFO;
procedure TForm1.FormCreate(Sender: TObject);
begin
{INIT BASS}
If (HIWORD(BASS_GetVersion) <> BASSVERSION) then begin
MessageBox(0,'An incorrect version of BASS.DLL was loaded', nil, MB_ICONERROR);
Halt;
end;
If NOT BASS_Init(-1, 44100, 0, Handle, nil) then ShowMessage('Error initializing audio!');
{LOAD VST}
Stream := BASS_StreamCreate(44100, 1, 0, STREAMPROC_PUSH, nil);
vstHandle := LoadLibrary(pchar('C:\Program Files (x86)\VST\KORG\WAVESTATION.dll'));
{ACTIVATE STREAM}
BASS_ChannelPlay(Stream, False);
{PLAY A NOTE}
BASS_VST_ProcessEvent(vstHandle, 0, 145, MAKEWORD(60, 100));
Sleep(1000);
BASS_VST_ProcessEvent(vstHandle, 0, 145, MAKEWORD(60, 0));
{FREE BASS}
end;
I see the vstHandle returns a large number and is not 0 - apparently thats a good thing. But there's no sound and no GUI opens up for the VST. I don't need to see it visually - I just need to play some notes.
Can any of you geniuses see what I am doing wrong? (Probably a lot!!!). Ive wasted a HUGE amount of time on this thinking I would eventually work it out. So I thought I would ask for help since I obviously have no clue whatsoever. Maybe I am missing a file but it compiles perfectly without throwing a wobbly though checking for errors after calling the DLL gives a "not found" error. Im not sure if it's the VST thats not found, a BASS dependency or my brain. ha ha
EDIT: The files in the project folder include bass.dll, bass.pas, bass_vst.dll, bass_vst.pas and I have also tried putting the VST DLL in the same folder.