![]() |
Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
|
Audio Device Guard. More...
#include <audiodeviceguard.h>
Public Member Functions | |
AudioDeviceGuard (AudioBase *output=nullptr) | |
Construtor of the AudioDeviceGuard. More... | |
~AudioDeviceGuard () | |
Destructor: Stop the timer, stop the thread and exit. More... | |
bool | startMonitoring (int seconds=20) |
Start the AudioDeviceGuard. More... | |
virtual bool | init () |
Virtual initialization function (no functionality here) More... | |
virtual bool | exit () |
Virtual exit function (no functionality here) More... | |
virtual bool | start () |
Start the thread. More... | |
virtual bool | stop () |
Stop the thread. More... | |
virtual void | suspend () |
Mark the thread as suspended. More... | |
virtual void | resume () |
Resume from the suspend mode. More... | |
bool | isActive () const |
Return true if thread is running and not suspended. More... | |
void | setVerbosity (int verbosity) |
Set verbosity level of messages. More... | |
int | getVerbosity () |
Get verbosity level. More... | |
QString | getThreadName () const |
Get thread name. More... | |
Protected Member Functions | |
virtual void | initiallyCalledWorker () |
Virtual worker function called when the thread is starting. More... | |
virtual void | finallyCalledWorker () |
Virtual worker function called when the thread stops. More... | |
void | setPriority (const QThread::Priority p) |
Set thread priority. More... | |
void | setTimerInterval (const int msec, const int firstMsec=0) |
Set timer interval for the periodically called worker. More... | |
void | setThreadName (const QString name) |
Set thread name (Linux only) More... | |
bool | isInterruptionRequested () const |
Return true if the thread was requested to interrupt or terminate. More... | |
Private Member Functions | |
void | periodicallyCalledWorker () override final |
Thread worker function, calling updateListOfDevices() of the audio object. This thread is executed at lowest possible priority. More... | |
Private Attributes | |
AudioBase * | pAudioBase |
Pointer back to the audio object. More... | |
Audio Device Guard.
The AudioDeviceGuard is a helper class that calls the function updateListOfDevices() of AudioBase periodically from an independent thread. This class is required since requesting a list of devices takes a certain amount of CPU time (up to one second) and would interrupt the audio stream if carried out on the same thread.
Definition at line 42 of file audiodeviceguard.h.
AudioDeviceGuard::AudioDeviceGuard | ( | AudioBase * | audiobase = nullptr | ) |
Construtor of the AudioDeviceGuard.
audiobase | : Pointer back to the AudioBase object (input or output) |
Definition at line 34 of file audiodeviceguard.cpp.
AudioDeviceGuard::~AudioDeviceGuard | ( | ) |
Destructor: Stop the timer, stop the thread and exit.
Definition at line 50 of file audiodeviceguard.cpp.
|
inlinevirtualinherited |
Virtual exit function (no functionality here)
Reimplemented in AudioOutput.
Definition at line 71 of file threadbase.h.
|
inlineprotectedvirtualinherited |
Virtual worker function called when the thread stops.
Reimplemented in Tuner, and AudioOutput.
Definition at line 87 of file threadbase.h.
|
inherited |
Get thread name.
Definition at line 132 of file threadbase.cpp.
|
inlineinherited |
Get verbosity level.
Definition at line 80 of file threadbase.h.
|
inlinevirtualinherited |
Virtual initialization function (no functionality here)
Reimplemented in Tuner, AudioOutput, and SoundGenerator.
Definition at line 70 of file threadbase.h.
|
inlineprotectedvirtualinherited |
Virtual worker function called when the thread is starting.
Reimplemented in Tuner, and AudioOutput.
Definition at line 85 of file threadbase.h.
|
inherited |
Return true if thread is running and not suspended.
Definition at line 136 of file threadbase.cpp.
|
protectedinherited |
Return true if the thread was requested to interrupt or terminate.
Definition at line 128 of file threadbase.cpp.
|
finaloverrideprivatevirtual |
Thread worker function, calling updateListOfDevices() of the audio object. This thread is executed at lowest possible priority.
Reimplemented from ThreadBase.
Definition at line 83 of file audiodeviceguard.cpp.
|
virtualinherited |
Resume from the suspend mode.
Restart the timer and clear the mSuspended flag
Reimplemented in MidiPlayer.
Definition at line 99 of file threadbase.cpp.
|
protectedinherited |
Set thread priority.
Definition at line 109 of file threadbase.cpp.
|
protectedinherited |
Set thread name (Linux only)
Definition at line 121 of file threadbase.cpp.
|
protectedinherited |
Set timer interval for the periodically called worker.
Definition at line 117 of file threadbase.cpp.
|
inherited |
Set verbosity level of messages.
Definition at line 113 of file threadbase.cpp.
|
virtualinherited |
Start the thread.
Starts the thread. If the thread is suspended it will resume. If the thread is already started the function does nothing.
Reimplemented in Tuner, and AudioOutput.
Definition at line 64 of file threadbase.cpp.
bool AudioDeviceGuard::startMonitoring | ( | int | seconds = 20 | ) |
Start the AudioDeviceGuard.
seconds | : Time interval in seconds for the update of the device list. |
Definition at line 66 of file audiodeviceguard.cpp.
|
virtualinherited |
Stop the thread.
Send a termination request to the execution loop. Wait for the thread to terminate. The active components of the thread should call isInterruptionRequested() and quit immediately if this function is true.
Reimplemented in MidiPlayer, AudioOutput, and Instrument.
Definition at line 152 of file threadbase.cpp.
|
virtualinherited |
Mark the thread as suspended.
Calling this function tells the thread that it has to wait in some sort of standby. Note that the thread itself is not terminated and that the event loop is still active. Calling this function stops the timer so that the periodicallyCalledWorker() is not active any more. In addition the mSuspended flag is set.
Reimplemented in MidiPlayer, and SoundGenerator.
Definition at line 84 of file threadbase.cpp.
|
private |
Pointer back to the audio object.
Definition at line 53 of file audiodeviceguard.h.