An object that creates and plays a standalone instance of an AudioProcessor. More...
#include <juce_StandaloneFilterWindow.h>
Classes | |
struct | PluginInOuts |
Structure used for the number of inputs and outputs. More... | |
class | SettingsComponent |
Public Member Functions | |
StandalonePluginHolder (PropertySet *settingsToUse, bool takeOwnershipOfSettings=true, const String &preferredDefaultDeviceName=String(), const AudioDeviceManager::AudioDeviceSetup *preferredSetupOptions=nullptr, const Array< PluginInOuts > &channels=Array< PluginInOuts >(), bool shouldAutoOpenMidiDevices=true) | |
Creates an instance of the default plugin. More... | |
virtual | ~StandalonePluginHolder () |
void | askUserToLoadState (const String &fileSuffix=String()) |
Pops up a dialog letting the user re-load the processor's state from a file. More... | |
void | askUserToSaveState (const String &fileSuffix=String()) |
Pops up a dialog letting the user save the processor's state to a file. More... | |
virtual void | createPlugin () |
virtual void | deletePlugin () |
File | getLastFile () const |
Value & | getMuteInputValue () |
bool | getProcessorHasPotentialFeedbackLoop () const |
void | init (bool enableAudioInput, const String &preferredDefaultDeviceName) |
bool | isInterAppAudioConnected () |
void | reloadAudioDeviceState (bool enableAudioInput, const String &preferredDefaultDeviceName, const AudioDeviceManager::AudioDeviceSetup *preferredSetupOptions) |
void | reloadPluginState () |
void | saveAudioDeviceState () |
void | savePluginState () |
void | setLastFile (const FileChooser &fc) |
void | showAudioSettingsDialog () |
Shows an audio properties dialog box modally. More... | |
void | startPlaying () |
void | stopPlaying () |
void | switchToHostApplication () |
Static Public Member Functions | |
static String | getFilePatterns (const String &fileSuffix) |
static StandalonePluginHolder * | getInstance () |
Public Attributes | |
bool | autoOpenMidiDevices |
Array< PluginInOuts > | channelConfiguration |
AudioDeviceManager | deviceManager |
AudioBuffer< float > | emptyBuffer |
StringArray | lastMidiDevices |
std::unique_ptr< AudioDeviceManager::AudioDeviceSetup > | options |
AudioProcessorPlayer | player |
std::unique_ptr< AudioProcessor > | processor |
bool | processorHasPotentialFeedbackLoop = true |
OptionalScopedPointer< PropertySet > | settings |
Value | shouldMuteInput |
Private Member Functions | |
void | audioDeviceAboutToStart (AudioIODevice *device) override |
Called to indicate that the device is about to start calling back. More... | |
virtual void | audioDeviceError (const String &errorMessage) |
This can be overridden to be told if the device generates an error while operating. More... | |
void | audioDeviceIOCallback (const float **inputChannelData, int numInputChannels, float **outputChannelData, int numOutputChannels, int numSamples) override |
Processes a block of incoming and outgoing audio data. More... | |
void | audioDeviceStopped () override |
Called to indicate that the device has stopped. More... | |
int | getTimerInterval () const noexcept |
Returns the timer's interval. More... | |
bool | isTimerRunning () const noexcept |
Returns true if the timer is currently running. More... | |
void | setupAudioDevices (bool enableAudioInput, const String &preferredDefaultDeviceName, const AudioDeviceManager::AudioDeviceSetup *preferredSetupOptions) |
void | shutDownAudioDevices () |
void | startTimer (int intervalInMilliseconds) noexcept |
Starts the timer and sets the length of interval required. More... | |
void | startTimerHz (int timerFrequencyHz) noexcept |
Starts the timer with an interval specified in Hertz. More... | |
void | stopTimer () noexcept |
Stops the timer. More... | |
void | timerCallback () override |
The user-defined callback routine that actually gets called periodically. More... | |
Static Private Member Functions | |
static void | callAfterDelay (int milliseconds, std::function< void()> functionToCall) |
Invokes a lambda after a given number of milliseconds. More... | |
static void | callPendingTimersSynchronously () |
For internal use only: invokes any timers that need callbacks. More... | |
An object that creates and plays a standalone instance of an AudioProcessor.
The object will create your processor using the same createPluginFilter() function that the other plugin wrappers use, and will run it through the computer's audio/MIDI devices using AudioDeviceManager and AudioProcessorPlayer.
{Audio}
|
inline |
Creates an instance of the default plugin.
The settings object can be a PropertySet that the class should use to store its settings - the takeOwnershipOfSettings indicates whether this object will delete the settings automatically when no longer needed. The settings can also be nullptr.
A default device name can be passed in.
Preferably a complete setup options object can be used, which takes precedence over the preferredDefaultDeviceName and allows you to select the input & output device names, sample rate, buffer size etc.
In all instances, the settingsToUse will take precedence over the "preferred" options if not null.
References channelConfiguration, createPlugin(), init(), juce::RuntimePermissions::isGranted(), juce::RuntimePermissions::isRequired(), options, processor, juce::RuntimePermissions::recordAudio, and juce::RuntimePermissions::request().
|
inlinevirtual |
References deletePlugin(), shutDownAudioDevices(), and juce::Timer::stopTimer().
|
inline |
Pops up a dialog letting the user re-load the processor's state from a file.
References juce::FileChooser::browseForFileToOpen(), juce::MemoryBlock::getData(), getFilePatterns(), getLastFile(), juce::FileChooser::getResult(), juce::MemoryBlock::getSize(), juce::ignoreUnused(), int(), juce::File::loadFileAsData(), processor, setLastFile(), juce::AlertWindow::showMessageBoxAsync(), TRANS, and juce::AlertWindow::WarningIcon.
|
inline |
Pops up a dialog letting the user save the processor's state to a file.
References juce::FileChooser::browseForFileToSave(), juce::MemoryBlock::getData(), getFilePatterns(), getLastFile(), juce::FileChooser::getResult(), juce::MemoryBlock::getSize(), juce::ignoreUnused(), processor, juce::File::replaceWithData(), setLastFile(), juce::AlertWindow::showMessageBoxAsync(), TRANS, and juce::AlertWindow::WarningIcon.
|
inlineoverrideprivatevirtual |
Called to indicate that the device is about to start calling back.
This will be called just before the audio callbacks begin, either when this callback has just been added to an audio device, or after the device has been restarted because of a sample-rate or block-size change.
You can use this opportunity to find out the sample rate and block size that the device is going to use by calling the AudioIODevice::getCurrentSampleRate() and AudioIODevice::getCurrentBufferSizeSamples() on the supplied pointer.
device | the audio IO device that will be used to drive the callback. Note that if you're going to store this this pointer, it is only valid until the next time that audioDeviceStopped is called. |
Implements juce::AudioIODeviceCallback.
References juce::AudioProcessorPlayer::audioDeviceAboutToStart(), juce::AudioBuffer< Type >::clear(), juce::BigInteger::countNumberOfSetBits(), juce::AudioIODevice::getActiveInputChannels(), juce::AudioIODevice::getCurrentBufferSizeSamples(), juce::AudioDeviceManager::getDefaultMidiOutput(), juce::AudioProcessorPlayer::setMidiOutput(), and juce::AudioBuffer< Type >::setSize().
|
virtualinherited |
This can be overridden to be told if the device generates an error while operating.
Be aware that this could be called by any thread! And not all devices perform this callback.
Reimplemented in juce::SoundPlayer.
|
inlineoverrideprivatevirtual |
Processes a block of incoming and outgoing audio data.
The subclass's implementation should use the incoming audio for whatever purposes it needs to, and must fill all the output channels with the next block of output data before returning.
The channel data is arranged with the same array indices as the channel name array returned by AudioIODevice::getOutputChannelNames(), but those channels that aren't specified in AudioIODevice::open() will have a null pointer for their associated channel, so remember to check for this.
inputChannelData | a set of arrays containing the audio data for each incoming channel - this data is valid until the function returns. There will be one channel of data for each input channel that was enabled when the audio device was opened (see AudioIODevice::open()) |
numInputChannels | the number of pointers to channel data in the inputChannelData array. |
outputChannelData | a set of arrays which need to be filled with the data that should be sent to each outgoing channel of the device. There will be one channel of data for each output channel that was enabled when the audio device was opened (see AudioIODevice::open()) The initial contents of the array is undefined, so the callback function must fill all the channels with zeros if its output is silence. Failing to do this could cause quite an unpleasant noise! |
numOutputChannels | the number of pointers to channel data in the outputChannelData array. |
numSamples | the number of samples in each channel of the input and output arrays. The number of samples will depend on the audio device's buffer size and will usually remain constant, although this isn't guaranteed. For example, on Android, on devices which support it, Android will chop up your audio processing into several smaller callbacks to ensure higher audio performance. So make sure your code can cope with reasonable changes in the buffer size from one callback to the next. |
Implements juce::AudioIODeviceCallback.
References juce::AudioProcessorPlayer::audioDeviceIOCallback(), juce::AudioBuffer< Type >::clear(), juce::AudioBuffer< Type >::getArrayOfReadPointers(), and juce::Value::getValue().
|
inlineoverrideprivatevirtual |
Called to indicate that the device has stopped.
Implements juce::AudioIODeviceCallback.
References juce::AudioProcessorPlayer::audioDeviceStopped(), juce::AudioProcessorPlayer::setMidiOutput(), and juce::AudioBuffer< Type >::setSize().
|
staticinherited |
Invokes a lambda after a given number of milliseconds.
|
staticinherited |
For internal use only: invokes any timers that need callbacks.
Don't call this unless you really know what you're doing!
|
inlinevirtual |
|
inlinevirtual |
References processor, and stopPlaying().
Referenced by ~StandalonePluginHolder().
|
inlinestatic |
References juce::String::isEmpty(), and juce::String::startsWithChar().
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inlinestatic |
References juce::Desktop::getInstance(), juce::PluginHostType::getPluginLoadedAs(), and juce::AudioProcessor::wrapperType_Standalone.
Referenced by isInterAppAudioConnected().
|
inline |
References juce::File::getSpecialLocation(), settings, and juce::File::userDocumentsDirectory.
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inline |
References shouldMuteInput.
|
inline |
References processorHasPotentialFeedbackLoop.
|
inlinenoexceptinherited |
Returns the timer's interval.
References JUCE_CALLTYPE.
Referenced by juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
inline |
References autoOpenMidiDevices, options, reloadPluginState(), setupAudioDevices(), startPlaying(), and juce::Timer::startTimer().
Referenced by StandalonePluginHolder().
|
inline |
|
inlinenoexceptinherited |
Returns true if the timer is currently running.
|
inline |
References channelConfiguration, deviceManager, juce::AudioDeviceManager::initialise(), processor, settings, juce::Value::setValue(), and shouldMuteInput.
Referenced by setupAudioDevices().
|
inline |
References juce::MemoryBlock::fromBase64Encoding(), juce::MemoryBlock::getData(), juce::MemoryBlock::getSize(), int(), processor, and settings.
Referenced by init().
|
inline |
References juce::AudioDeviceManager::createStateXml(), deviceManager, juce::Value::getValue(), settings, and shouldMuteInput.
Referenced by shutDownAudioDevices().
|
inline |
References processor, settings, and juce::MemoryBlock::toBase64Encoding().
|
inline |
References juce::File::getFullPathName(), juce::FileChooser::getResult(), and settings.
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inlineprivate |
References juce::AudioDeviceManager::addAudioCallback(), juce::AudioDeviceManager::addMidiInputCallback(), player, and reloadAudioDeviceState().
Referenced by init().
|
inline |
Shows an audio properties dialog box modally.
References juce::ResizableWindow::backgroundColourId, channelConfiguration, juce::DialogWindow::LaunchOptions::content, deviceManager, juce::DialogWindow::LaunchOptions::dialogBackgroundColour, juce::DialogWindow::LaunchOptions::dialogTitle, juce::DialogWindow::LaunchOptions::escapeKeyTriggersCloseButton, juce::jmax(), juce::jmin(), juce::DialogWindow::LaunchOptions::launchAsync(), processor, juce::DialogWindow::LaunchOptions::resizable, TRANS, and juce::DialogWindow::LaunchOptions::useNativeTitleBar.
|
inlineprivate |
References player, juce::AudioDeviceManager::removeAudioCallback(), juce::AudioDeviceManager::removeMidiInputCallback(), and saveAudioDeviceState().
Referenced by ~StandalonePluginHolder().
|
inline |
|
noexceptinherited |
Starts the timer and sets the length of interval required.
If the timer is already started, this will reset it, so the time between calling this method and the next timer callback will not be less than the interval length passed in.
intervalInMilliseconds | the interval to use (any value less than 1 will be rounded up to 1) |
Referenced by init(), and juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
noexceptinherited |
Starts the timer with an interval specified in Hertz.
This is effectively the same as calling startTimer (1000 / timerFrequencyHz).
Referenced by juce::AnimatedPosition< Behaviour >::endDrag(), juce::AnimatedPosition< Behaviour >::nudge(), and juce::AnimatedPosition< Behaviour >::timerCallback().
|
inline |
References player, and juce::AudioProcessorPlayer::setProcessor().
Referenced by deletePlugin().
|
noexceptinherited |
Stops the timer.
No more timer callbacks will be triggered after this method returns.
Note that if you call this from a background thread while the message-thread is already in the middle of your callback, then this method will cancel any future timer callbacks, but it will return without waiting for the current one to finish. The current callback will continue, possibly still running some of your timer code after this method has returned.
Referenced by juce::AnimatedPosition< Behaviour >::beginDrag(), juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), juce::AnimatedPosition< Behaviour >::setPosition(), juce::AnimatedPosition< Behaviour >::timerCallback(), and ~StandalonePluginHolder().
|
inline |
References deviceManager, and juce::AudioDeviceManager::getCurrentAudioDevice().
|
inlineoverrideprivatevirtual |
The user-defined callback routine that actually gets called periodically.
It's perfectly ok to call startTimer() or stopTimer() from within this callback to change the subsequent intervals.
Implements juce::Timer.
References juce::MidiInput::getDevices(), JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, and juce::AudioDeviceManager::setMidiInputEnabled().
bool juce::StandalonePluginHolder::autoOpenMidiDevices |
Referenced by init(), and juce::StandaloneFilterWindow::StandaloneFilterWindow().
Array<PluginInOuts> juce::StandalonePluginHolder::channelConfiguration |
Referenced by createPlugin(), reloadAudioDeviceState(), showAudioSettingsDialog(), and StandalonePluginHolder().
AudioDeviceManager juce::StandalonePluginHolder::deviceManager |
AudioBuffer<float> juce::StandalonePluginHolder::emptyBuffer |
StringArray juce::StandalonePluginHolder::lastMidiDevices |
std::unique_ptr<AudioDeviceManager::AudioDeviceSetup> juce::StandalonePluginHolder::options |
Referenced by init(), and StandalonePluginHolder().
AudioProcessorPlayer juce::StandalonePluginHolder::player |
Referenced by setupAudioDevices(), shutDownAudioDevices(), startPlaying(), and stopPlaying().
std::unique_ptr<AudioProcessor> juce::StandalonePluginHolder::processor |
bool juce::StandalonePluginHolder::processorHasPotentialFeedbackLoop = true |
Referenced by createPlugin(), and getProcessorHasPotentialFeedbackLoop().
OptionalScopedPointer<PropertySet> juce::StandalonePluginHolder::settings |
Referenced by getLastFile(), reloadAudioDeviceState(), reloadPluginState(), saveAudioDeviceState(), savePluginState(), and setLastFile().
Value juce::StandalonePluginHolder::shouldMuteInput |
Referenced by getMuteInputValue(), reloadAudioDeviceState(), and saveAudioDeviceState().