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
AudioPlayerAdapter Class Reference

Abstract adapter class for PCM-based audio output drivers. More...

#include <audioplayeradapter.h>

+ Inheritance diagram for AudioPlayerAdapter:
+ Collaboration diagram for AudioPlayerAdapter:

Public Member Functions

 AudioPlayerAdapter ()
 Constructor, resetting default values. More...
 
virtual ~AudioPlayerAdapter ()
 Destructor without functionality. More...
 
virtual void exit () override
 Destroy the audio device. More...
 
void setWriter (PCMWriterInterface *interface)
 Connect the audio adapter to a PCM writer interface. More...
 
PCMWriterInterfacegetWriter ()
 Get pointer to the PCM writer. More...
 
void setMuted (bool muted)
 Mute the audio player. More...
 
bool isMuted ()
 Returns true if the player is muted. More...
 
- Public Member Functions inherited from AudioBase
 AudioBase ()
 Constructor. More...
 
virtual ~AudioBase ()
 Destructor (no functionality). More...
 
virtual void init ()=0
 Inizialize 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

PCMWriterInterfacemPCMWriter
 Pointer to PCM writer. More...
 
bool mMuted
 Flag which is true if the ouput device muted. More...
 

Additional Inherited Members

- Public Types inherited from AudioBase
typedef double PCMDataType
 
typedef std::vector< PCMDataTypePacketType
 Type definition of a PCM packet (vector of PCM values). More...
 

Detailed Description

Abstract adapter class for PCM-based audio output drivers.

This class has to be implemented by the actual sound system. In the EPT this is the AudioPlayerForQt

Note that the sound-producing component (the EPT synthesizer) does not call the audio player by itself to deliver data, instead the AudioPlayer manages the workflow and requests data from the sound-producing component.

To establish this mechanism the sound-producing component (the synthesizer) has to be derived from an abstract class called PCMWriterInterface. The request is carried out by calling a function named generateAudioPacket which is defined virtually in the PCMWriterInterface.

See also
AudioPlayerForQt
PCMWriterInterface

The present class does nothing but holding a pointer to the PCMWriterInterface. In addition it handels a mute flag.

Definition at line 50 of file audioplayeradapter.h.

Constructor & Destructor Documentation

AudioPlayerAdapter::AudioPlayerAdapter ( )

Constructor, resetting default values.

Definition at line 30 of file audioplayeradapter.cpp.

+ Here is the call graph for this function:

virtual AudioPlayerAdapter::~AudioPlayerAdapter ( )
inlinevirtual

Destructor without functionality.

Definition at line 54 of file audioplayeradapter.h.

Member Function Documentation

void AudioPlayerAdapter::exit ( )
overridevirtual

Destroy the audio device.

Implements AudioBase.

Reimplemented in AudioPlayerForQt.

Definition at line 37 of file audioplayeradapter.cpp.

+ Here is the call graph for this function:

PCMWriterInterface* AudioPlayerAdapter::getWriter ( )
inline

Get pointer to the PCM writer.

Definition at line 59 of file audioplayeradapter.h.

bool AudioPlayerAdapter::isMuted ( )
inline

Returns true if the player is muted.

Definition at line 62 of file audioplayeradapter.h.

void AudioPlayerAdapter::setMuted ( bool  muted)
inline

Mute the audio player.

Definition at line 61 of file audioplayeradapter.h.

void AudioPlayerAdapter::setWriter ( PCMWriterInterface interface)

Connect the audio adapter to a PCM writer interface.

The writer interface is a software component that produces sound. In the EPT, the only component producing sound is the Synthesizer.

Parameters
interface: Pointer to the PCM writer interface to be connected.

Definition at line 55 of file audioplayeradapter.cpp.

+ Here is the call graph for this function:

Member Data Documentation

bool AudioPlayerAdapter::mMuted
private

Flag which is true if the ouput device muted.

Definition at line 65 of file audioplayeradapter.h.

PCMWriterInterface* AudioPlayerAdapter::mPCMWriter
private

Pointer to PCM writer.

Definition at line 64 of file audioplayeradapter.h.


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