kwave  18.07.70
Kwave::PlayBackDevice Class Referenceabstract

#include <PlayBackDevice.h>

Inheritance diagram for Kwave::PlayBackDevice:
Inheritance graph
Collaboration diagram for Kwave::PlayBackDevice:
Collaboration graph

Public Member Functions

virtual ~PlayBackDevice ()
 
virtual QString open (const QString &device, double rate, unsigned int channels, unsigned int bits, unsigned int bufbase)=0
 
virtual int write (const Kwave::SampleArray &samples)=0
 
virtual int close ()=0
 
virtual QStringList supportedDevices ()
 
virtual QString fileFilter ()
 
virtual QList< unsigned int > supportedBits (const QString &device)=0
 
virtual int detectChannels (const QString &device, unsigned int &min, unsigned int &max)
 

Detailed Description

Abstract base class for all kinds of playback devices. It provides only a minimum of necessary functions, like opening/closing and writing samples.

Note
this class is not threadsafe on its own, it relies on the threadsafe implementation of the PlayBack plugin.
there aren no checks for avoiding close without open, opening twice or similar
there are no precautions to prevent duplicate instances

Definition at line 46 of file PlayBackDevice.h.

Constructor & Destructor Documentation

◆ ~PlayBackDevice()

virtual Kwave::PlayBackDevice::~PlayBackDevice ( )
inlinevirtual

Destructor

Definition at line 51 of file PlayBackDevice.h.

References close(), open(), and write().

51 {}
Here is the call graph for this function:

Member Function Documentation

◆ close()

virtual int Kwave::PlayBackDevice::close ( )
pure virtual

Closes the output device.

Implemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Referenced by Kwave::MultiPlaybackSink::~MultiPlaybackSink(), and ~PlayBackDevice().

Here is the caller graph for this function:

◆ detectChannels()

virtual int Kwave::PlayBackDevice::detectChannels ( const QString &  device,
unsigned int &  min,
unsigned int &  max 
)
inlinevirtual

Detect the minimum and maximum number of channels. If the detection fails, minimum and maximum are set to zero.

Parameters
devicefilename of the device
minreceives the lowest supported number of channels
maxreceives the highest supported number of channels
Returns
zero or positive number if ok, negative error number if failed

Reimplemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Definition at line 111 of file PlayBackDevice.h.

Referenced by Kwave::PlayBackDialog::setDevice().

113  {
114  (void)device;
115  return min = max = 0;
116  }
Here is the caller graph for this function:

◆ fileFilter()

virtual QString Kwave::PlayBackDevice::fileFilter ( )
inlinevirtual

return a string suitable for a "File Open..." dialog

Reimplemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Definition at line 90 of file PlayBackDevice.h.

References _, and supportedBits().

Referenced by Kwave::PlayBackDialog::setMethod().

90 { return _(""); }
#define _(m)
Definition: memcpy.c:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open()

virtual QString Kwave::PlayBackDevice::open ( const QString &  device,
double  rate,
unsigned int  channels,
unsigned int  bits,
unsigned int  bufbase 
)
pure virtual

Opens the device for playback.

Parameters
devicename of the output device, this might be a file name of a device or any user-defined string that tells the playback device where to write data.
rateplayback rate [samples/second]
channelsnumber of playback channels [1=mono, 2=stereo,...]
bitsresolution for output [bits/sample]
bufbaseexponent of the buffer size. The real buffer size will be (2 ^ bufbase) bytes.
Returns
zero-length string if successful, or an error message if failed

Implemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Referenced by Kwave::PlaybackController::openDevice(), and ~PlayBackDevice().

Here is the caller graph for this function:

◆ supportedBits()

virtual QList<unsigned int> Kwave::PlayBackDevice::supportedBits ( const QString &  device)
pure virtual

returns a list of supported bits per sample resolutions of a given device.

Parameters
devicefilename of the device
Returns
list of supported bits per sample, or empty on errors

Implemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Referenced by fileFilter(), and Kwave::PlayBackDialog::setDevice().

Here is the caller graph for this function:

◆ supportedDevices()

virtual QStringList Kwave::PlayBackDevice::supportedDevices ( )
inlinevirtual

return a string list with supported device names

Reimplemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Definition at line 85 of file PlayBackDevice.h.

Referenced by Kwave::PlayBackDialog::setDevice(), and Kwave::PlayBackDialog::setMethod().

85  {
86  return QStringList();
87  }
Here is the caller graph for this function:

◆ write()

virtual int Kwave::PlayBackDevice::write ( const Kwave::SampleArray samples)
pure virtual

Writes an array of samples to the output device. Each sample in the array is designated to one output channel.

Parameters
samplesarray of samples for output
Returns
0 if successful, or an error code if failed

Implemented in Kwave::PlayBackPulseAudio, Kwave::PlayBackQt, Kwave::PlayBackALSA, and Kwave::PlayBackOSS.

Referenced by Kwave::MultiPlaybackSink::input(), Kwave::PlaybackController::run_wrapper(), and ~PlayBackDevice().

Here is the caller graph for this function:

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