Abstract base class for audio devices exposed as a QIODevice.
More...
#include <AudioDevice.h>
|
| enum | Channel { Mono
, Left
, Right
, Both
} |
| | Audio channel selection used by the device. More...
|
|
| bool | initialize (OpenMode mode, Channel channel) |
| | Initialize the device for the specified open mode and channel.
|
| bool | isSequential () const override |
| | Whether this device exposes a sequential data stream.
|
| size_t | bytesPerFrame () const |
| | Number of bytes per audio frame for the current channel setting.
|
| Channel | channel () const |
| | Get the current channel selection used by this device.
|
|
|
| AudioDevice (QObject *parent=nullptr) |
| void | store (char const *source, size_t numFrames, qint16 *dest) |
| | Copy interleaved source samples into the destination buffer.
|
| qint16 * | load (qint16 const sample, qint16 *dest) |
| | Expand a sample value into the output buffer for the active channel.
|
Abstract base class for audio devices exposed as a QIODevice.
Subclasses implement concrete audio sinks/sources. AudioDevice offers channel selection helpers, frame size calculation and convenience routines to store/load interleaved sample frames.
◆ Channel
Audio channel selection used by the device.
These values are mapped to UI combobox indexes elsewhere; do not reorder or renumber them without updating the UI mappings.
◆ bytesPerFrame()
| size_t AudioDevice::bytesPerFrame |
( |
| ) |
const |
|
inline |
Number of bytes per audio frame for the current channel setting.
For mono devices this equals the sample size; for stereo it is double.
◆ channel()
| Channel AudioDevice::channel |
( |
| ) |
const |
|
inline |
Get the current channel selection used by this device.
The channel determines how interleaved frames are interpreted when storing and loading samples (Mono, Left, Right, or Both).
- Returns
- The active Channel value used for store/load operations.
◆ fromString()
| Channel AudioDevice::fromString |
( |
QString const & | str | ) |
|
|
inlinestatic |
Convert a channel label into an AudioDevice channel value.
- Parameters
-
- Returns
- Matching Channel enum value.
◆ initialize()
| bool AudioDevice::initialize |
( |
OpenMode | mode, |
|
|
Channel | channel ) |
Initialize the device for the specified open mode and channel.
- Parameters
-
| mode | QIODevice open mode (ReadOnly/WriteOnly/etc). |
| channel | Channel selection to use. |
- Returns
- true on successful initialization.
◆ isSequential()
| bool AudioDevice::isSequential |
( |
| ) |
const |
|
inlineoverride |
Whether this device exposes a sequential data stream.
Returns true to indicate the device behaves as a sequential QIODevice (no random access). Consumers should treat the device as a stream of sample data and avoid relying on seeking.
- Returns
- true when the device is sequential.
◆ load()
| qint16 * AudioDevice::load |
( |
qint16 const | sample, |
|
|
qint16 * | dest ) |
|
inlineprotected |
Expand a sample value into the output buffer for the active channel.
- Parameters
-
| sample | Input sample value. |
| dest | Output buffer to fill. |
- Returns
- Updated buffer pointer.
◆ store()
| void AudioDevice::store |
( |
char const * | source, |
|
|
size_t | numFrames, |
|
|
qint16 * | dest ) |
|
inlineprotected |
Copy interleaved source samples into the destination buffer.
- Parameters
-
| source | Source data buffer. |
| numFrames | Number of frames to copy. |
| dest | Destination sample buffer. |
The documentation for this class was generated from the following files: