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 Class Referenceabstract

Abstract base class for audio interfaces. More...

#include <audiobase.h>

+ Inheritance diagram for AudioBase:

Public Types

typedef double PCMDataType
 
typedef std::vector< PCMDataTypePacketType
 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...
 

Detailed Description

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.

See also
AudioRecorderAdapter and AudioPlayerAdapter

Definition at line 43 of file audiobase.h.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

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.

virtual AudioBase::~AudioBase ( )
inlinevirtual

Destructor (no functionality).

Definition at line 55 of file audiobase.h.

Member Function Documentation

virtual void AudioBase::exit ( )
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).

Returns
mChannelCount

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.

Returns
mAudioDeviceName.

Definition at line 52 of file audiobase.cpp.

int AudioBase::getSamplingRate ( ) const

Get the actual sampling rate.

Returns
mSamplingRate

Definition at line 78 of file audiobase.cpp.

virtual void AudioBase::init ( )
pure virtual

Inizialize the audio device.

Implemented in AudioRecorderForQt, and AudioPlayerForQt.

void AudioBase::setChannelCount ( int  cnt)
virtual

Set the number of channels (1=mono, 2=stereo).

Parameters
cnt: number of channels

Definition at line 122 of file audiobase.cpp.

void AudioBase::setDeviceName ( const std::string &  n)

Set the device name.

Parameters
n: Name of the audio device.

Definition at line 65 of file audiobase.cpp.

void AudioBase::setSamplingRate ( int  rate)
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.

Parameters
rate: New sampling rate to be used.

Reimplemented in AudioRecorderAdapter.

Definition at line 96 of file audiobase.cpp.

virtual void AudioBase::start ( )
pure virtual

Start/restart the audio device.

Implemented in AudioRecorderForQt, and AudioPlayerForQt.

virtual void AudioBase::stop ( )
pure virtual

Stop the audio device.

Implemented in AudioRecorderForQt, and AudioPlayerForQt.

Member Data Documentation

std::string AudioBase::mAudioDeviceName
private

User-readable string of the used audio device.

Definition at line 71 of file audiobase.h.

int AudioBase::mChannelCount
private

Current channel count.

Definition at line 73 of file audiobase.h.

int AudioBase::mSamplingRate
private

Current sampling rate.

Definition at line 72 of file audiobase.h.


The documentation for this class was generated from the following files: