Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
audiobase.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner 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  * Entropy Piano Tuner 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 for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. 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 
35 
37  : mAudioDeviceName("unknown"),
38  mSamplingRate(44100),
39  mChannelCount(1)
40 {}
41 
42 
43 //-----------------------------------------------------------------------------
44 // Get the device name
45 //-----------------------------------------------------------------------------
46 
51 
52 const std::string &AudioBase::getDeviceName() const
53 { return mAudioDeviceName; }
54 
55 
56 //-----------------------------------------------------------------------------
57 // Set the device name
58 //-----------------------------------------------------------------------------
59 
64 
65 void AudioBase::setDeviceName(const std::string &n)
66 { mAudioDeviceName = n; }
67 
68 
69 //-----------------------------------------------------------------------------
70 // Get the actual sampling rate
71 //-----------------------------------------------------------------------------
72 
77 
79 { return mSamplingRate; }
80 
81 
82 //-----------------------------------------------------------------------------
83 // Set sampling rate
84 //-----------------------------------------------------------------------------
85 
95 
97 { mSamplingRate = rate; }
98 
99 
100 //-----------------------------------------------------------------------------
101 // Get number of channels
102 //-----------------------------------------------------------------------------
103 
108 
110 { return mChannelCount; }
111 
112 
113 //-----------------------------------------------------------------------------
114 // Set number of channels
115 //-----------------------------------------------------------------------------
116 
121 
123 { mChannelCount = cnt; }
124 
AudioBase()
Constructor.
Definition: audiobase.cpp:36
std::string mAudioDeviceName
User-readable string of the used audio device.
Definition: audiobase.h:71
const std::string & getDeviceName() const
Get a readable string of the name of the audio device.
Definition: audiobase.cpp:52
void setDeviceName(const std::string &n)
Set the device name.
Definition: audiobase.cpp:65
int getChannelCount() const
Get the actual number of channels (1=mono, 2=stereo).
Definition: audiobase.cpp:109
virtual void setChannelCount(int cnt)
Set the number of channels (1=mono, 2=stereo).
Definition: audiobase.cpp:122
int getSamplingRate() const
Get the actual sampling rate.
Definition: audiobase.cpp:78
int mChannelCount
Current channel count.
Definition: audiobase.h:73
int mSamplingRate
Current sampling rate.
Definition: audiobase.h:72
virtual void setSamplingRate(int rate)
Allow the implementation to change the sampling rate during operation.
Definition: audiobase.cpp:96