JUCE
|
An object that creates and plays a standalone instance of an AudioProcessor. More...
Classes | |
struct | PluginInOuts |
Structure used for the number of inputs and outputs. More... | |
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... | |
void | init (bool enableAudioInput, const String &preferredDefaultDeviceName) |
virtual | ~StandalonePluginHolder () override |
virtual void | createPlugin () |
virtual void | deletePlugin () |
Value & | getMuteInputValue () |
bool | getProcessorHasPotentialFeedbackLoop () const |
void | valueChanged (Value &value) override |
Called when a Value object is changed. More... | |
File | getLastFile () const |
void | setLastFile (const FileChooser &fc) |
void | askUserToSaveState (const String &fileSuffix=String()) |
Pops up a dialog letting the user save the processor's state to a file. More... | |
void | askUserToLoadState (const String &fileSuffix=String()) |
Pops up a dialog letting the user re-load the processor's state from a file. More... | |
void | startPlaying () |
void | stopPlaying () |
void | showAudioSettingsDialog () |
Shows an audio properties dialog box modally. More... | |
void | saveAudioDeviceState () |
void | reloadAudioDeviceState (bool enableAudioInput, const String &preferredDefaultDeviceName, const AudioDeviceManager::AudioDeviceSetup *preferredSetupOptions) |
void | savePluginState () |
void | reloadPluginState () |
void | switchToHostApplication () |
bool | isInterAppAudioConnected () |
Static Public Member Functions | |
static String | getFilePatterns (const String &fileSuffix) |
static StandalonePluginHolder * | getInstance () |
Public Attributes | |
OptionalScopedPointer< PropertySet > | settings |
std::unique_ptr< AudioProcessor > | processor |
AudioDeviceManager | deviceManager |
AudioProcessorPlayer | player |
Array< PluginInOuts > | channelConfiguration |
bool | processorHasPotentialFeedbackLoop = true |
std::atomic< bool > | muteInput { true } |
Value | shouldMuteInput |
AudioBuffer< float > | emptyBuffer |
bool | autoOpenMidiDevices |
std::unique_ptr< AudioDeviceManager::AudioDeviceSetup > | options |
Array< MidiDeviceInfo > | lastMidiDevices |
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.
StandalonePluginHolder::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.
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 Value::addListener(), channelConfiguration, createPlugin(), init(), RuntimePermissions::isGranted(), isInterAppAudioConnected(), RuntimePermissions::isRequired(), options, processor, RuntimePermissions::recordAudio, RuntimePermissions::request(), and shouldMuteInput.
|
overridevirtual |
References deletePlugin(), and Timer::stopTimer().
void StandalonePluginHolder::init | ( | bool | enableAudioInput, |
const String & | preferredDefaultDeviceName | ||
) |
References autoOpenMidiDevices, options, reloadPluginState(), startPlaying(), and Timer::startTimer().
Referenced by StandalonePluginHolder().
|
virtual |
References channelConfiguration, createPluginFilterOfType(), processor, processorHasPotentialFeedbackLoop, and AudioProcessor::wrapperType_Standalone.
Referenced by StandalonePluginHolder().
|
virtual |
References processor, and stopPlaying().
Referenced by ~StandalonePluginHolder().
References String::isEmpty(), and String::startsWithChar().
Referenced by askUserToLoadState(), and askUserToSaveState().
Value& StandalonePluginHolder::getMuteInputValue | ( | ) |
References shouldMuteInput.
bool StandalonePluginHolder::getProcessorHasPotentialFeedbackLoop | ( | ) | const |
References processorHasPotentialFeedbackLoop.
|
overridevirtual |
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 Value::Listener.
References Value::getValue(), and muteInput.
File StandalonePluginHolder::getLastFile | ( | ) | const |
References File::getSpecialLocation(), PropertySet::getValue(), settings, and File::userDocumentsDirectory.
Referenced by askUserToLoadState(), and askUserToSaveState().
void StandalonePluginHolder::setLastFile | ( | const FileChooser & | fc | ) |
References File::getFullPathName(), FileChooser::getResult(), settings, and PropertySet::setValue().
Referenced by askUserToLoadState(), and askUserToSaveState().
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(), ignoreUnused(), processor, File::replaceWithData(), setLastFile(), AlertWindow::showMessageBoxAsync(), TRANS, and AlertWindow::WarningIcon.
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(), ignoreUnused(), int(), File::loadFileAsData(), processor, setLastFile(), AlertWindow::showMessageBoxAsync(), TRANS, and AlertWindow::WarningIcon.
void StandalonePluginHolder::startPlaying | ( | ) |
References deviceManager, AudioDeviceManager::getCurrentAudioDevice(), AudioProcessorPlayer::getMidiMessageCollector(), player, processor, and AudioProcessorPlayer::setProcessor().
Referenced by init().
void StandalonePluginHolder::stopPlaying | ( | ) |
References player, and AudioProcessorPlayer::setProcessor().
Referenced by deletePlugin().
void StandalonePluginHolder::showAudioSettingsDialog | ( | ) |
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(), jmax(), DialogWindow::LaunchOptions::launchAsync(), processor, DialogWindow::LaunchOptions::resizable, OptionalScopedPointer< ObjectType >::setOwned(), Component::setSize(), TRANS, and DialogWindow::LaunchOptions::useNativeTitleBar.
void StandalonePluginHolder::saveAudioDeviceState | ( | ) |
References settings.
void StandalonePluginHolder::reloadAudioDeviceState | ( | bool | enableAudioInput, |
const String & | preferredDefaultDeviceName, | ||
const AudioDeviceManager::AudioDeviceSetup * | preferredSetupOptions | ||
) |
void StandalonePluginHolder::savePluginState | ( | ) |
References processor, settings, PropertySet::setValue(), and MemoryBlock::toBase64Encoding().
void StandalonePluginHolder::reloadPluginState | ( | ) |
References MemoryBlock::fromBase64Encoding(), MemoryBlock::getData(), MemoryBlock::getSize(), PropertySet::getValue(), int(), processor, and settings.
Referenced by init().
void StandalonePluginHolder::switchToHostApplication | ( | ) |
References deviceManager, and AudioDeviceManager::getCurrentAudioDevice().
bool StandalonePluginHolder::isInterAppAudioConnected | ( | ) |
References deviceManager, AudioDeviceManager::getCurrentAudioDevice(), getInstance(), and ignoreUnused().
Referenced by StandalonePluginHolder().
OptionalScopedPointer<PropertySet> StandalonePluginHolder::settings |
Referenced by getLastFile(), reloadAudioDeviceState(), reloadPluginState(), saveAudioDeviceState(), savePluginState(), and setLastFile().
std::unique_ptr<AudioProcessor> StandalonePluginHolder::processor |
AudioDeviceManager StandalonePluginHolder::deviceManager |
AudioProcessorPlayer StandalonePluginHolder::player |
Referenced by startPlaying(), and stopPlaying().
Array<PluginInOuts> StandalonePluginHolder::channelConfiguration |
Referenced by createPlugin(), reloadAudioDeviceState(), showAudioSettingsDialog(), and StandalonePluginHolder().
bool StandalonePluginHolder::processorHasPotentialFeedbackLoop = true |
Referenced by createPlugin(), and getProcessorHasPotentialFeedbackLoop().
std::atomic<bool> StandalonePluginHolder::muteInput { true } |
Referenced by valueChanged().
Value StandalonePluginHolder::shouldMuteInput |
Referenced by getMuteInputValue(), reloadAudioDeviceState(), and StandalonePluginHolder().
AudioBuffer<float> StandalonePluginHolder::emptyBuffer |
bool StandalonePluginHolder::autoOpenMidiDevices |
Referenced by init(), and StandaloneFilterWindow::StandaloneFilterWindow().
std::unique_ptr<AudioDeviceManager::AudioDeviceSetup> StandalonePluginHolder::options |
Referenced by init(), and StandalonePluginHolder().
Array<MidiDeviceInfo> StandalonePluginHolder::lastMidiDevices |