Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Abstract base class for audio interfaces. More...
#include <audiobase.h>
Public Types | |
typedef double | PCMDataType |
typedef std::vector< PCMDataType > | PacketType |
Type definition of a PCM packet (vector of PCM values). More... | |
Public Member Functions | |
AudioBase () | |
Constructor. More... | |
virtual | ~AudioBase () |
Destructor (no functionality). More... | |
virtual void | init ()=0 |
Inizialize the audio device. More... | |
virtual void | exit ()=0 |
Destroy the audio device. More... | |
virtual void | start ()=0 |
Start/restart the audio device. More... | |
virtual void | stop ()=0 |
Stop the audio device. More... | |
const std::string & | getDeviceName () const |
Get a readable string of the name of the audio device. More... | |
void | setDeviceName (const std::string &n) |
Set the device name. More... | |
int | getSamplingRate () const |
Get the actual sampling rate. More... | |
virtual void | setSamplingRate (int rate) |
Allow the implementation to change the sampling rate during operation. More... | |
int | getChannelCount () const |
Get the actual number of channels (1=mono, 2=stereo). More... | |
virtual void | setChannelCount (int cnt) |
Set the number of channels (1=mono, 2=stereo). More... | |
Private Attributes | |
std::string | mAudioDeviceName |
User-readable string of the used audio device. More... | |
int | mSamplingRate |
Current sampling rate. More... | |
int | mChannelCount |
Current channel count. More... | |
Abstract base class for audio interfaces.
This class defines the basics properties of an audio input or output interface. It defines the sampling rate, the number of used channels and the name of the audio device. Moreover, it defines the basic data type used by the EPT to represent PCM audio signals.
Definition at line 43 of file audiobase.h.
typedef std::vector<PCMDataType> AudioBase::PacketType |
Type definition of a PCM packet (vector of PCM values).
Definition at line 51 of file audiobase.h.
typedef double AudioBase::PCMDataType |
Floating point data type for a single PCM Value. The PCM values are assumed to be in [-1,1].
Definition at line 48 of file audiobase.h.
AudioBase::AudioBase | ( | ) |
Constructor.
The constructor initializes the default values for the default sampling rate (44100) and the channels count (1). The device name is set to "unknown".
Definition at line 36 of file audiobase.cpp.
|
inlinevirtual |
Destructor (no functionality).
Definition at line 55 of file audiobase.h.
|
pure virtual |
Destroy the audio device.
Implemented in AudioPlayerAdapter, AudioRecorderForQt, and AudioPlayerForQt.
int AudioBase::getChannelCount | ( | ) | const |
Get the actual number of channels (1=mono, 2=stereo).
Definition at line 109 of file audiobase.cpp.
const std::string & AudioBase::getDeviceName | ( | ) | const |
Get a readable string of the name of the audio device.
Definition at line 52 of file audiobase.cpp.
int AudioBase::getSamplingRate | ( | ) | const |
|
pure virtual |
Inizialize the audio device.
Implemented in AudioRecorderForQt, and AudioPlayerForQt.
|
virtual |
Set the number of channels (1=mono, 2=stereo).
cnt | : number of channels |
Definition at line 122 of file audiobase.cpp.
void AudioBase::setDeviceName | ( | const std::string & | n | ) |
Set the device name.
n | : Name of the audio device. |
Definition at line 65 of file audiobase.cpp.
|
virtual |
Allow the implementation to change the sampling rate during operation.
Some audio devices do not support arbitrary sampling rates. Therefore, the actual implementation of the audio device should be able to change the sampling rate if necessary. This function stores the new sampling rate in the local member variable.
rate | : New sampling rate to be used. |
Reimplemented in AudioRecorderAdapter.
Definition at line 96 of file audiobase.cpp.
|
pure virtual |
Start/restart the audio device.
Implemented in AudioRecorderForQt, and AudioPlayerForQt.
|
pure virtual |
Stop the audio device.
Implemented in AudioRecorderForQt, and AudioPlayerForQt.
|
private |
User-readable string of the used audio device.
Definition at line 71 of file audiobase.h.
|
private |
Current channel count.
Definition at line 73 of file audiobase.h.
|
private |
Current sampling rate.
Definition at line 72 of file audiobase.h.