mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added an AudioProcessorPlayer::setMidiOutput() method for forwarding MIDI messages from the AudioProcessor and updated the standalone plugin holder to use this
This commit is contained in:
parent
e763ac3de2
commit
92141bf279
3 changed files with 35 additions and 11 deletions
|
|
@ -118,7 +118,6 @@ public:
|
|||
//==============================================================================
|
||||
virtual void createPlugin()
|
||||
{
|
||||
|
||||
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client
|
||||
processor.reset (::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
|
||||
#else
|
||||
|
|
@ -427,7 +426,8 @@ private:
|
|||
deviceSelector (deviceManagerToUse,
|
||||
minAudioInputChannels, maxAudioInputChannels,
|
||||
minAudioOutputChannels, maxAudioOutputChannels,
|
||||
true, false,
|
||||
true,
|
||||
(pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()),
|
||||
true, false),
|
||||
shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"),
|
||||
shouldMuteButton ("Mute audio input")
|
||||
|
|
@ -508,10 +508,12 @@ private:
|
|||
emptyBuffer.clear();
|
||||
|
||||
player.audioDeviceAboutToStart (device);
|
||||
player.setMidiOutput (deviceManager.getDefaultMidiOutput());
|
||||
}
|
||||
|
||||
void audioDeviceStopped() override
|
||||
{
|
||||
player.setMidiOutput (nullptr);
|
||||
player.audioDeviceStopped();
|
||||
emptyBuffer.setSize (0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,15 @@ void AudioProcessorPlayer::setDoublePrecisionProcessing (bool doublePrecision)
|
|||
}
|
||||
}
|
||||
|
||||
void AudioProcessorPlayer::setMidiOutput (MidiOutput* midiOutputToUse)
|
||||
{
|
||||
if (midiOutput != midiOutputToUse)
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
midiOutput = midiOutputToUse;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChannelData,
|
||||
const int numInputChannels,
|
||||
|
|
@ -163,6 +172,9 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
|
|||
processor->processBlock (buffer, incomingMidi);
|
||||
}
|
||||
|
||||
if (midiOutput != nullptr)
|
||||
midiOutput->sendBlockOfMessagesNow (incomingMidi);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ namespace juce
|
|||
give it a processor to use by calling setProcessor().
|
||||
|
||||
It's also a MidiInputCallback, so you can connect it to both an audio and midi
|
||||
input to send both streams through the processor.
|
||||
input to send both streams through the processor. To set a MidiOutput for the processor,
|
||||
use the setMidiOutput() method.
|
||||
|
||||
@see AudioProcessor, AudioProcessorGraph
|
||||
|
||||
|
|
@ -68,18 +69,26 @@ public:
|
|||
*/
|
||||
MidiMessageCollector& getMidiMessageCollector() noexcept { return messageCollector; }
|
||||
|
||||
/** Sets the MIDI output that should be used, if required.
|
||||
|
||||
The MIDI output will not be deleted or owned by this object. If the MIDI output is
|
||||
deleted, pass a nullptr to this method.
|
||||
*/
|
||||
void setMidiOutput (MidiOutput* midiOutputToUse);
|
||||
|
||||
/** Switch between double and single floating point precisions processing.
|
||||
The audio IO callbacks will still operate in single floating point
|
||||
precision, however, all internal processing including the
|
||||
AudioProcessor will be processed in double floating point precision if
|
||||
the AudioProcessor supports it (see
|
||||
AudioProcessor::supportsDoublePrecisionProcessing()).
|
||||
Otherwise, the processing will remain single precision irrespective of
|
||||
the parameter doublePrecision. */
|
||||
|
||||
The audio IO callbacks will still operate in single floating point precision,
|
||||
however, all internal processing including the AudioProcessor will be processed in
|
||||
double floating point precision if the AudioProcessor supports it (see
|
||||
AudioProcessor::supportsDoublePrecisionProcessing()). Otherwise, the processing will
|
||||
remain single precision irrespective of the parameter doublePrecision.
|
||||
*/
|
||||
void setDoublePrecisionProcessing (bool doublePrecision);
|
||||
|
||||
/** Returns true if this player processes internally processes the samples with
|
||||
double floating point precision. */
|
||||
double floating point precision.
|
||||
*/
|
||||
inline bool getDoublePrecisionProcessing() { return isDoublePrecision; }
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -107,6 +116,7 @@ private:
|
|||
|
||||
MidiBuffer incomingMidi;
|
||||
MidiMessageCollector messageCollector;
|
||||
MidiOutput* midiOutput = nullptr;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorPlayer)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue