An object that creates and plays a standalone instance of an AudioProcessor. More...
#include <juce_StandaloneFilterWindow.h>
Classes | |
class | CallbackMaxSizeEnforcer |
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... | |
~StandalonePluginHolder () override | |
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 () |
Image | getIAAHostIcon (int size) |
File | getLastFile () const |
Value & | getMuteInputValue () |
int | getNumInputChannels () const |
int | getNumOutputChannels () const |
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 () |
void | valueChanged (Value &value) override |
Called when a Value object is changed. More... | |
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 |
Array< MidiDeviceInfo > | lastMidiDevices |
std::atomic< bool > | muteInput { true } |
std::unique_ptr< AudioDeviceManager::AudioDeviceSetup > | options |
AudioProcessorPlayer | player |
std::unique_ptr< AudioProcessor > | processor |
bool | processorHasPotentialFeedbackLoop = true |
OptionalScopedPointer< PropertySet > | settings |
Value | shouldMuteInput |
std::unique_ptr< FileChooser > | stateFileChooser |
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... | |
Private Attributes | |
CallbackMaxSizeEnforcer | maxSizeEnforcer { *this } |
size_t | positionInQueue = (size_t) -1 |
int | timerPeriodMs = 0 |
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.
@tags{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 juce::Value::addListener(), channelConfiguration, createPlugin(), init(), juce::RuntimePermissions::isGranted(), isInterAppAudioConnected(), juce::RuntimePermissions::isRequired(), options, processor, juce::RuntimePermissions::recordAudio, juce::RuntimePermissions::request(), and shouldMuteInput.
|
inlineoverride |
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::FileBrowserComponent::canSelectFiles, juce::gl::data, juce::gl::flags, getFilePatterns(), getLastFile(), juce::FileChooser::getResult(), juce::File::loadFileAsData(), juce::FileBrowserComponent::openMode, processor, setLastFile(), juce::AlertWindow::showMessageBoxAsync(), stateFileChooser, TRANS, and juce::AlertWindow::WarningIcon.
|
inline |
Pops up a dialog letting the user save the processor's state to a file.
References juce::FileBrowserComponent::canSelectFiles, juce::gl::data, juce::gl::flags, getFilePatterns(), getLastFile(), juce::FileChooser::getResult(), processor, juce::File::replaceWithData(), juce::FileBrowserComponent::saveMode, setLastFile(), juce::AlertWindow::showMessageBoxAsync(), stateFileChooser, TRANS, juce::FileBrowserComponent::warnAboutOverwriting, 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(), deviceManager, emptyBuffer, juce::AudioIODevice::getActiveInputChannels(), juce::AudioIODevice::getCurrentBufferSizeSamples(), juce::AudioDeviceManager::getDefaultMidiOutput(), player, 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(), emptyBuffer, juce::AudioBuffer< Type >::getArrayOfReadPointers(), muteInput, and player.
|
inlineoverrideprivatevirtual |
Called to indicate that the device has stopped.
Implements juce::AudioIODeviceCallback.
References juce::AudioProcessorPlayer::audioDeviceStopped(), emptyBuffer, player, 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 |
|
inline |
References juce::gl::f, juce::File::getSpecialLocation(), settings, and juce::File::userDocumentsDirectory.
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inline |
References shouldMuteInput.
|
inline |
References channelConfiguration, and processor.
Referenced by createPlugin(), and reloadAudioDeviceState().
|
inline |
References channelConfiguration, and processor.
Referenced by createPlugin(), and reloadAudioDeviceState().
|
inline |
|
inlinenoexceptinherited |
Returns the timer's interval.
Referenced by juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
inline |
References autoOpenMidiDevices, options, reloadPluginState(), setupAudioDevices(), startPlaying(), and juce::Timer::startTimer().
Referenced by StandalonePluginHolder().
|
inline |
References deviceManager, and juce::AudioDeviceManager::getCurrentAudioDevice().
Referenced by StandalonePluginHolder().
|
inlinenoexceptinherited |
Returns true if the timer is currently running.
|
inline |
References deviceManager, getNumInputChannels(), getNumOutputChannels(), juce::AudioDeviceManager::initialise(), processor, settings, juce::Value::setValue(), and shouldMuteInput.
Referenced by setupAudioDevices().
|
inline |
References juce::gl::data, processor, and settings.
Referenced by init().
|
inline |
References juce::AudioDeviceManager::createStateXml(), deviceManager, juce::Value::getValue(), settings, shouldMuteInput, and juce::UnitTestCategories::xml.
Referenced by shutDownAudioDevices().
|
inline |
References juce::gl::data, processor, and settings.
|
inline |
References juce::File::getFullPathName(), juce::FileChooser::getResult(), and settings.
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inlineprivate |
References juce::AudioDeviceManager::addAudioCallback(), juce::AudioDeviceManager::addMidiInputDeviceCallback(), deviceManager, maxSizeEnforcer, 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::DialogWindow::LaunchOptions::launchAsync(), processor, juce::DialogWindow::LaunchOptions::resizable, TRANS, and juce::DialogWindow::LaunchOptions::useNativeTitleBar.
|
inlineprivate |
|
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(), juce::CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), and juce::DeviceChangeDetector::triggerAsyncDeviceChangeCallback().
|
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::DeviceChangeDetector::timerCallback(), 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 deviceManager, juce::MidiInput::getAvailableDevices(), lastMidiDevices, and juce::AudioDeviceManager::setMidiInputDeviceEnabled().
|
inlineoverridevirtual |
Called when a Value object is changed.
Note that the Value object passed as a parameter may not be exactly the same object that you registered the listener with - it might be a copy that refers to the same underlying ValueSource. To find out, you can call Value::refersToSameSourceAs().
Implements juce::Value::Listener.
References muteInput, and juce::gl::value.
Array<PluginInOuts> juce::StandalonePluginHolder::channelConfiguration |
Referenced by getNumInputChannels(), getNumOutputChannels(), showAudioSettingsDialog(), and StandalonePluginHolder().
AudioDeviceManager juce::StandalonePluginHolder::deviceManager |
AudioBuffer<float> juce::StandalonePluginHolder::emptyBuffer |
Referenced by audioDeviceAboutToStart(), audioDeviceIOCallback(), and audioDeviceStopped().
Array<MidiDeviceInfo> juce::StandalonePluginHolder::lastMidiDevices |
Referenced by timerCallback().
|
private |
Referenced by setupAudioDevices(), and shutDownAudioDevices().
std::atomic<bool> juce::StandalonePluginHolder::muteInput { true } |
Referenced by audioDeviceIOCallback(), and valueChanged().
std::unique_ptr<AudioDeviceManager::AudioDeviceSetup> juce::StandalonePluginHolder::options |
Referenced by init(), and StandalonePluginHolder().
AudioProcessorPlayer juce::StandalonePluginHolder::player |
|
privateinherited |
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 |
std::unique_ptr<FileChooser> juce::StandalonePluginHolder::stateFileChooser |
Referenced by askUserToLoadState(), and askUserToSaveState().
|
privateinherited |