TracktionEngine
|
#include <tracktion_DeviceManager.h>
Inherits juce::ChangeBroadcaster, juce::ChangeListener, juce::AudioIODeviceCallback, juce::AsyncUpdater, and juce::Timer.
Classes | |
struct | TracktionEngineAudioDeviceManager |
Subclass of an AudioDeviceManager which can be used to avoid adding the system audio devices in plugin builds. More... | |
Public Member Functions | |
~DeviceManager () override | |
void | initialise (int defaultNumInputChannelsToOpen=defaultNumChannelsToOpen, int defaultNumOutputChannelsToOpen=defaultNumChannelsToOpen) |
void | closeDevices () |
void | saveSettings () |
void | resetToDefaults (bool deviceSettings, bool resetInputDevices, bool resetOutputDevices, bool latencySettings, bool mixSettings) |
void | rescanMidiDeviceList () |
void | rescanWaveDeviceList () |
int | getMidiDeviceScanIntervalSeconds () const |
void | setMidiDeviceScanIntervalSeconds (int intervalSeconds) |
double | getSampleRate () const |
int | getBitDepth () const |
int | getBlockSize () const |
TimeDuration | getBlockLength () const |
double | getBlockSizeMs () const |
double | getOutputLatencySeconds () const |
double | getRecordAdjustmentMs () |
int | getRecordAdjustmentSamples () |
float | getCpuUsage () const noexcept |
void | setCpuLimitBeforeMuting (double newLimit) |
PerformanceMeasurement::Statistics | getCPUStatistics () const |
void | restCPUStatistics () |
void | updateNumCPUs () |
void | enableOutputClipping (bool clipOutput) |
If set to true, clips the output at 0.0. | |
bool | hasOutputClipped (bool reset) |
Checks if the output has clipped. | |
HostedAudioDeviceInterface & | getHostedAudioDeviceInterface () |
If you are using the engine in a plugin or an application that accesses the audio device directly, use this interface to pass audio and midi to the DeviceManager. | |
bool | isHostedAudioDeviceInterfaceInUse () const |
Returns true if the hosted interface is available and in use. | |
void | removeHostedAudioDeviceInterface () |
Removes the hosted audio device. | |
int | getNumInputDevices () const |
InputDevice * | getInputDevice (int index) const |
int | getNumOutputDevices () const |
OutputDevice * | getOutputDeviceAt (int index) const |
InputDevice * | findInputDeviceForID (const juce::String &id) const |
InputDevice * | findInputDeviceWithName (const juce::String &name) const |
std::shared_ptr< MidiInputDevice > | findMidiInputDeviceForID (const juce::String &id) const |
OutputDevice * | findOutputDeviceForID (const juce::String &id) const |
OutputDevice * | findOutputDeviceWithName (const juce::String &name) const |
int | getNumWaveOutDevices () const |
WaveOutputDevice * | getWaveOutDevice (int index) const |
void | setDefaultWaveOutDevice (juce::String deviceID) |
WaveOutputDevice * | getDefaultWaveOutDevice () const |
juce::String | getDefaultWaveOutDeviceID () const |
int | getNumWaveInDevices () const |
WaveInputDevice * | getWaveInDevice (int index) const |
void | setDefaultWaveInDevice (juce::String deviceID) |
WaveInputDevice * | getDefaultWaveInDevice () const |
juce::String | getDefaultWaveInDeviceID () const |
std::vector< WaveOutputDevice * > | getWaveOutputDevices () |
void | setWaveOutChannelsEnabled (const std::vector< ChannelIndex > &, bool) |
void | setDeviceOutChannelStereo (int channelNum, bool isStereoPair) |
bool | isDeviceOutChannelStereo (int chan) const |
bool | isDeviceOutEnabled (int chanNum) |
std::vector< WaveInputDevice * > | getWaveInputDevices () |
void | setWaveInChannelsEnabled (const std::vector< ChannelIndex > &, bool) |
void | setDeviceInChannelStereo (int channelNum, bool isStereoPair) |
bool | isDeviceInChannelStereo (int chan) const |
bool | isDeviceInEnabled (int chanNum) |
void | enableAllWaveInputs () |
void | enableAllWaveOutputs () |
void | setAllWaveInputsToStereoPair () |
void | setAllWaveOutputsToStereoPair () |
int | getNumMidiOutDevices () const |
MidiOutputDevice * | getMidiOutDevice (int index) const |
void | setDefaultMidiOutDevice (juce::String deviceID) |
MidiOutputDevice * | getDefaultMidiOutDevice () const |
juce::String | getDefaultMidiOutDeviceID () const |
int | getNumMidiInDevices () const |
std::shared_ptr< MidiInputDevice > | getMidiInDevice (int index) const |
std::vector< std::shared_ptr< MidiInputDevice > > | getMidiInDevices () const |
void | setDefaultMidiInDevice (juce::String deviceID) |
MidiInputDevice * | getDefaultMidiInDevice () const |
juce::String | getDefaultMidiInDeviceID () const |
void | injectMIDIMessageToDefaultDevice (const juce::MidiMessage &) |
void | broadcastMessageToAllVirtualDevices (PhysicalMidiInputDevice &, const juce::MidiMessage &) |
void | broadcastStreamTimeToMidiDevices (double streamTime) |
bool | shouldSendMidiTimecode () const noexcept |
double | getCurrentStreamTime () const noexcept |
Returns the current block's stream time. | |
bool | isMSWavetableSynthPresent () const |
void | dispatchPendingUpdates () |
Changes to the devices get applied asyncronously so this function can be called to trigger any pending updates to be flushed. | |
void | checkDefaultDevicesAreValid () |
juce::Result | createVirtualMidiDevice (const juce::String &name) |
void | deleteVirtualMidiDevice (VirtualMidiInputDevice &) |
void | addContext (EditPlaybackContext *) |
void | removeContext (EditPlaybackContext *) |
void | setGlobalOutputAudioProcessor (std::unique_ptr< juce::AudioProcessor >) |
Sets a global processor to be applied to the output. | |
juce::AudioProcessor * | getGlobalOutputAudioProcessor () const |
Returns a previously set globalOutputAudioProcessor. | |
Static Public Member Functions | |
static juce::String | getDefaultAudioOutDeviceName (bool translated) |
static juce::String | getDefaultMidiOutDeviceName (bool translated) |
static juce::String | getDefaultAudioInDeviceName (bool translated) |
static juce::String | getDefaultMidiInDeviceName (bool translated) |
Public Attributes | |
Engine & | engine |
TracktionEngineAudioDeviceManager | deviceManager { engine } |
std::unique_ptr< HostedAudioDeviceInterface > | hostedAudioDeviceInterface |
std::vector< std::shared_ptr< MidiInputDevice > > | midiInputs |
std::vector< std::shared_ptr< MidiOutputDevice > > | midiOutputs |
juce::OwnedArray< WaveInputDevice > | waveInputs |
juce::OwnedArray< WaveOutputDevice > | waveOutputs |
std::function< void(InputDevice *)> | warnOfWastedMidiMessagesFunction |
If this is set, it will get called (possibly on the midi thread) when incoming messages seem to be unused. | |
Static Public Attributes | |
static constexpr int | defaultNumChannelsToOpen = 512 |
|
override |
void tracktion::engine::DeviceManager::initialise | ( | int | defaultNumInputChannelsToOpen = defaultNumChannelsToOpen , |
int | defaultNumOutputChannelsToOpen = defaultNumChannelsToOpen |
||
) |
void tracktion::engine::DeviceManager::closeDevices | ( | ) |
void tracktion::engine::DeviceManager::saveSettings | ( | ) |
void tracktion::engine::DeviceManager::resetToDefaults | ( | bool | deviceSettings, |
bool | resetInputDevices, | ||
bool | resetOutputDevices, | ||
bool | latencySettings, | ||
bool | mixSettings | ||
) |
void tracktion::engine::DeviceManager::rescanMidiDeviceList | ( | ) |
void tracktion::engine::DeviceManager::rescanWaveDeviceList | ( | ) |
int tracktion::engine::DeviceManager::getMidiDeviceScanIntervalSeconds | ( | ) | const |
void tracktion::engine::DeviceManager::setMidiDeviceScanIntervalSeconds | ( | int | intervalSeconds | ) |
double tracktion::engine::DeviceManager::getSampleRate | ( | ) | const |
int tracktion::engine::DeviceManager::getBitDepth | ( | ) | const |
int tracktion::engine::DeviceManager::getBlockSize | ( | ) | const |
TimeDuration tracktion::engine::DeviceManager::getBlockLength | ( | ) | const |
double tracktion::engine::DeviceManager::getBlockSizeMs | ( | ) | const |
double tracktion::engine::DeviceManager::getOutputLatencySeconds | ( | ) | const |
double tracktion::engine::DeviceManager::getRecordAdjustmentMs | ( | ) |
int tracktion::engine::DeviceManager::getRecordAdjustmentSamples | ( | ) |
|
noexcept |
void tracktion::engine::DeviceManager::setCpuLimitBeforeMuting | ( | double | newLimit | ) |
PerformanceMeasurement::Statistics tracktion::engine::DeviceManager::getCPUStatistics | ( | ) | const |
void tracktion::engine::DeviceManager::restCPUStatistics | ( | ) |
void tracktion::engine::DeviceManager::updateNumCPUs | ( | ) |
void tracktion::engine::DeviceManager::enableOutputClipping | ( | bool | clipOutput | ) |
If set to true, clips the output at 0.0.
bool tracktion::engine::DeviceManager::hasOutputClipped | ( | bool | reset | ) |
Checks if the output has clipped.
reset | Resets the clipped flag |
HostedAudioDeviceInterface & tracktion::engine::DeviceManager::getHostedAudioDeviceInterface | ( | ) |
If you are using the engine in a plugin or an application that accesses the audio device directly, use this interface to pass audio and midi to the DeviceManager.
bool tracktion::engine::DeviceManager::isHostedAudioDeviceInterfaceInUse | ( | ) | const |
Returns true if the hosted interface is available and in use.
void tracktion::engine::DeviceManager::removeHostedAudioDeviceInterface | ( | ) |
Removes the hosted audio device.
You shouldn't normally need to call this but can be useful for running tests. Afterwards, you'll need to call initialise again.
int tracktion::engine::DeviceManager::getNumInputDevices | ( | ) | const |
InputDevice * tracktion::engine::DeviceManager::getInputDevice | ( | int | index | ) | const |
int tracktion::engine::DeviceManager::getNumOutputDevices | ( | ) | const |
OutputDevice * tracktion::engine::DeviceManager::getOutputDeviceAt | ( | int | index | ) | const |
InputDevice * tracktion::engine::DeviceManager::findInputDeviceForID | ( | const juce::String & | id | ) | const |
InputDevice * tracktion::engine::DeviceManager::findInputDeviceWithName | ( | const juce::String & | name | ) | const |
std::shared_ptr< MidiInputDevice > tracktion::engine::DeviceManager::findMidiInputDeviceForID | ( | const juce::String & | id | ) | const |
OutputDevice * tracktion::engine::DeviceManager::findOutputDeviceForID | ( | const juce::String & | id | ) | const |
OutputDevice * tracktion::engine::DeviceManager::findOutputDeviceWithName | ( | const juce::String & | name | ) | const |
int tracktion::engine::DeviceManager::getNumWaveOutDevices | ( | ) | const |
References waveOutputs.
WaveOutputDevice * tracktion::engine::DeviceManager::getWaveOutDevice | ( | int | index | ) | const |
References waveOutputs.
void tracktion::engine::DeviceManager::setDefaultWaveOutDevice | ( | juce::String | deviceID | ) |
WaveOutputDevice * tracktion::engine::DeviceManager::getDefaultWaveOutDevice | ( | ) | const |
juce::String tracktion::engine::DeviceManager::getDefaultWaveOutDeviceID | ( | ) | const |
int tracktion::engine::DeviceManager::getNumWaveInDevices | ( | ) | const |
References waveInputs.
WaveInputDevice * tracktion::engine::DeviceManager::getWaveInDevice | ( | int | index | ) | const |
References waveInputs.
void tracktion::engine::DeviceManager::setDefaultWaveInDevice | ( | juce::String | deviceID | ) |
WaveInputDevice * tracktion::engine::DeviceManager::getDefaultWaveInDevice | ( | ) | const |
juce::String tracktion::engine::DeviceManager::getDefaultWaveInDeviceID | ( | ) | const |
std::vector< WaveOutputDevice * > tracktion::engine::DeviceManager::getWaveOutputDevices | ( | ) |
void tracktion::engine::DeviceManager::setWaveOutChannelsEnabled | ( | const std::vector< ChannelIndex > & | , |
bool | |||
) |
void tracktion::engine::DeviceManager::setDeviceOutChannelStereo | ( | int | channelNum, |
bool | isStereoPair | ||
) |
bool tracktion::engine::DeviceManager::isDeviceOutChannelStereo | ( | int | chan | ) | const |
bool tracktion::engine::DeviceManager::isDeviceOutEnabled | ( | int | chanNum | ) |
std::vector< WaveInputDevice * > tracktion::engine::DeviceManager::getWaveInputDevices | ( | ) |
void tracktion::engine::DeviceManager::setWaveInChannelsEnabled | ( | const std::vector< ChannelIndex > & | , |
bool | |||
) |
void tracktion::engine::DeviceManager::setDeviceInChannelStereo | ( | int | channelNum, |
bool | isStereoPair | ||
) |
bool tracktion::engine::DeviceManager::isDeviceInChannelStereo | ( | int | chan | ) | const |
bool tracktion::engine::DeviceManager::isDeviceInEnabled | ( | int | chanNum | ) |
void tracktion::engine::DeviceManager::enableAllWaveInputs | ( | ) |
void tracktion::engine::DeviceManager::enableAllWaveOutputs | ( | ) |
void tracktion::engine::DeviceManager::setAllWaveInputsToStereoPair | ( | ) |
void tracktion::engine::DeviceManager::setAllWaveOutputsToStereoPair | ( | ) |
int tracktion::engine::DeviceManager::getNumMidiOutDevices | ( | ) | const |
References midiOutputs.
MidiOutputDevice * tracktion::engine::DeviceManager::getMidiOutDevice | ( | int | index | ) | const |
References midiOutputs.
void tracktion::engine::DeviceManager::setDefaultMidiOutDevice | ( | juce::String | deviceID | ) |
MidiOutputDevice * tracktion::engine::DeviceManager::getDefaultMidiOutDevice | ( | ) | const |
juce::String tracktion::engine::DeviceManager::getDefaultMidiOutDeviceID | ( | ) | const |
int tracktion::engine::DeviceManager::getNumMidiInDevices | ( | ) | const |
std::shared_ptr< MidiInputDevice > tracktion::engine::DeviceManager::getMidiInDevice | ( | int | index | ) | const |
std::vector< std::shared_ptr< MidiInputDevice > > tracktion::engine::DeviceManager::getMidiInDevices | ( | ) | const |
void tracktion::engine::DeviceManager::setDefaultMidiInDevice | ( | juce::String | deviceID | ) |
MidiInputDevice * tracktion::engine::DeviceManager::getDefaultMidiInDevice | ( | ) | const |
juce::String tracktion::engine::DeviceManager::getDefaultMidiInDeviceID | ( | ) | const |
void tracktion::engine::DeviceManager::injectMIDIMessageToDefaultDevice | ( | const juce::MidiMessage & | ) |
void tracktion::engine::DeviceManager::broadcastMessageToAllVirtualDevices | ( | PhysicalMidiInputDevice & | , |
const juce::MidiMessage & | |||
) |
void tracktion::engine::DeviceManager::broadcastStreamTimeToMidiDevices | ( | double | streamTime | ) |
|
noexcept |
|
noexcept |
Returns the current block's stream time.
This shouldn't really be used and may be removed in future.
bool tracktion::engine::DeviceManager::isMSWavetableSynthPresent | ( | ) | const |
void tracktion::engine::DeviceManager::dispatchPendingUpdates | ( | ) |
Changes to the devices get applied asyncronously so this function can be called to trigger any pending updates to be flushed.
void tracktion::engine::DeviceManager::checkDefaultDevicesAreValid | ( | ) |
|
static |
|
static |
|
static |
|
static |
juce::Result tracktion::engine::DeviceManager::createVirtualMidiDevice | ( | const juce::String & | name | ) |
void tracktion::engine::DeviceManager::deleteVirtualMidiDevice | ( | VirtualMidiInputDevice & | ) |
void tracktion::engine::DeviceManager::addContext | ( | EditPlaybackContext * | ) |
void tracktion::engine::DeviceManager::removeContext | ( | EditPlaybackContext * | ) |
void tracktion::engine::DeviceManager::setGlobalOutputAudioProcessor | ( | std::unique_ptr< juce::AudioProcessor > | ) |
Sets a global processor to be applied to the output.
This can be used to set a limiter or similar on the whole ouput. It shouldn't be used for musical effects.
juce::AudioProcessor * tracktion::engine::DeviceManager::getGlobalOutputAudioProcessor | ( | ) | const |
Returns a previously set globalOutputAudioProcessor.
|
staticconstexpr |
Engine& tracktion::engine::DeviceManager::engine |
TracktionEngineAudioDeviceManager tracktion::engine::DeviceManager::deviceManager { engine } |
std::unique_ptr<HostedAudioDeviceInterface> tracktion::engine::DeviceManager::hostedAudioDeviceInterface |
std::vector<std::shared_ptr<MidiInputDevice> > tracktion::engine::DeviceManager::midiInputs |
std::vector<std::shared_ptr<MidiOutputDevice> > tracktion::engine::DeviceManager::midiOutputs |
Referenced by getMidiOutDevice(), and getNumMidiOutDevices().
juce::OwnedArray<WaveInputDevice> tracktion::engine::DeviceManager::waveInputs |
Referenced by getNumWaveInDevices(), and getWaveInDevice().
juce::OwnedArray<WaveOutputDevice> tracktion::engine::DeviceManager::waveOutputs |
Referenced by getNumWaveOutDevices(), and getWaveOutDevice().
std::function<void(InputDevice*)> tracktion::engine::DeviceManager::warnOfWastedMidiMessagesFunction |
If this is set, it will get called (possibly on the midi thread) when incoming messages seem to be unused.
May want to use it to warn the user.