TracktionEngine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tracktion::engine::DeviceManager Class Reference

#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.
 
HostedAudioDeviceInterfacegetHostedAudioDeviceInterface ()
 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
 
InputDevicegetInputDevice (int index) const
 
int getNumOutputDevices () const
 
OutputDevicegetOutputDeviceAt (int index) const
 
InputDevicefindInputDeviceForID (const juce::String &id) const
 
InputDevicefindInputDeviceWithName (const juce::String &name) const
 
std::shared_ptr< MidiInputDevicefindMidiInputDeviceForID (const juce::String &id) const
 
OutputDevicefindOutputDeviceForID (const juce::String &id) const
 
OutputDevicefindOutputDeviceWithName (const juce::String &name) const
 
int getNumWaveOutDevices () const
 
WaveOutputDevicegetWaveOutDevice (int index) const
 
void setDefaultWaveOutDevice (juce::String deviceID)
 
WaveOutputDevicegetDefaultWaveOutDevice () const
 
juce::String getDefaultWaveOutDeviceID () const
 
int getNumWaveInDevices () const
 
WaveInputDevicegetWaveInDevice (int index) const
 
void setDefaultWaveInDevice (juce::String deviceID)
 
WaveInputDevicegetDefaultWaveInDevice () 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
 
MidiOutputDevicegetMidiOutDevice (int index) const
 
void setDefaultMidiOutDevice (juce::String deviceID)
 
MidiOutputDevicegetDefaultMidiOutDevice () const
 
juce::String getDefaultMidiOutDeviceID () const
 
int getNumMidiInDevices () const
 
std::shared_ptr< MidiInputDevicegetMidiInDevice (int index) const
 
std::vector< std::shared_ptr< MidiInputDevice > > getMidiInDevices () const
 
void setDefaultMidiInDevice (juce::String deviceID)
 
MidiInputDevicegetDefaultMidiInDevice () 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

Engineengine
 
TracktionEngineAudioDeviceManager deviceManager { engine }
 
std::unique_ptr< HostedAudioDeviceInterfacehostedAudioDeviceInterface
 
std::vector< std::shared_ptr< MidiInputDevice > > midiInputs
 
std::vector< std::shared_ptr< MidiOutputDevice > > midiOutputs
 
juce::OwnedArray< WaveInputDevicewaveInputs
 
juce::OwnedArray< WaveOutputDevicewaveOutputs
 
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
 

Constructor & Destructor Documentation

◆ ~DeviceManager()

tracktion::engine::DeviceManager::~DeviceManager ( )
override

Member Function Documentation

◆ initialise()

void tracktion::engine::DeviceManager::initialise ( int  defaultNumInputChannelsToOpen = defaultNumChannelsToOpen,
int  defaultNumOutputChannelsToOpen = defaultNumChannelsToOpen 
)

◆ closeDevices()

void tracktion::engine::DeviceManager::closeDevices ( )

◆ saveSettings()

void tracktion::engine::DeviceManager::saveSettings ( )

◆ resetToDefaults()

void tracktion::engine::DeviceManager::resetToDefaults ( bool  deviceSettings,
bool  resetInputDevices,
bool  resetOutputDevices,
bool  latencySettings,
bool  mixSettings 
)

◆ rescanMidiDeviceList()

void tracktion::engine::DeviceManager::rescanMidiDeviceList ( )

◆ rescanWaveDeviceList()

void tracktion::engine::DeviceManager::rescanWaveDeviceList ( )

◆ getMidiDeviceScanIntervalSeconds()

int tracktion::engine::DeviceManager::getMidiDeviceScanIntervalSeconds ( ) const

◆ setMidiDeviceScanIntervalSeconds()

void tracktion::engine::DeviceManager::setMidiDeviceScanIntervalSeconds ( int  intervalSeconds)

◆ getSampleRate()

double tracktion::engine::DeviceManager::getSampleRate ( ) const

◆ getBitDepth()

int tracktion::engine::DeviceManager::getBitDepth ( ) const

◆ getBlockSize()

int tracktion::engine::DeviceManager::getBlockSize ( ) const

◆ getBlockLength()

TimeDuration tracktion::engine::DeviceManager::getBlockLength ( ) const

◆ getBlockSizeMs()

double tracktion::engine::DeviceManager::getBlockSizeMs ( ) const

◆ getOutputLatencySeconds()

double tracktion::engine::DeviceManager::getOutputLatencySeconds ( ) const

◆ getRecordAdjustmentMs()

double tracktion::engine::DeviceManager::getRecordAdjustmentMs ( )

◆ getRecordAdjustmentSamples()

int tracktion::engine::DeviceManager::getRecordAdjustmentSamples ( )

◆ getCpuUsage()

float tracktion::engine::DeviceManager::getCpuUsage ( ) const
noexcept

◆ setCpuLimitBeforeMuting()

void tracktion::engine::DeviceManager::setCpuLimitBeforeMuting ( double  newLimit)

◆ getCPUStatistics()

PerformanceMeasurement::Statistics tracktion::engine::DeviceManager::getCPUStatistics ( ) const

◆ restCPUStatistics()

void tracktion::engine::DeviceManager::restCPUStatistics ( )

◆ updateNumCPUs()

void tracktion::engine::DeviceManager::updateNumCPUs ( )

◆ enableOutputClipping()

void tracktion::engine::DeviceManager::enableOutputClipping ( bool  clipOutput)

If set to true, clips the output at 0.0.

◆ hasOutputClipped()

bool tracktion::engine::DeviceManager::hasOutputClipped ( bool  reset)

Checks if the output has clipped.

Parameters
resetResets the clipped flag

◆ getHostedAudioDeviceInterface()

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.

◆ isHostedAudioDeviceInterfaceInUse()

bool tracktion::engine::DeviceManager::isHostedAudioDeviceInterfaceInUse ( ) const

Returns true if the hosted interface is available and in use.

◆ removeHostedAudioDeviceInterface()

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.

◆ getNumInputDevices()

int tracktion::engine::DeviceManager::getNumInputDevices ( ) const

◆ getInputDevice()

InputDevice * tracktion::engine::DeviceManager::getInputDevice ( int  index) const

◆ getNumOutputDevices()

int tracktion::engine::DeviceManager::getNumOutputDevices ( ) const

◆ getOutputDeviceAt()

OutputDevice * tracktion::engine::DeviceManager::getOutputDeviceAt ( int  index) const

◆ findInputDeviceForID()

InputDevice * tracktion::engine::DeviceManager::findInputDeviceForID ( const juce::String &  id) const

◆ findInputDeviceWithName()

InputDevice * tracktion::engine::DeviceManager::findInputDeviceWithName ( const juce::String &  name) const

◆ findMidiInputDeviceForID()

std::shared_ptr< MidiInputDevice > tracktion::engine::DeviceManager::findMidiInputDeviceForID ( const juce::String &  id) const

◆ findOutputDeviceForID()

OutputDevice * tracktion::engine::DeviceManager::findOutputDeviceForID ( const juce::String &  id) const

◆ findOutputDeviceWithName()

OutputDevice * tracktion::engine::DeviceManager::findOutputDeviceWithName ( const juce::String &  name) const

◆ getNumWaveOutDevices()

int tracktion::engine::DeviceManager::getNumWaveOutDevices ( ) const

References waveOutputs.

◆ getWaveOutDevice()

WaveOutputDevice * tracktion::engine::DeviceManager::getWaveOutDevice ( int  index) const

References waveOutputs.

◆ setDefaultWaveOutDevice()

void tracktion::engine::DeviceManager::setDefaultWaveOutDevice ( juce::String  deviceID)

◆ getDefaultWaveOutDevice()

WaveOutputDevice * tracktion::engine::DeviceManager::getDefaultWaveOutDevice ( ) const

◆ getDefaultWaveOutDeviceID()

juce::String tracktion::engine::DeviceManager::getDefaultWaveOutDeviceID ( ) const

◆ getNumWaveInDevices()

int tracktion::engine::DeviceManager::getNumWaveInDevices ( ) const

References waveInputs.

◆ getWaveInDevice()

WaveInputDevice * tracktion::engine::DeviceManager::getWaveInDevice ( int  index) const

References waveInputs.

◆ setDefaultWaveInDevice()

void tracktion::engine::DeviceManager::setDefaultWaveInDevice ( juce::String  deviceID)

◆ getDefaultWaveInDevice()

WaveInputDevice * tracktion::engine::DeviceManager::getDefaultWaveInDevice ( ) const

◆ getDefaultWaveInDeviceID()

juce::String tracktion::engine::DeviceManager::getDefaultWaveInDeviceID ( ) const

◆ getWaveOutputDevices()

std::vector< WaveOutputDevice * > tracktion::engine::DeviceManager::getWaveOutputDevices ( )

◆ setWaveOutChannelsEnabled()

void tracktion::engine::DeviceManager::setWaveOutChannelsEnabled ( const std::vector< ChannelIndex > &  ,
bool   
)

◆ setDeviceOutChannelStereo()

void tracktion::engine::DeviceManager::setDeviceOutChannelStereo ( int  channelNum,
bool  isStereoPair 
)

◆ isDeviceOutChannelStereo()

bool tracktion::engine::DeviceManager::isDeviceOutChannelStereo ( int  chan) const

◆ isDeviceOutEnabled()

bool tracktion::engine::DeviceManager::isDeviceOutEnabled ( int  chanNum)

◆ getWaveInputDevices()

std::vector< WaveInputDevice * > tracktion::engine::DeviceManager::getWaveInputDevices ( )

◆ setWaveInChannelsEnabled()

void tracktion::engine::DeviceManager::setWaveInChannelsEnabled ( const std::vector< ChannelIndex > &  ,
bool   
)

◆ setDeviceInChannelStereo()

void tracktion::engine::DeviceManager::setDeviceInChannelStereo ( int  channelNum,
bool  isStereoPair 
)

◆ isDeviceInChannelStereo()

bool tracktion::engine::DeviceManager::isDeviceInChannelStereo ( int  chan) const

◆ isDeviceInEnabled()

bool tracktion::engine::DeviceManager::isDeviceInEnabled ( int  chanNum)

◆ enableAllWaveInputs()

void tracktion::engine::DeviceManager::enableAllWaveInputs ( )

◆ enableAllWaveOutputs()

void tracktion::engine::DeviceManager::enableAllWaveOutputs ( )

◆ setAllWaveInputsToStereoPair()

void tracktion::engine::DeviceManager::setAllWaveInputsToStereoPair ( )

◆ setAllWaveOutputsToStereoPair()

void tracktion::engine::DeviceManager::setAllWaveOutputsToStereoPair ( )

◆ getNumMidiOutDevices()

int tracktion::engine::DeviceManager::getNumMidiOutDevices ( ) const

References midiOutputs.

◆ getMidiOutDevice()

MidiOutputDevice * tracktion::engine::DeviceManager::getMidiOutDevice ( int  index) const

References midiOutputs.

◆ setDefaultMidiOutDevice()

void tracktion::engine::DeviceManager::setDefaultMidiOutDevice ( juce::String  deviceID)

◆ getDefaultMidiOutDevice()

MidiOutputDevice * tracktion::engine::DeviceManager::getDefaultMidiOutDevice ( ) const

◆ getDefaultMidiOutDeviceID()

juce::String tracktion::engine::DeviceManager::getDefaultMidiOutDeviceID ( ) const

◆ getNumMidiInDevices()

int tracktion::engine::DeviceManager::getNumMidiInDevices ( ) const

◆ getMidiInDevice()

std::shared_ptr< MidiInputDevice > tracktion::engine::DeviceManager::getMidiInDevice ( int  index) const

◆ getMidiInDevices()

std::vector< std::shared_ptr< MidiInputDevice > > tracktion::engine::DeviceManager::getMidiInDevices ( ) const

◆ setDefaultMidiInDevice()

void tracktion::engine::DeviceManager::setDefaultMidiInDevice ( juce::String  deviceID)

◆ getDefaultMidiInDevice()

MidiInputDevice * tracktion::engine::DeviceManager::getDefaultMidiInDevice ( ) const

◆ getDefaultMidiInDeviceID()

juce::String tracktion::engine::DeviceManager::getDefaultMidiInDeviceID ( ) const

◆ injectMIDIMessageToDefaultDevice()

void tracktion::engine::DeviceManager::injectMIDIMessageToDefaultDevice ( const juce::MidiMessage &  )

◆ broadcastMessageToAllVirtualDevices()

void tracktion::engine::DeviceManager::broadcastMessageToAllVirtualDevices ( PhysicalMidiInputDevice ,
const juce::MidiMessage &   
)

◆ broadcastStreamTimeToMidiDevices()

void tracktion::engine::DeviceManager::broadcastStreamTimeToMidiDevices ( double  streamTime)

◆ shouldSendMidiTimecode()

bool tracktion::engine::DeviceManager::shouldSendMidiTimecode ( ) const
noexcept

◆ getCurrentStreamTime()

double tracktion::engine::DeviceManager::getCurrentStreamTime ( ) const
noexcept

Returns the current block's stream time.

This shouldn't really be used and may be removed in future.

◆ isMSWavetableSynthPresent()

bool tracktion::engine::DeviceManager::isMSWavetableSynthPresent ( ) const

◆ dispatchPendingUpdates()

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.

◆ checkDefaultDevicesAreValid()

void tracktion::engine::DeviceManager::checkDefaultDevicesAreValid ( )

◆ getDefaultAudioOutDeviceName()

static juce::String tracktion::engine::DeviceManager::getDefaultAudioOutDeviceName ( bool  translated)
static

◆ getDefaultMidiOutDeviceName()

static juce::String tracktion::engine::DeviceManager::getDefaultMidiOutDeviceName ( bool  translated)
static

◆ getDefaultAudioInDeviceName()

static juce::String tracktion::engine::DeviceManager::getDefaultAudioInDeviceName ( bool  translated)
static

◆ getDefaultMidiInDeviceName()

static juce::String tracktion::engine::DeviceManager::getDefaultMidiInDeviceName ( bool  translated)
static

◆ createVirtualMidiDevice()

juce::Result tracktion::engine::DeviceManager::createVirtualMidiDevice ( const juce::String &  name)

◆ deleteVirtualMidiDevice()

void tracktion::engine::DeviceManager::deleteVirtualMidiDevice ( VirtualMidiInputDevice )

◆ addContext()

void tracktion::engine::DeviceManager::addContext ( EditPlaybackContext )

◆ removeContext()

void tracktion::engine::DeviceManager::removeContext ( EditPlaybackContext )

◆ setGlobalOutputAudioProcessor()

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.

◆ getGlobalOutputAudioProcessor()

juce::AudioProcessor * tracktion::engine::DeviceManager::getGlobalOutputAudioProcessor ( ) const

Returns a previously set globalOutputAudioProcessor.

Member Data Documentation

◆ defaultNumChannelsToOpen

constexpr int tracktion::engine::DeviceManager::defaultNumChannelsToOpen = 512
staticconstexpr

◆ engine

Engine& tracktion::engine::DeviceManager::engine

◆ deviceManager

TracktionEngineAudioDeviceManager tracktion::engine::DeviceManager::deviceManager { engine }

◆ hostedAudioDeviceInterface

std::unique_ptr<HostedAudioDeviceInterface> tracktion::engine::DeviceManager::hostedAudioDeviceInterface

◆ midiInputs

std::vector<std::shared_ptr<MidiInputDevice> > tracktion::engine::DeviceManager::midiInputs

◆ midiOutputs

std::vector<std::shared_ptr<MidiOutputDevice> > tracktion::engine::DeviceManager::midiOutputs

◆ waveInputs

juce::OwnedArray<WaveInputDevice> tracktion::engine::DeviceManager::waveInputs

◆ waveOutputs

juce::OwnedArray<WaveOutputDevice> tracktion::engine::DeviceManager::waveOutputs

◆ warnOfWastedMidiMessagesFunction

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.


The documentation for this class was generated from the following file: