Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
|
Class for audio output. More...
#include <audiooutput.h>
Public Slots | |
void | connectDevice (const bool active) override final |
Connect the audio output to a device (e.g. soundcard) with a given set of device parameters. More... | |
Signals | |
void | onAudioDevicesAdded (const QStringList &devices) |
Signal indicating that a new audio device was plugged in (e.g. a USB headphone) More... | |
void | onAudioDevicesRemoved (const QStringList &devices) |
Signal indicating that an audio device has been removed. More... | |
void | onChangeOfAvailableAudioDevices (const QStringList &devices) |
Signal indicating that the list of available devices has been changed. More... | |
void | onCurrentDeviceParametersChanged () |
Signal indicating that the actually used audio device has changed. More... | |
void | onConnectionSuccessfullyEstablished (bool success) |
Signal indicating that successful of failed connection. More... | |
Public Member Functions | |
AudioOutput () | |
Constructor. More... | |
virtual bool | init () override |
Init audio device. More... | |
virtual bool | start () override |
Start audio device. More... | |
virtual bool | stop () override |
Stop audio device. More... | |
virtual bool | exit () override |
Exit audio device. More... | |
virtual void | initiallyCalledWorker () override final |
Initially called worker function. More... | |
virtual void | finallyCalledWorker () override final |
Virtual worker function called when the thread stops. More... | |
void | setAudioGenerator (AudioGenerator &generator) |
Select an AudioGenerator for output. More... | |
AudioGenerator * | getAudioGenerator () const |
void | updateListOfDevices () override final |
Update the list of devices. More... | |
void | setVolume (double volume) |
Set the global volume of the audio device. More... | |
void | setActualParameters (const AudioParameters &p) |
Set audio device parameters (thread safe) More... | |
void | setDefaultBufferSize (int n) |
const AudioParameters | getActualDeviceParameters () const |
Get the actual audio device parameters. More... | |
const AudioParameters | getWantedDeviceParameters () const |
Get the intended audio device parameters. More... | |
void | setWantedParameters (const AudioParameters ¶meters) |
Set the wanted audio device parameters. More... | |
QStringList | getListOfDevices () const |
Get the current list of devices from the last update. 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 | periodicallyCalledWorker () |
Virtual worker function called periodically from the timer. 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... | |
Protected Attributes | |
int | mDefaultBufferSize |
Default audio buffer size. More... | |
QStringList | mAudioDeviceNames |
Current list of devices. More... | |
Private Attributes | |
AudioOutputDevice | mAudioOutputDevice |
Instance of the device. More... | |
AudioGenerator | defaultGenerator |
Default sine generator. More... | |
AudioGenerator * | pAudioGenerator |
Pointer to synthesizer. More... | |
AudioDeviceGuard | mAudioDeviceGuard |
Audio device guard. More... | |
QSettings | mSettings |
Settings object. More... | |
Class for audio output.
This is the principal class providing the user interface for audio output. It is derived from AudioBase which holds the device parameters and instantiates a private AudioOutputThread. The interface is activated by calling connect with the wanted parameters. Moreover, the class allows the user to connect an AudioGenerator (a sound-generating unit such as a synthesizer), passing this request to the AudioOutputThread.
Definition at line 45 of file audiooutput.h.
AudioOutput::AudioOutput | ( | ) |
Constructor.
The constructor connects the audio output with a default testtone generator.
Definition at line 35 of file audiooutput.cpp.
|
finaloverrideslot |
Connect the audio output to a device (e.g. soundcard) with a given set of device parameters.
The device parameters will be stored as mWantedDeviceParameters so that this information is available when entering the worker function run(). Moreover, the audio device thread is started with high priority.
active | : connect=true, disconnect=false |
Definition at line 191 of file audiooutput.cpp.
|
overridevirtual |
Exit audio device.
Reimplemented from ThreadBase.
Definition at line 128 of file audiooutput.cpp.
|
finaloverridevirtual |
Virtual worker function called when the thread stops.
Reimplemented from ThreadBase.
Definition at line 101 of file audiooutput.cpp.
|
inherited |
Get the actual audio device parameters.
Get the actual audio device parameters (thread safe)
Definition at line 55 of file audiobase.cpp.
|
inline |
|
inlineinherited |
Get the current list of devices from the last update.
Definition at line 70 of file audiobase.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.
|
inherited |
Get the intended audio device parameters.
Get the wanted audio device parameters (thread safe)
Definition at line 70 of file audiobase.cpp.
|
overridevirtual |
Init audio device.
Reimplemented from ThreadBase.
Definition at line 54 of file audiooutput.cpp.
|
finaloverridevirtual |
Initially called worker function.
Start the audio device and connect with the last set of parameters
Reimplemented from ThreadBase.
Definition at line 87 of file audiooutput.cpp.
|
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.
|
signalinherited |
Signal indicating that a new audio device was plugged in (e.g. a USB headphone)
|
signalinherited |
Signal indicating that an audio device has been removed.
|
signalinherited |
Signal indicating that the list of available devices has been changed.
|
signalinherited |
Signal indicating that successful of failed connection.
|
signalinherited |
Signal indicating that the actually used audio device has changed.
|
inlineprotectedvirtualinherited |
Virtual worker function called periodically from the timer.
Reimplemented in Tuner, and AudioDeviceGuard.
Definition at line 89 of file threadbase.h.
|
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.
void AudioOutput::setActualParameters | ( | const AudioParameters & | p | ) |
Set audio device parameters (thread safe)
Set the audio parameters for the device, inform the AudioGenerator (the synthesizer) about the new parameter, and call a function that updates the GUI.
Definition at line 167 of file audiooutput.cpp.
void AudioOutput::setAudioGenerator | ( | AudioGenerator & | generator | ) |
Select an AudioGenerator for output.
The AudioOutput can be connected with a sound-generating module subclassed from AudioGenerator. This is usually the synthesizer or the sampler in the application. Only one generator can be connected at a given time. Call this function to change the generator.
generator | : Reference to the AudioGenerator |
Definition at line 148 of file audiooutput.cpp.
|
inline |
|
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.
void AudioOutput::setVolume | ( | double | volume | ) |
Set the global volume of the audio device.
volume | : Volume between 0 and 1 |
Definition at line 285 of file audiooutput.cpp.
|
inherited |
Set the wanted audio device parameters.
Set wanted audio device parameters (thread safe)
parameters | : Reference to the device parameters |
Definition at line 100 of file audiobase.cpp.
|
overridevirtual |
Start audio device.
Start the audio device and connect with the last set of parameters
Reimplemented from ThreadBase.
Definition at line 69 of file audiooutput.cpp.
|
overridevirtual |
Stop audio device.
Reimplemented from ThreadBase.
Definition at line 113 of file audiooutput.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.
|
finaloverridevirtual |
|
private |
Default sine generator.
Definition at line 71 of file audiooutput.h.
|
private |
Audio device guard.
Definition at line 73 of file audiooutput.h.
|
protectedinherited |
Current list of devices.
Definition at line 94 of file audiobase.h.
|
private |
Instance of the device.
Definition at line 70 of file audiooutput.h.
|
protected |
Default audio buffer size.
Definition at line 77 of file audiooutput.h.
|
private |
Settings object.
Definition at line 74 of file audiooutput.h.
|
private |
Pointer to synthesizer.
Definition at line 72 of file audiooutput.h.