Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
20 //=============================================================================
21 // Abstract base class for audio input and output
22 //=============================================================================
30 #ifndef AUDIOBASE_H
31 #define AUDIOBASE_H
33 #include <QMutex>
34 #include <QAudioDeviceInfo>
36 #include "audioparameters.h"
37 #include "system/threadbase.h"
39 //=============================================================================
40 // Audio Base Class
41 //=============================================================================
52 class AudioBase : public ThreadBase
53 {
55 public:
56  AudioBase();
63  void setActualParameters (const AudioParameters &parameters);
65  void setWantedParameters (const AudioParameters &parameters);
68  virtual void updateListOfDevices() = 0;
70  QStringList getListOfDevices() const { return mAudioDeviceNames; }
72 public slots:
75  virtual void connectDevice (const bool active) = 0;
77 signals:
79  void onAudioDevicesAdded(const QStringList &devices);
81  void onAudioDevicesRemoved(const QStringList &devices);
83  void onChangeOfAvailableAudioDevices(const QStringList &devices);
87  void onConnectionSuccessfullyEstablished (bool success);
89 private:
92  mutable QMutex mAudioParameterMutex;
93 protected:
94  QStringList mAudioDeviceNames;
95 };
97 #endif // AUDIOBASE_H
QMutex mAudioParameterMutex
Access mutex.
Definition: audiobase.h:92
Universal base class for threaded modules.
Definition: threadbase.h:60
virtual void updateListOfDevices()=0
Update the list of devices, called by the DeviceGuard.
Definition: audiobase.cpp:34
void onConnectionSuccessfullyEstablished(bool success)
Signal indicating that successful of failed connection.
void onAudioDevicesRemoved(const QStringList &devices)
Signal indicating that an audio device has been removed.
Structure holding the parameters and status of an audio device.
const AudioParameters getActualDeviceParameters() const
Get the actual audio device parameters.
Definition: audiobase.cpp:55
void onChangeOfAvailableAudioDevices(const QStringList &devices)
Signal indicating that the list of available devices has been changed.
void onAudioDevicesAdded(const QStringList &devices)
Signal indicating that a new audio device was plugged in (e.g. a USB headphone)
virtual void connectDevice(const bool active)=0
AudioParameters mActualDeviceParameters
Actual device parameters.
Definition: audiobase.h:91
QStringList mAudioDeviceNames
Current list of devices.
Definition: audiobase.h:94
AudioParameters mWantedDeviceParameters
Structure holding the device parameters.
Definition: audiobase.h:90
void onCurrentDeviceParametersChanged()
Signal indicating that the actually used audio device has changed.
void setWantedParameters(const AudioParameters &parameters)
Set the wanted audio device parameters.
Definition: audiobase.cpp:100
QStringList getListOfDevices() const
Get the current list of devices from the last update.
Definition: audiobase.h:70
void setActualParameters(const AudioParameters &parameters)
Set the actual audio device parameters.
Definition: audiobase.cpp:85
const AudioParameters getWantedDeviceParameters() const
Get the intended audio device parameters.
Definition: audiobase.cpp:70
Abstract base class for audio input and output.
Definition: audiobase.h:52