# MIDI Program Change broken (Solved)

**URL:** <https://forum.juce.com/t/midi-program-change-broken-solved/32266>\
**Category:** Audio Plugins\
**Created:** [March 14, 2019, 8:22am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266 "2019-03-14T08:22:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 14, 2019, 8:22am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/1 "2019-03-14T08:22:49Z")

</div>

I’m using the latest release and i don’t receive any MIDI Program Change messages anymore. Instead of that i receive normal controller change messages. This used to work for years and it looks like something changed.

Can someone reproduce this issue?

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [March 14, 2019, 12:39pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/2 "2019-03-14T12:39:45Z")

</div>

Where are you receiving the messages from? This is working as expected for me:

```auto
/ *******************************************************************************
 The block below describes the properties of this PIP. A PIP is a short snippet
 of code that can be read by the Projucer and used to generate a JUCE project.

 BEGIN_JUCE_PIP_METADATA

  name: MidiProgramChangeTest

  dependencies: juce_audio_basics, juce_audio_devices, juce_core, juce_cryptography, juce_data_structures, 
                    juce_events
  exporters: xcode_mac

  moduleFlags: JUCE_STRICT_REFCOUNTEDPOINTER=1

  type: Console

 END_JUCE_PIP_METADATA

******************************************************************************* /

#pragma once

//==============================================================================
int main (int argc, char* argv[])
{
    ScopedJuceInitialiser_GUI gui;
    
    struct Callback : public MidiInputCallback
    {
        void handleIncomingMidiMessage (MidiInput*, const MidiMessage& message) override
        {
            jassert (message.isProgramChange());
        }
    };
    
    Callback cb;
    
    std::unique_ptr<MidiInput> input (MidiInput::createNewDevice ("JUCE_input", &cb));
    jassert (input.get() != nullptr);
    
    DBG ("Starting input");
    input->start();
    
    std::unique_ptr<MidiOutput> output (MidiOutput::openDevice (input->getIdentifier()));
    jassert (output.get() != nullptr);
    
    DBG ("Starting output");
    output->startBackgroundThread();
    
    MidiBuffer mb;
    mb.addEvent (MidiMessage::programChange (1, 1), 0);
    mb.addEvent (MidiMessage::programChange (1, 2), 100);
    mb.addEvent (MidiMessage::programChange (1, 3), 200);
    mb.addEvent (MidiMessage::programChange (1, 4), 300);
    
    output->sendBlockOfMessages (mb, Time::getMillisecondCounter() + 2000, 100);
    
    for (;;)
    {
        Thread::sleep (10);
    }
    
    return 0;
}

```

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 14, 2019, 6:29pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/3 "2019-03-14T18:29:32Z")

</div>

Hi Ed95  
Thanks for looking at this. Sorry i wasn’t specific enough. I receive the MIDI messages in the plugins processBlock(…) method. I’m getting controller messages when a program change happens for the vst and vst3 version of the plugin. Not sure if AU is affected. I have tested this on OSX.

Any help is welcome.

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 17, 2019, 8:51am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/4 "2019-03-17T08:51:44Z")

</div>

I finally had time to take a closer look. It looks like the problem happens only with the VST3 version of the plugin. All other formats receive the MIDI program change event’s in the process block method.  
Is this a bug or is MIDI program change not supported for VST3?

Edit: It’s not supported anymore with the standard MIDI program change event in the VST3 format: [https://www.steinberg.net/forums/viewtopic.php?t=153909](https://www.steinberg.net/forums/viewtopic.php?t=153909)

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 17, 2019, 9:26pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/5 "2019-03-17T21:26:14Z")

</div>

I get the impression from reading your link that Steinberg staff with emphasis claims that it **is** supported, “yes this is possible the same as with old style VST 2 plug-ins” regarding receiving and handling external program change events. 🤔

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 18, 2019, 7:50am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/6 "2019-03-18T07:50:56Z")

</div>

It is in some way… if you publish a preset list inside your VST 3 (think if your factory presets are inside the package).  
They then select the presets for you. You never get any MIDI Program Change Message in the VST itself.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [March 18, 2019, 11:19am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/7 "2019-03-18T11:19:35Z")

</div>

Was this change in behaviour caused by this commit?

> <https://github.com/juce-framework/JUCE/commit/ba4f9d5fe5a16217437779a4b7d0cb65e6e499f0>

> [@\[BUG\] VST3 Wrapper and MIDI AllNotesOff event](https://forum.juce.com/t/bug-vst3-wrapper-and-midi-allnotesoff-event/32054):
>
> So I found a problem if you host VST3 plug-ins and the MIDI includes an AllNotesOff event… some Waves plug-ins are moving their knobs to infinity (but audio isn’t affected). in the VST3 wrapper in toEventList() I add at line 525: if (msg.isAllNotesOff()) continue; Then this is fine… but if I remove it and step through the code to midiMapping-\>getMidiControllerAssignment() in: MidiMessage msg (midiEventData, midiEventSize); …

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 18, 2019, 3:20pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/8 "2019-03-18T15:20:46Z")

</div>

I don’t think it’s a JUCE bug at the moment. In this thread it looks like MIDI Program Change events don’t work the same way as they did with VST2:

[https://www.steinberg.net/forums/viewtopic.php?t=74526](https://www.steinberg.net/forums/viewtopic.php?t=74526)

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [March 18, 2019, 3:23pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/9 "2019-03-18T15:23:11Z")

</div>

Ah yes. I misread one of the posts and thought this was a change in JUCE’s VST3 behaviour.

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 18, 2019, 9:01pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/10 "2019-03-18T21:01:35Z")

</div>

Okay…

So if I publish the GM implementation with its 128 programs/instruments as my preset list, and then when I send a program change from my keyboard, any VST3 aware DAW will catch this event, select the appropriate preset, and then make my plugin aware of this? Then as an action to this, I can recreate the original program change event and inject this to the Midibuffer in the processBlock and voilá, my old VST2 code will work again?

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [March 18, 2019, 9:45pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/11 "2019-03-18T21:45:01Z")

</div>

> any VST3 aware DAW will catch this event, select the appropriate preset, and then make my plugin aware of this?

I doubt it. The VST3 spec requires plugins to use the `IProgramListData` interface to provide the program list information (or to store the program as files in a particular location, iirc). But there’s nothing in the spec that implies the index of the list corresponds to a MIDI program change number, and those threads seem to imply they’re talking about Cubase features, not VST3.

But what is your goal? Switching presets with a MIDI controller? You can’t use program change data for that in VST3, it’s not supplied to the plugin at all.

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [March 18, 2019, 9:56pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/12 "2019-03-18T21:56:04Z")

</div>

Yes, i wanted to use MIDI program change, because i upgraded my VST2 plugins to VST3 and now the MIDI program change implementation does not work anymore. It was useful for people with a live setup.  
And it looks that they filter out this MIDI Message because Cubase now use it to change the preset within the hosts presets list (that maybe most other hosts do not support). Is that right?

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 18, 2019, 10:07pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/13 "2019-03-18T22:07:36Z")

</div>

The goal is to have Midi (GM) work as it’s intended to do and as it did before VST3; selecting Electric Piano from my keyboard will send program change no 5 to the VST sample player, selecting drawbar organ will send no 17 etc and engage the organ sample.

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 18, 2019, 10:11pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/14 "2019-03-18T22:11:15Z")

</div>

Are you implying I can’t make a link between a specific preset in my preset list and a specific program change number?

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [March 18, 2019, 10:14pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/15 "2019-03-18T22:14:48Z")

</div>

> And it looks that they filter out this MIDI Message because Cubase now use it to change the preset within the hosts presets list (that maybe most other hosts do not support). Is that right?

Pretty much. Steinberg changed the contract in VST3 where program changes are the responsibility of the host, not the plugin. Which makes a lot of sense, from the host perspective. But obviously is a point of friction with people who wanted to handle it themselves, just like the Midi CC stuff that changed in 3.6.12 back in December.

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [March 18, 2019, 10:18pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/16 "2019-03-18T22:18:43Z")

</div>

Yes. The VST3 SDK does not provide an API for MIDI program change data between the host/plugin, as far as I know (not pretending to know every detail of the spec, I’ve just read through it several times).

One “feature” of VST3 is that MIDI isn’t just piped to the plugin from the host. You don’t get raw MIDI data, just what the API allows to be exchanged (which is a subset of the MIDI spec).

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 18, 2019, 10:27pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/17 "2019-03-18T22:27:25Z")

</div>

Yeps, but why wouldn’t my workaround… work?

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [March 18, 2019, 10:43pm UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/18 "2019-03-18T22:43:47Z")

</div>

From the way you described it you’d be relying on the host to translate program changes to the correct preset, right? I’m just doubtful that you’d be able to do that in a sane way for every host

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [March 19, 2019, 2:42am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/19 "2019-03-19T02:42:35Z")

</div>

So you think if I produce a plug-in with 128 factory presets, selectable by program change events, different presets will be selected by the same program change on different hosts?

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [September 6, 2019, 10:42am UTC](https://forum.juce.com/t/midi-program-change-broken-solved/32266/20 "2019-09-06T10:42:29Z")

</div>

I’m hitting the exact same problem but this topic does not seem to come to a definite solution, why is it marked “Solved”?

[Next page](https://forum.juce.com/t/midi-program-change-broken-solved/32266.md?page=2)
