An object that creates and plays a standalone instance of an AudioProcessor. More...
#include <juce_StandaloneFilterWindow.h>
Classes | |
struct | PluginInOuts |
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 >()) | |
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 () |
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.
|
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(), AudioProcessor::getMainBusNumInputChannels(), init(), RuntimePermissions::isGranted(), RuntimePermissions::isRequired(), options, processor, RuntimePermissions::recordAudio, and RuntimePermissions::request().
Referenced by StandaloneFilterWindow::StandaloneFilterWindow().
|
inlinevirtual |
References deletePlugin(), shutDownAudioDevices(), and Timer::stopTimer().
Pops up a dialog letting the user re-load the processor's state from a file.
References FileChooser::browseForFileToOpen(), MemoryBlock::getData(), getFilePatterns(), getLastFile(), FileChooser::getResult(), MemoryBlock::getSize(), juce::ignoreUnused(), File::loadFileAsData(), processor, setLastFile(), AudioProcessor::setStateInformation(), AlertWindow::showMessageBoxAsync(), TRANS, and AlertWindow::WarningIcon.
Pops up a dialog letting the user save the processor's state to a file.
References FileChooser::browseForFileToSave(), MemoryBlock::getData(), getFilePatterns(), getLastFile(), FileChooser::getResult(), MemoryBlock::getSize(), AudioProcessor::getStateInformation(), juce::ignoreUnused(), processor, File::replaceWithData(), setLastFile(), AlertWindow::showMessageBoxAsync(), TRANS, and 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 AudioIODeviceCallback.
References AudioProcessorPlayer::audioDeviceAboutToStart(), AudioBuffer< Type >::clear(), BigInteger::countNumberOfSetBits(), AudioIODevice::getActiveInputChannels(), AudioIODevice::getCurrentBufferSizeSamples(), and 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 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, so make sure your code can cope with reasonable changes in the buffer size from one callback to the next. |
Implements AudioIODeviceCallback.
References AudioProcessorPlayer::audioDeviceIOCallback(), AudioBuffer< Type >::clear(), AudioBuffer< Type >::getArrayOfReadPointers(), and Value::getValue().
|
inlineoverrideprivatevirtual |
Called to indicate that the device has stopped.
Implements AudioIODeviceCallback.
References AudioProcessorPlayer::audioDeviceStopped(), and 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 |
References channelConfiguration, createPluginFilterOfType(), AudioProcessor::disableNonMainBuses(), AudioProcessor::getMainBusNumInputChannels(), AudioProcessor::getMainBusNumOutputChannels(), jassert, processor, processorHasPotentialFeedbackLoop, AudioProcessor::setRateAndBufferSizeDetails(), AudioProcessor::setTypeOfNextNewPlugin(), AudioProcessor::wrapperType_Standalone, and AudioProcessor::wrapperType_Undefined.
Referenced by StandalonePluginHolder().
|
inlinevirtual |
References processor, and stopPlaying().
Referenced by ~StandalonePluginHolder().
References String::isEmpty(), and String::startsWithChar().
Referenced by askUserToLoadState(), and askUserToSaveState().
|
static |
References Desktop::getInstance(), PluginHostType::getPluginLoadedAs(), and AudioProcessor::wrapperType_Standalone.
Referenced by isInterAppAudioConnected().
|
inline |
References File::getSpecialLocation(), PropertySet::getValue(), settings, and File::userDocumentsDirectory.
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inline |
References shouldMuteInput.
|
inline |
References processorHasPotentialFeedbackLoop.
|
inlinenoexceptinherited |
Returns the timer's interval.
References JUCE_CALLTYPE.
Referenced by CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
inline |
References options, reloadPluginState(), setupAudioDevices(), startPlaying(), and Timer::startTimer().
Referenced by StandalonePluginHolder().
|
inline |
|
inlinenoexceptinherited |
Returns true if the timer is currently running.
|
inline |
References channelConfiguration, deviceManager, PropertySet::getBoolValue(), AudioProcessor::getMainBusNumInputChannels(), AudioProcessor::getMainBusNumOutputChannels(), PropertySet::getXmlValue(), AudioDeviceManager::initialise(), processor, settings, Value::setValue(), and shouldMuteInput.
Referenced by setupAudioDevices().
|
inline |
References MemoryBlock::fromBase64Encoding(), MemoryBlock::getData(), MemoryBlock::getSize(), PropertySet::getValue(), processor, AudioProcessor::setStateInformation(), and settings.
Referenced by init().
|
inline |
References AudioDeviceManager::createStateXml(), deviceManager, Value::getValue(), settings, PropertySet::setValue(), and shouldMuteInput.
Referenced by shutDownAudioDevices().
|
inline |
|
inline |
References File::getFullPathName(), FileChooser::getResult(), settings, and PropertySet::setValue().
Referenced by askUserToLoadState(), and askUserToSaveState().
|
inlineprivate |
References AudioDeviceManager::addAudioCallback(), AudioDeviceManager::addMidiInputCallback(), player, and reloadAudioDeviceState().
Referenced by init().
|
inline |
Shows an audio properties dialog box modally.
References ResizableWindow::backgroundColourId, channelConfiguration, DialogWindow::LaunchOptions::content, deviceManager, DialogWindow::LaunchOptions::dialogBackgroundColour, DialogWindow::LaunchOptions::dialogTitle, DialogWindow::LaunchOptions::escapeKeyTriggersCloseButton, LookAndFeel::findColour(), Component::getLookAndFeel(), AudioProcessor::getMainBusNumInputChannels(), AudioProcessor::getMainBusNumOutputChannels(), DialogWindow::LaunchOptions::launchAsync(), processor, DialogWindow::LaunchOptions::resizable, OptionalScopedPointer< ObjectType >::setOwned(), Component::setSize(), TRANS, and DialogWindow::LaunchOptions::useNativeTitleBar.
|
inlineprivate |
References player, AudioDeviceManager::removeAudioCallback(), 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 FakeMouseMoveGenerator::FakeMouseMoveGenerator(), init(), and CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize().
|
noexceptinherited |
Starts the timer with an interval specified in Hertz.
This is effectively the same as calling startTimer (1000 / timerFrequencyHz).
Referenced by AnimatedPosition< Behaviour >::endDrag(), AnimatedPosition< Behaviour >::nudge(), and AnimatedPosition< Behaviour >::timerCallback().
|
inline |
References player, and 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 AnimatedPosition< Behaviour >::beginDrag(), CarbonViewWrapperComponent::setOurSizeToEmbeddedViewSize(), AnimatedPosition< Behaviour >::setPosition(), AnimatedPosition< Behaviour >::timerCallback(), and ~StandalonePluginHolder().
|
inline |
References deviceManager, and 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 Timer.
References AudioDeviceManager::addMidiInputCallback(), MidiInput::getDevices(), JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, AudioDeviceManager::removeMidiInputCallback(), and AudioDeviceManager::setMidiInputEnabled().
Array<PluginInOuts> StandalonePluginHolder::channelConfiguration |
Referenced by createPlugin(), reloadAudioDeviceState(), showAudioSettingsDialog(), and StandalonePluginHolder().
AudioDeviceManager StandalonePluginHolder::deviceManager |
AudioSampleBuffer StandalonePluginHolder::emptyBuffer |
StringArray StandalonePluginHolder::lastMidiDevices |
ScopedPointer<AudioDeviceManager::AudioDeviceSetup> StandalonePluginHolder::options |
Referenced by init(), and StandalonePluginHolder().
AudioProcessorPlayer StandalonePluginHolder::player |
Referenced by setupAudioDevices(), shutDownAudioDevices(), startPlaying(), and stopPlaying().
ScopedPointer<AudioProcessor> StandalonePluginHolder::processor |
bool StandalonePluginHolder::processorHasPotentialFeedbackLoop = true |
Referenced by createPlugin(), and getProcessorHasPotentialFeedbackLoop().
OptionalScopedPointer<PropertySet> StandalonePluginHolder::settings |
Referenced by getLastFile(), reloadAudioDeviceState(), reloadPluginState(), saveAudioDeviceState(), savePluginState(), and setLastFile().
Value StandalonePluginHolder::shouldMuteInput |
Referenced by getMuteInputValue(), reloadAudioDeviceState(), and saveAudioDeviceState().