Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
audiobase.cpp
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  *****************************************************************************/
19 
20 //=============================================================================
21 // Audio base class
22 //=============================================================================
23 
24 #include "audiobase.h"
25 
26 //-----------------------------------------------------------------------------
27 // Constructor
28 //-----------------------------------------------------------------------------
29 
33 
35  : mWantedDeviceParameters()
36  , mActualDeviceParameters()
37  , mAudioParameterMutex()
38  , mAudioDeviceNames()
39 {
40  setModuleName("Audio");
41  setPriority(QThread::HighPriority);
42 
43  // Thread name is set in the derived class
44 }
45 
46 
47 //-----------------------------------------------------------------------------
48 // Get actual device parameters
49 //-----------------------------------------------------------------------------
54 
56 {
57  QMutexLocker lock(&mAudioParameterMutex);
59 }
60 
61 
62 //-----------------------------------------------------------------------------
63 // Get the wanted device parameters
64 //-----------------------------------------------------------------------------
69 
71 {
72  QMutexLocker lock(&mAudioParameterMutex);
74 }
75 
76 
77 //-----------------------------------------------------------------------------
78 // Set actual parameters
79 //-----------------------------------------------------------------------------
84 
86 {
87  QMutexLocker lock(&mAudioParameterMutex);
88  mActualDeviceParameters = parameters;
89 }
90 
91 
92 //-----------------------------------------------------------------------------
93 // Set wanted parameters
94 //-----------------------------------------------------------------------------
99 
101 {
102  QMutexLocker lock(&mAudioParameterMutex);
103  mWantedDeviceParameters = parameters;
104 }
105 
106 
QMutex mAudioParameterMutex
Access mutex.
Definition: audiobase.h:92
void setModuleName(const QString &name)
Specify the name of the class-specific module.
Definition: log.cpp:82
void setPriority(const QThread::Priority p)
Set thread priority.
Definition: threadbase.cpp:109
AudioBase()
Constructor.
Definition: audiobase.cpp:34
Structure holding the parameters and status of an audio device.
const AudioParameters getActualDeviceParameters() const
Get the actual audio device parameters.
Definition: audiobase.cpp:55
AudioParameters mActualDeviceParameters
Actual device parameters.
Definition: audiobase.h:91
AudioParameters mWantedDeviceParameters
Structure holding the device parameters.
Definition: audiobase.h:90
void setWantedParameters(const AudioParameters &parameters)
Set the wanted audio device parameters.
Definition: audiobase.cpp:100
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