Author Topic: MIDI command to start playback of vst plugin  (Read 378 times)

kafffee

  • Posts: 252
Hi everyone  :)

I am using bass_vst.dll and I am trying to get my VST plugin to start playback. It's the "AKAI MPC Beats", which is actually a standalone DAW, but can be also used as a plugin.

I managed to show the user interface of it with BASS_VST_EmbedEditor, but the "Play"-button is greyed out. There must be some way to start playback from the host app though: When I use the AKAI MPC Beats plugin from yet another DAW, the playback will start when I hit "Play" of this DAW.

I have tried the following, which gets executed wit BASSErrorGetCode = 0, but it doesn't have any impact on playback  ??? :

Code: [Select]
BassVst.BASS_VST_ProcessEventRaw(EffectChannel, New Multimedia.Midi.MidiShortMessage(Multimedia.Midi.MIDIStatus.Start, CByte(ChannelNumber), Nothing, Nothing))
Am I using it the right way? I tried values from 0 to 15 for channel, but I don't really know what that time stamp is for....

Has anybody tried this before and is able to give me some support?

Falcosoft

  • Posts: 167
Re: MIDI command to start playback of vst plugin
« Reply #1 on: 1 Sep '23 - 23:06 »
No, you do not use it the right way but it is not your fault. Most VST plugins do not support MIDI real time messages such as MIDI clock, Start, Stop, Continue, Active Sensing etc.
Instead they support the VST defined audioMasterGetTime call which gives back a VstTimeInfo structure. One flag of this structure called kVstTransportPlaying tells the plugin if the VST host is currently playing or not. Currently the official version of Bass_VST only provides fake constant values to plugins through VstTimeInfo (bass_vst_impl.cpp).
I have a fork of Bass_VST that provides this functionality by allowing your program to fill the VstTimeInfo with real values through callbacks but since you are using Bass.net it is not available for you...
Here you can find it anyway:
https://github.com/Falcosoft/BASS_VST
« Last Edit: 1 Sep '23 - 23:12 by Falcosoft »

kafffee

  • Posts: 252
Re: MIDI command to start playback of vst plugin
« Reply #2 on: 2 Sep '23 - 05:02 »
Thats too bad. Thanks anyways  :)

I 'll let you know if I have any further questions.

kafffee

  • Posts: 252
Re: MIDI command to start playback of vst plugin
« Reply #3 on: 6 Sep '23 - 14:20 »
@Falcosoft

And here it comes :)

So basicallly if I wrote my own C++ wrapper to your function, I could get accesss to just that functionality?

Will I be able to use the standard bass_vst. dll on top simultaneously?
 
Edit: You said that the call returns if the host is playing or not. So how is it possible to make the client vst start playing when the host does
« Last Edit: 6 Sep '23 - 14:58 by kafffee »

Falcosoft

  • Posts: 167
Re: MIDI command to start playback of vst plugin
« Reply #4 on: 7 Sep '23 - 07:37 »
@Falcosoft

And here it comes :)

So basicallly if I wrote my own C++ wrapper to your function, I could get accesss to just that functionality?

Will I be able to use the standard bass_vst. dll on top simultaneously?
 
Edit: You said that the call returns if the host is playing or not. So how is it possible to make the client vst start playing when the host does

Hi,
1. No, you cannot use both dlls at the same time.
2. The 2 versions should be fairly compatible so you should try first my version without any changes and see if it works without modifications with the current Bass.Net warapper.
3. If it's not then report back and I will add the missing exports (in theory my version has more exports than the standard version but it should not cause problems).
4. Actually you should not modify many things (only 2). You can find the details of the relevant commit here:
https://github.com/Falcosoft/BASS_VST/commit/32b24cbc4de53673f96fca7487be34334deb19ac
The point is that you should  change only some constants since other changes of the commit was done in a compatible way so no changes are required on the interface. 
a. the definition of BASS_VST_AUDIO_MASTER from 3 to 4 (this way it can be used as a flag).
b. Add the definition of BASS_VST_TEMPO_REQUEST  8.

Quote
You said that the call returns if the host is playing or not. So how is it possible to make the client vst start playing when the host does

It is working this way:
With BASS_VST_SetCallback(VstHandle, VstCallbackProc, NULL); you can define what callback the plugin should call when the plugin requires time/tempo info from the host.
The definition of your callback is:
typedef DWORD (CALLBACK VSTPROC)(DWORD vstHandle, DWORD action, DWORD param1, DWORD param2, void* user);
First in your callback you should check if the action parameter is BASS_VST_TEMPO_REQUEST.
If it is then the last user parameter can be casted to a (VstTimeInfo*) struct.
Then you can set any fields of the VstTimeInfo to your real value.
In your case when you press play on your interface you should set that 1. your transportChanged state changed. 2. The state of playing become 1.
So in your callback you can write:

VstTimeInfo* vstTimeInfo =  (VstTimeInfo*)user;
vstTimeInfo->flags = 0;
if (transportChanged) {
   vstTimeInfo->flags |= kVstTransportChanged;
   transportChanged = false;
}
if (playing) vstTimeInfo->flags |= kVstTransportPlaying;
return 1;

Ps: If you can share the VST version of your plugin somewhere please do. Then I could check if your plugin really is working this way or not.
I have visited the site of AKAI MPC Beats but it requires user registration that I would not like to do.

 
« Last Edit: 7 Sep '23 - 07:56 by Falcosoft »

kafffee

  • Posts: 252
Re: MIDI command to start playback of vst plugin
« Reply #5 on: 14 Sep '23 - 14:08 »
Thanks for your detailed reply, I appreciate that.

Sorry it took me so long to answer, I was all caught up in debugging.

Actually it did happen to me, that my AKAI MPC Beats vst plugin started playing without me even doing something. Without sound, but it did play.

I have to evaluate this further, under what circumstances that happens, before we start going further.

As soon as I need help, I will be back here  :)