A specialized I/O device that bridges raw signal data to the audio hardware.
More...
#include <xyseriesiodevice.h>
|
| | XYSeriesIODevice (QObject *parent=nullptr) |
| | Constructs the I/O device.
|
| virtual | ~XYSeriesIODevice ()=default |
| | Virtual destructor. Explicitly defaulted to ensure safe polymorphic deletion of derived classes.
|
| | XYSeriesIODevice (const XYSeriesIODevice &)=delete |
| | Deleted copy constructor to prevent accidental duplication of the audio stream.
|
| XYSeriesIODevice & | operator= (const XYSeriesIODevice &)=delete |
| | Deleted assignment operator to enforce unique ownership of the I/O state.
|
| void | updateTable (const std::vector< float > &data) |
| | Loads new PCM data into the internal lookup table.
|
| void | setFrequency (float hz) |
| | Sets the fundamental frequency for the Waveform synthesis mode.
|
| qint64 | readData (char *data, qint64 maxlen) override |
| | Core audio callback used by the Qt Audio engine.
|
| qint64 | writeData (const char *, qint64) override |
| | Placeholder for write operations; always returns 0.
|
| bool | isSequential () const override |
| | Indicates that this is a continuous audio stream.
|
| void | setPlayMode (PlayMode mode) |
| | Toggles between the available playback engines.
|
| PlayMode | getPlayMode () const |
| | Returns the current playback mode.
|
| float | getCurrentPhase () const |
| | Returns the current oscillator phase [0, tableSize].
|
| qint64 | getCurrentWavIndex () const |
| | Returns the current sample index in WavFile mode.
|
A specialized I/O device that bridges raw signal data to the audio hardware.
This class implements a real-time playback engine designed for the PS-80 GrandComp. It manages two distinct operational modes: periodic waveform synthesis (oscillation) and linear WAV file streaming.
◆ PlayMode
Operational states for the audio engine.
| Enumerator |
|---|
| Waveform | Oscillator mode: Loops the extracted single-cycle.
|
| WavFile | 1:1 Playback mode: Streams the original source data.
|
◆ XYSeriesIODevice() [1/2]
| XYSeriesIODevice::XYSeriesIODevice |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
Constructs the I/O device.
Constructs the device and prepares the I/O interface.
- Parameters
-
- The device is opened in ReadOnly mode to interface with the Qt Audio output.
◆ ~XYSeriesIODevice()
| virtual XYSeriesIODevice::~XYSeriesIODevice |
( |
| ) |
|
|
virtualdefault |
Virtual destructor. Explicitly defaulted to ensure safe polymorphic deletion of derived classes.
◆ XYSeriesIODevice() [2/2]
Deleted copy constructor to prevent accidental duplication of the audio stream.
◆ getCurrentPhase()
| float XYSeriesIODevice::getCurrentPhase |
( |
| ) |
const |
|
inline |
Returns the current oscillator phase [0, tableSize].
◆ getCurrentWavIndex()
| qint64 XYSeriesIODevice::getCurrentWavIndex |
( |
| ) |
const |
|
inline |
Returns the current sample index in WavFile mode.
◆ getPlayMode()
| PlayMode XYSeriesIODevice::getPlayMode |
( |
| ) |
const |
|
inline |
Returns the current playback mode.
◆ isSequential()
| bool XYSeriesIODevice::isSequential |
( |
| ) |
const |
|
inlineoverride |
Indicates that this is a continuous audio stream.
◆ operator=()
Deleted assignment operator to enforce unique ownership of the I/O state.
◆ readData()
| qint64 XYSeriesIODevice::readData |
( |
char * | data, |
|
|
qint64 | maxlen ) |
|
override |
Core audio callback used by the Qt Audio engine.
Real-time audio processing loop.
- Reads PCM data from the internal buffer based on the active PlayMode. In Waveform mode, it utilizes phase accumulation to loop the cycle.
- Parameters
-
| data | Destination buffer for the audio samples. |
| maxlen | Maximum number of bytes to read. |
- Returns
- qint64 Number of bytes actually read.
- Depending on the active PlayMode, this function either synthesizes a periodic waveform using linear interpolation or streams raw data.
- Periodic Synthesis (Oscillator) Uses linear interpolation between samples to maintain signal integrity at non-integer phase positions.
- Linear Playback (WAV Audit) Streams the buffer 1:1. m_wavIndex tracks the position.
◆ setFrequency()
| void XYSeriesIODevice::setFrequency |
( |
float | hz | ) |
|
Sets the fundamental frequency for the Waveform synthesis mode.
Calculates the phase increment based on a target frequency.
- Parameters
-
| hz | Target frequency in Hertz (e.g., 55.0 for A1). |
- Formula: increment = (Frequency * TableSize) / SampleRate. This ensures pitch accuracy in PlayMode::Waveform.
◆ setPlayMode()
| void XYSeriesIODevice::setPlayMode |
( |
PlayMode | mode | ) |
|
Toggles between the available playback engines.
Changes the playback engine state and resets indices.
- Parameters
-
◆ updateTable()
| void XYSeriesIODevice::updateTable |
( |
const std::vector< float > & | data | ) |
|
Loads new PCM data into the internal lookup table.
Updates the internal signal buffer.
- Parameters
-
| data | A vector of floating-point samples normalized to [-1.0, 1.0]. |
| data | PCM samples used for both synthesis and linear playback. |
◆ writeData()
| qint64 XYSeriesIODevice::writeData |
( |
const char * | , |
|
|
qint64 | ) |
|
inlineoverride |
Placeholder for write operations; always returns 0.
◆ m_currentMode
◆ m_increment
| float XYSeriesIODevice::m_increment {0.0f} |
|
private |
Phase step per sample, derived from frequency.
◆ m_phase
| float XYSeriesIODevice::m_phase {0.0f} |
|
private |
Phase accumulator for Waveform mode.
◆ m_sampleRate
| const float XYSeriesIODevice::m_sampleRate {44100.0f} |
|
private |
System sample rate for time-base calculations.
◆ m_table
| std::vector<float> XYSeriesIODevice::m_table |
|
private |
Internal buffer for PCM signal data.
◆ m_wavIndex
| qint64 XYSeriesIODevice::m_wavIndex {0} |
|
private |
Current read pointer for WavFile mode.
The documentation for this class was generated from the following files: