kwave
18.07.70
|
#include <PlayBack-Qt.h>
Classes | |
class | Buffer |
Public Member Functions | |
PlayBackQt () | |
virtual | ~PlayBackQt () Q_DECL_OVERRIDE |
virtual QString | open (const QString &device, double rate, unsigned int channels, unsigned int bits, unsigned int bufbase) Q_DECL_OVERRIDE |
virtual int | write (const Kwave::SampleArray &samples) Q_DECL_OVERRIDE |
virtual int | close () Q_DECL_OVERRIDE |
virtual QStringList | supportedDevices () Q_DECL_OVERRIDE |
virtual QString | fileFilter () Q_DECL_OVERRIDE |
virtual QList< unsigned int > | supportedBits (const QString &device) Q_DECL_OVERRIDE |
virtual int | detectChannels (const QString &device, unsigned int &min, unsigned int &max) Q_DECL_OVERRIDE |
![]() | |
virtual | ~PlayBackDevice () |
Private Slots | |
void | stateChanged (QAudio::State state) |
Private Member Functions | |
void | createEncoder (const QAudioFormat &format) |
void | scanDevices () |
QAudioDeviceInfo | deviceInfo (const QString &device) const |
Private Attributes | |
QMutex | m_lock |
QMap< QString, QString > | m_device_name_map |
QList< QAudioDeviceInfo > | m_available_devices |
QAudioOutput * | m_output |
unsigned int | m_buffer_size |
Kwave::SampleEncoder * | m_encoder |
Kwave::PlayBackQt::Buffer | m_buffer |
Definition at line 47 of file PlayBack-Qt.h.
Kwave::PlayBackQt::PlayBackQt | ( | ) |
Default constructor
Definition at line 44 of file PlayBack-Qt.cpp.
|
virtual |
Destructor
Definition at line 56 of file PlayBack-Qt.cpp.
References close().
|
virtual |
Closes the output device.
Implements Kwave::PlayBackDevice.
Definition at line 305 of file PlayBack-Qt.cpp.
References Kwave::PlayBackQt::Buffer::bytesAvailable(), Kwave::PlayBackQt::Buffer::drain(), Kwave::SampleEncoder::encode(), m_available_devices, m_buffer, m_device_name_map, m_encoder, m_lock, m_output, and Kwave::PlayBackQt::Buffer::stop().
Referenced by open(), Kwave::PlayBackQt::Buffer::stop(), and ~PlayBackQt().
|
private |
creates a sample encoder for playback, for linear formats
format | the preferred format of the audio output device |
Definition at line 62 of file PlayBack-Qt.cpp.
References Kwave::BigEndian, Kwave::LittleEndian, m_encoder, Kwave::SampleFormat::Signed, Kwave::SampleFormat::Unknown, Kwave::UnknownEndian, and Kwave::SampleFormat::Unsigned.
Referenced by open().
|
virtual |
Detect the minimum and maximum number of channels. If the detection fails, minimum and maximum are set to zero.
device | filename of the device |
min | receives the lowest supported number of channels |
max | receives the highest supported number of channels |
Reimplemented from Kwave::PlayBackDevice.
Definition at line 435 of file PlayBack-Qt.cpp.
References deviceInfo(), m_lock, and Kwave::toUint().
|
private |
Gets the full device info of a playback device, identified by the device name.
device | name of the device or empty string for default |
Definition at line 282 of file PlayBack-Qt.cpp.
References DEFAULT_DEVICE, m_available_devices, and m_device_name_map.
Referenced by detectChannels(), open(), and supportedBits().
|
virtual |
return a string suitable for a "File Open..." dialog
Reimplemented from Kwave::PlayBackDevice.
Definition at line 408 of file PlayBack-Qt.cpp.
References _.
|
virtual |
Opens the device for playback.
Implements Kwave::PlayBackDevice.
Definition at line 118 of file PlayBack-Qt.cpp.
References _, close(), Kwave::connect(), createEncoder(), DBG, deviceInfo(), m_buffer, m_buffer_size, m_encoder, m_lock, m_output, Kwave::SampleEncoder::rawBytesPerSample(), scanDevices(), Kwave::PlayBackQt::Buffer::setTimeout(), Kwave::PlayBackQt::Buffer::start(), stateChanged(), Kwave::toInt(), and Kwave::toUint().
Referenced by Kwave::PlayBackQt::Buffer::start().
|
private |
scan all Qt audio output devices, re-creates m_device_list
Definition at line 374 of file PlayBack-Qt.cpp.
References _, DBG, m_available_devices, and m_device_name_map.
Referenced by open(), and supportedDevices().
|
privateslot |
connected to the audio output device and gets notified in case of state changes like start/stop of the stream or errors.
state | the new device state, like active, stopped, idle etc. |
Definition at line 247 of file PlayBack-Qt.cpp.
References m_output.
Referenced by open().
|
virtual |
returns a list of supported bits per sample resolutions of a given device.
device | filename of the device |
Implements Kwave::PlayBackDevice.
Definition at line 414 of file PlayBack-Qt.cpp.
References deviceInfo(), m_lock, and Kwave::toUint().
|
virtual |
return a string list with supported device names
Reimplemented from Kwave::PlayBackDevice.
Definition at line 354 of file PlayBack-Qt.cpp.
References _, DEFAULT_DEVICE, m_available_devices, m_device_name_map, m_lock, and scanDevices().
|
virtual |
Writes an array of samples to the output device.
Implements Kwave::PlayBackDevice.
Definition at line 219 of file PlayBack-Qt.cpp.
References Kwave::SampleEncoder::encode(), m_buffer, m_encoder, m_lock, m_output, Kwave::SampleEncoder::rawBytesPerSample(), Kwave::SampleArray::size(), and Kwave::PlayBackQt::Buffer::writeData().
|
private |
list of available Qt output devices
Definition at line 231 of file PlayBack-Qt.h.
Referenced by close(), deviceInfo(), scanDevices(), and supportedDevices().
|
private |
Definition at line 242 of file PlayBack-Qt.h.
|
private |
|
private |
dictionary for translating verbose device names into Qt audio output device names (key = verbose name, data = Qt output device name)
Definition at line 228 of file PlayBack-Qt.h.
Referenced by close(), deviceInfo(), scanDevices(), and supportedDevices().
|
private |
encoder for converting from samples to raw format
Definition at line 240 of file PlayBack-Qt.h.
Referenced by close(), createEncoder(), open(), and write().
|
private |
mutex for locking the streaming thread against main thread
Definition at line 221 of file PlayBack-Qt.h.
Referenced by close(), detectChannels(), open(), supportedBits(), supportedDevices(), and write().
|
private |
Qt audio output instance
Definition at line 234 of file PlayBack-Qt.h.
Referenced by close(), open(), stateChanged(), and write().