Author Topic: Delphi/VST: How to access banks/patches?  (Read 184 times)

zr6ryo

  • Posts: 8
Delphi/VST: How to access banks/patches?
« on: 24 Sep '22 - 08:58 »
Hi everyone. I have been able to load a VST and send notes. But am having difficulty getting to sound banks other than the default. Does anyone know how to do this? So far my code is:

BASS_VST_GetInfo(vstHandle, @VSTPlugInfo);
{LOOP THROUGH ALL PATCHES}
For Loop := 0 to BASS_VST_GetProgramCount(vstHandle) - 1 do begin
   {ADD PATCH TO MEMO}
   Memo1.Lines.Add(IntToStr(Loop) + ' : ' + BASS_VST_GetProgramName(vstHandle, Loop));
end;


The patches displayed are only the default sound bank though the VST I use has multiple banks. The BASS_VST_SetProgram(vstHandle, [index]); changes the sound in the current bank but  BASS_VST_ProcessEvent(vstHandle, 0, 10, MAKEWORD(Byte1, Byte2)); does not change anything no matter what I enter for the Byte1/Byte2 values.

Any suggestions? I have now tried everything I can think of and any help would be appreciated.
« Last Edit: 27 Sep '22 - 10:01 by zr6ryo »

zr6ryo

  • Posts: 8
Re: Delphi/VST: How to access banks/patches? [SOLVED]
« Reply #1 on: 25 Sep '22 - 09:37 »
Found it! The answer is (in case anyone else is needing this):

BASS_VST_SetProgram(vstHandle, MAKEWORD(BankNumber, PatchNumber));

Excellent!

Falcosoft

  • Posts: 120
Re: Delphi/VST: How to access banks/patches? [SOLVED]
« Reply #2 on: 25 Sep '22 - 11:01 »
Found it! The answer is (in case anyone else is needing this):

BASS_VST_SetProgram(vstHandle, MAKEWORD(BankNumber, PatchNumber));

Excellent!
Hi,
Sorry to say, but it's not a general solution. It may have worked with your particular VSTi plugin but with other plugins it will not.
First I would like to discuss some misconceptions:
In case BASS_VST_SetProgram 'Program' means a VST program that is completely unrelated to Midi programs/program change messages. BASS_VST_SetProgram also works in case of effect plugins where program can mean any effect presets etc.The same is true for VSTi plugins: a VST Program can mean any kind of presets. In case of VSTi plugins that mimic real hardware you should send Bank Select messages to change banks and then a Program Change message to slect an instrument from the selected bank. According to Midi specification a single Bank Select message should not do anything without a Program Change message.
E.g If you try this Yamaha plugin you will notice that it has only 1 VST program. But you can access all XG banks by sending Bank Select and Program Change messages:
https://veg.by/en/projects/syxg50/

In case of Bass VST you can send Bank Select MSB with:
BASS_VST_ProcessEvent(vstHandle, channel, MIDI_EVENT_BANK, BankNumber);
Bank Select LSB with:
BASS_VST_ProcessEvent(vstHandle, channel, MIDI_EVENT_BANK_LSB, BankNumber);
And Program Change message with:
BASS_VST_ProcessEvent(vstHandle, channel, MIDI_EVENT_PROGRAM, ProgramNumber);

So to select e.g XG machine gun instrument in case of S-YXG50 you should call:
BASS_VST_ProcessEvent(vstHandle, 0, MIDI_EVENT_BANK, 64);
BASS_VST_ProcessEvent(vstHandle, 0, MIDI_EVENT_PROGRAM, 112);

zr6ryo

  • Posts: 8
Re: Delphi/VST: How to access banks/patches?
« Reply #3 on: 27 Sep '22 - 10:04 »
Hi Falcosoft,

Oops! I thought I had it there for a moment. Shows you how new I am to this. Thank you very much for your wisdom and advice. My method did work with the test VST but I did not think of trying it with others, as you suggest.

I will test out your suggestions as soon as I get a chance.