First Project, Advice Needed Please

Hi guys. This is my first post here. :grinning:

I’ve just started a few days ago with Juce and I’m pretty new to C++, having been a VB6 developer for a quite few years and I had a bit of C training many years ago. So I’m going through an interesting learning curve right now.

I followed the excellent ADC tutorial making a SimpleDelay plugin and sucessfully built some variants of that.
I’ve decided to start with a fairly simple project of my own to create a VST3 plugin that sends out bank and program changes to my external synths with selections in the UI and the ability to save and load presets. I feel I’m doing fairly well but spent a whole evening head-scratching 3 specific problems that I can’t find answers for:

  • I cannot find an example of how to get the MIDI output device that is selected in the MIDI settings dialog box that’s available when running. I assumed it would be the MIDIOutput::getDefaultDevice but that always returns the “Microsoft GS Wavetable Synth”, which is the first in the list. I can retrieve all the devices and open the one I want by name but that’s only okay for testing.

  • I’m confused about the use of AudioProcessorInt parameters in a Value Tree State. I thought this would be simple to use for bank and program integer numbers It seems you still have to get and set these as floats and convert to and from integers yourself. So what is the benefit of the AudioProcessorInt definition?

  • I can load parameters from XML files fine but my saving in getStateInformation is not working. Using DBG to compare the parameter values in my VTS, and the XML created by state.copyState.toXmlString, I can see that the XML has not got the same values but has values that were first set when the plugin loaded. Why would the copyState() be failing to assign the same values from the VTS parameters and where are these incorrect values coming from?

Sorry for the long post, perhaps I should have created 3 separate topics!

that’s a lot of questions for one post. you’ll probably have multiple discussions side-by-side here.

I just wanna give you my opinion on the parameter related question. I personally think every parameter should be a float one, even if it appears stepped to the user, because that makes it easier to add a modulation system to a plugin, since modulation destinations are also often applied to normalized parameter values, which are float by design.

Thanks for your reply.
Having inspected my 2 plugins working in Cantabile, I believe it may be down to how you want them presented to the host, as floats, integers or booleans. Not how you use them in your own code.


I believe I’ve solved my questions now.
I hadn’t known about the %appdata\roaming{plugin}{plugin}.settings file that gets automatically read on load and written on unload of standalone plugins. That makes sense.

Also I realised I was wrong in trying to open the MIDI port directly to send the initial values to the synth during the setStateInformation. I should have just updated the internal parameters and then waited for the first processBlock call to give me the MidiBuffer reference.

All the fun of the learning curve! :laughing: