mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added a MIDI output node to the AudioPluginHost
This commit is contained in:
parent
b2d8f45e14
commit
4b118bb45b
5 changed files with 45 additions and 7 deletions
|
|
@ -1167,10 +1167,13 @@ GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& fm,
|
|||
deviceManager.addChangeListener (graphPanel.get());
|
||||
deviceManager.addAudioCallback (&graphPlayer);
|
||||
deviceManager.addMidiInputDeviceCallback ({}, &graphPlayer.getMidiMessageCollector());
|
||||
deviceManager.addChangeListener (this);
|
||||
}
|
||||
|
||||
void GraphDocumentComponent::init()
|
||||
{
|
||||
updateMidiOutput();
|
||||
|
||||
graphPanel.reset (new GraphEditorPanel (*graph));
|
||||
addAndMakeVisible (graphPanel.get());
|
||||
graphPlayer.setProcessor (&graph->graph);
|
||||
|
|
@ -1213,6 +1216,9 @@ void GraphDocumentComponent::init()
|
|||
|
||||
GraphDocumentComponent::~GraphDocumentComponent()
|
||||
{
|
||||
if (midiOutput != nullptr)
|
||||
midiOutput->stopBackgroundThread();
|
||||
|
||||
releaseGraph();
|
||||
|
||||
keyState.removeListener (&graphPlayer.getMidiMessageCollector());
|
||||
|
|
@ -1326,3 +1332,23 @@ bool GraphDocumentComponent::closeAnyOpenPluginWindows()
|
|||
{
|
||||
return graphPanel->graph.closeAnyOpenPluginWindows();
|
||||
}
|
||||
|
||||
void GraphDocumentComponent::changeListenerCallback (ChangeBroadcaster*)
|
||||
{
|
||||
updateMidiOutput();
|
||||
}
|
||||
|
||||
void GraphDocumentComponent::updateMidiOutput()
|
||||
{
|
||||
auto* defaultMidiOutput = deviceManager.getDefaultMidiOutput();
|
||||
|
||||
if (midiOutput != defaultMidiOutput)
|
||||
{
|
||||
midiOutput = defaultMidiOutput;
|
||||
|
||||
if (midiOutput != nullptr)
|
||||
midiOutput->startBackgroundThread();
|
||||
|
||||
graphPlayer.setMidiOutput (midiOutput);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue