Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Updating GUI controls in response to MIDI events
No permission to create posts
February 16, 2017
3:51 am
Avatar
arcyam
Member
Members
Forum Posts: 7
Member Since:
February 7, 2017
sp_UserOfflineSmall Offline

Hi

I was having a look at the recommendations for updating GUI controls in version 6.8+

http://willpirkle.com/Download.....PlugIn.pdf

The checkUpdateGUI method seems to assume that GUI controls are updated only in response to actions involving other GUI controls.

I am very new to RackAFX, but I have been investigating a MIDI learn function - i.e the user will hit "MIDI Learn" (setting the state of the toggle button to lit), then press a note on the controller, and I expect the MIDI note number to be displayed and the state of the toggle button to be reset.

Where/how exactly should the reset of the toggle button be updated in response to the MIDI note?

Thanks for any advice!

February 16, 2017
9:43 am
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

Hello

Yes, the update-GUI functionality is related to other GUI controls moving. 

If you want to add functionality like you describe, then you need to use the Advanced GUI API and create your own GUI controls which you can then update as you like, from the midiXXX( ) functions in your RackAFX plugin. This is not difficult, but does require a bit of coding on your side. You would need to create a Custom View object for the toggle switch and a CTextLabel "blurb" that would display the MIDI data. If I have some spare time, I may create an example plugin for this as it seems like others might be interested in that functionality. Until then, you will need to look at Module 4 on the Advanced GUI API page here:

http://www.willpirkle.com/supp.....tutorials/

One thing to note: the Custom View paradigm is part of the VSTGUI4 API and is designed for exactly this kind of application. 

- Will

February 18, 2017
2:58 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

I created a simple example Project for RackAFX that shows how to implement this kind of GUI functionality. It consists of exactly what is described above - a MIDI Learn button and a text label; when the user engages the MIDI Learn button, then hits a note on a MIDI keyboard, the switch resets (turns off), the MIDI note number is stored, and then the note number is displayed in the text label. This is a really excellent example showing how to make use of the Advanced GUI API in a very simple way. The PDF document and sample RackAFX project code is here:

http://www.willpirkle.com/rack.....nts/#TECH5

- Will

February 20, 2017
8:40 am
Avatar
arcyam
Member
Members
Forum Posts: 7
Member Since:
February 7, 2017
sp_UserOfflineSmall Offline

W Pirkle said
I created a simple example Project for RackAFX that shows how to implement this kind of GUI functionality. It consists of exactly what is described above - a MIDI Learn button and a text label; when the user engages the MIDI Learn button, then hits a note on a MIDI keyboard, the switch resets (turns off), the MIDI note number is stored, and then the note number is displayed in the text label. This is a really excellent example showing how to make use of the Advanced GUI API in a very simple way. The PDF document and sample RackAFX project code is here:

http://www.willpirkle.com/rack.....nts/#TECH5

- Will  

Thanks, Will - that is very helpful. I followed your guide and obtained something workable.

I did notice that I had to set the project as "output only", otherwise I didn't receive MIDI note events (I think... I tried a few things at first)

"Output only" = true seems to correspond to VSTi, whereas as false seems to correpond to VST (I found the variable name m_bOutputOnlyPlugIn a bit confusing - does it refer to MIDI? Audio? What input can it receive? etc. But that's a minor confusion for a newcomer I guess)

February 20, 2017
10:50 am
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

An output-only plugin is a plugin that only creates output audio data and does not process (or need) incoming audio buffers; examples are oscillators and software synthesizers. However, the side-chain input audio data may be used if desired (e.g. a vocoder synth).

This flag must be set in the Edit Project dialog (this will set the flag for you in code). You should *not* set this flag on your own - the reason is that the RackAFX project (the .prj file) needs to know whether your plugin is for FX or oscillator/synth, and Edit Project sets the information in there as well.

Image Enlarger

This flag identifies the plugin as a Synth plugin (not only as a VSTi, but also as a synth-category-plugin for AU and AAX). So you should not create an output-only plugin if you intend to process incoming audio data (FX).

Also, you do not need to set this flag to receive MIDI messages - the MIDILearn RackAFX project is not flagged as a synth plugin (see image) - it is actually an FX plugin.

 

For MIDI, there are only two rules:

A) you will always receive notifications for the following MIDI events, each in its own function:

 

virtual bool __stdcall midiNoteOn(UINT uChannel, UINT uMIDINote, UINT uVelocity);

virtual bool __stdcall midiNoteOff(UINT uChannel, UINT uMIDINote, UINT uVelocity, bool bAllNotesOff);

virtual bool __stdcall midiModWheel(UINT uChannel, UINT uModValue);

virtual bool __stdcall midiPitchBend(UINT uChannel, int nActualPitchBendValue, float fNormalizedPitchBendValue);

virtual bool __stdcall midiClock();

 

B) If you want to receive ALL MIDI  messages, then you set the flag

m_bWantAllMIDIMessages = true;

 in your derived class constructor. With that flag set, the final MIDI message handler will be called for all messages:

 

virtual bool __stdcall midiMessage(unsigned char cChannel, unsigned char cStatus, unsigned char cData1, unsigned char cData2);

 

Notice also that the incoming data is raw BYTE values (unsigned char) for this function, whereas the other functions transmit UINT data, which is easier to manipulate.

- Will

February 21, 2017
3:59 am
Avatar
arcyam
Member
Members
Forum Posts: 7
Member Since:
February 7, 2017
sp_UserOfflineSmall Offline

Thanks. I have confirmed that my failure to receive midiNoteOn was actually a Reaper misconfiguration (it sets tracks up differently when initializing a virtual instrument as opposed to a basic audio track - in particular, I was not getting MIDI note messages with "Monitor Input" unticked).

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 477

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 483

Posts: 1877

Newest Members:

Jaggxn, sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143