TracktionEngine
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tracktion::engine::DeviceManager Class Reference

Inherits juce::ChangeBroadcaster, juce::ChangeListener, and juce::AudioIODeviceCallback.

Classes

struct  ContextDeviceListRebuilder
 
struct  CPUUsageListener
 

Public Member Functions

 ~DeviceManager () override
 
void initialise (int defaultNumInputChannelsToOpen=512, int defaultNumOutputChannelsToOpen=512)
 
void closeDevices ()
 
void saveSettings ()
 
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. More...
 
bool isHostedAudioDeviceInterfaceInUse () const
 Returns true if the hosted interface is available and in use. More...
 
void removeHostedAudioDeviceInterface ()
 Removes the hosted audio device. More...
 
float getCpuUsage () const noexcept
 
void setCpuLimitBeforeMuting (double newLimit)
 
void updateNumCPUs ()
 
void addCPUUsageListener (CPUUsageListener *listener)
 
void removeCPUUsageListener (CPUUsageListener *listener)
 
double getSampleRate () const
 
int getBitDepth () const
 
int getBlockSize () const
 
double getBlockSizeMs () const
 
TimeDuration getBlockLength () const
 
int getNumWaveOutDevices () const
 
WaveOutputDevicegetWaveOutDevice (int index) const
 
WaveOutputDevicegetDefaultWaveOutDevice () const
 
void setDefaultWaveOutDevice (int index)
 
int getNumWaveInDevices () const
 
WaveInputDevicegetWaveInDevice (int index) const
 
WaveInputDevicegetDefaultWaveInDevice () const
 
void setDefaultWaveInDevice (int index)
 
void setDeviceOutChannelStereo (int channelNum, bool isStereoPair)
 
bool isDeviceOutChannelStereo (int chan) const
 
bool isDeviceOutEnabled (int chanNum)
 
void setDeviceInChannelStereo (int channelNum, bool isStereoPair)
 
bool isDeviceInChannelStereo (int chan) const
 
bool isDeviceInEnabled (int chanNum)
 
void setWaveOutChannelsEnabled (const std::vector< ChannelIndex > &, bool)
 
void setWaveInChannelsEnabled (const std::vector< ChannelIndex > &, bool)
 
bool rebuildWaveDeviceListIfNeeded ()
 
void rescanMidiDeviceList (bool forceRescan)
 
int getNumMidiOutDevices () const
 
MidiOutputDevicegetMidiOutDevice (int index) const
 
MidiOutputDevicegetDefaultMidiOutDevice () const
 
void setDefaultMidiOutDevice (int index)
 
int getNumMidiInDevices () const
 
MidiInputDevicegetMidiInDevice (int index) const
 
MidiInputDevicegetDefaultMidiInDevice () const
 
void setDefaultMidiInDevice (int index)
 
void broadcastStreamTimeToMidiDevices (double streamTime)
 
bool shouldSendMidiTimecode () const noexcept
 
double getCurrentStreamTime () const noexcept
 Returns the current block's stream time. More...
 
bool isMSWavetableSynthPresent () const
 
void resetToDefaults (bool deviceSettings, bool resetInputDevices, bool resetOutputDevices, bool latencySettings, bool mixSettings)
 
int getNumInputDevices () const
 
InputDevicegetInputDevice (int index) const
 
int getNumOutputDevices () const
 
OutputDevicegetOutputDeviceAt (int index) const
 
OutputDevicefindOutputDeviceForID (const juce::String &id) const
 
OutputDevicefindOutputDeviceWithName (const juce::String &name) const
 
void checkDefaultDevicesAreValid ()
 
juce::Result createVirtualMidiDevice (const juce::String &name)
 
void deleteVirtualMidiDevice (VirtualMidiInputDevice *)
 
double getRecordAdjustmentMs ()
 
int getRecordAdjustmentSamples ()
 
double getOutputLatencySeconds () const
 
void addContext (EditPlaybackContext *)
 
void removeContext (EditPlaybackContext *)
 
void clearAllContextDevices ()
 
void reloadAllContextDevices ()
 
void setGlobalOutputAudioProcessor (juce::AudioProcessor *)
 Sets a global processor to be applied to the output. More...
 
juce::AudioProcessor * getGlobalOutputAudioProcessor () const
 Returns a previously set globalOutputAudioProcessor. More...
 

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
 
std::unique_ptr< HostedAudioDeviceInterfacehostedAudioDeviceInterface
 
TracktionEngineAudioDeviceManager deviceManager { engine }
 
juce::OwnedArray< MidiInputDevice, juce::CriticalSection > midiInputs
 
juce::OwnedArray< MidiOutputDevicemidiOutputs
 
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. More...
 

Constructor & Destructor Documentation

◆ ~DeviceManager()

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

Member Function Documentation

◆ initialise()

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

◆ closeDevices()

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

◆ saveSettings()

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

◆ 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.

◆ getCpuUsage()

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

◆ setCpuLimitBeforeMuting()

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

◆ updateNumCPUs()

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

◆ addCPUUsageListener()

void tracktion::engine::DeviceManager::addCPUUsageListener ( CPUUsageListener listener)

◆ removeCPUUsageListener()

void tracktion::engine::DeviceManager::removeCPUUsageListener ( CPUUsageListener listener)

◆ getSampleRate()

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

◆ getBitDepth()

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

◆ getBlockSize()

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

◆ getBlockSizeMs()

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

◆ getBlockLength()

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

◆ getNumWaveOutDevices()

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

References waveOutputs.

◆ getWaveOutDevice()

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

References waveOutputs.

Referenced by getDefaultWaveOutDevice().

◆ getDefaultWaveOutDevice()

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

References getWaveOutDevice().

◆ setDefaultWaveOutDevice()

void tracktion::engine::DeviceManager::setDefaultWaveOutDevice ( int  index)

◆ getNumWaveInDevices()

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

References waveInputs.

◆ getWaveInDevice()

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

References waveInputs.

Referenced by getDefaultWaveInDevice().

◆ getDefaultWaveInDevice()

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

References getWaveInDevice().

◆ setDefaultWaveInDevice()

void tracktion::engine::DeviceManager::setDefaultWaveInDevice ( int  index)

◆ 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)

◆ 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)

◆ setWaveOutChannelsEnabled()

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

◆ setWaveInChannelsEnabled()

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

◆ rebuildWaveDeviceListIfNeeded()

bool tracktion::engine::DeviceManager::rebuildWaveDeviceListIfNeeded ( )

◆ rescanMidiDeviceList()

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

◆ getNumMidiOutDevices()

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

References midiOutputs.

◆ getMidiOutDevice()

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

References midiOutputs.

Referenced by getDefaultMidiOutDevice().

◆ getDefaultMidiOutDevice()

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

References getMidiOutDevice().

◆ setDefaultMidiOutDevice()

void tracktion::engine::DeviceManager::setDefaultMidiOutDevice ( int  index)

◆ getNumMidiInDevices()

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

◆ getMidiInDevice()

MidiInputDevice* tracktion::engine::DeviceManager::getMidiInDevice ( int  index) const

Referenced by getDefaultMidiInDevice().

◆ getDefaultMidiInDevice()

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

References getMidiInDevice().

◆ setDefaultMidiInDevice()

void tracktion::engine::DeviceManager::setDefaultMidiInDevice ( int  index)

◆ 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

◆ resetToDefaults()

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

◆ 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

◆ findOutputDeviceForID()

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

◆ findOutputDeviceWithName()

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

◆ 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 )

◆ getRecordAdjustmentMs()

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

◆ getRecordAdjustmentSamples()

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

◆ getOutputLatencySeconds()

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

◆ addContext()

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

◆ removeContext()

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

◆ clearAllContextDevices()

void tracktion::engine::DeviceManager::clearAllContextDevices ( )

◆ reloadAllContextDevices()

void tracktion::engine::DeviceManager::reloadAllContextDevices ( )

◆ setGlobalOutputAudioProcessor()

void tracktion::engine::DeviceManager::setGlobalOutputAudioProcessor ( 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

◆ engine

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

◆ hostedAudioDeviceInterface

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

◆ deviceManager

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

◆ midiInputs

juce::OwnedArray<MidiInputDevice, juce::CriticalSection> tracktion::engine::DeviceManager::midiInputs

◆ midiOutputs

juce::OwnedArray<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: