Manages audio output format, buffering and the underlying sink.
More...
#include <SoundOutput.h>
|
| void | setFormat (QAudioDevice const &device, unsigned channels, unsigned msBuffered=0u) |
| | Configure format based on device and channel count.
|
| void | setDeviceFormat (QAudioDevice const &device, QAudioFormat const &format, unsigned msBuffered=0u) |
| | Set device and explicit format to use for playback.
|
| void | restart (QIODevice *source) |
| | Restart output streaming from the given QIODevice source.
|
| void | suspend () |
| | Temporarily suspend output streaming.
|
| void | resume () |
| | Resume output after a suspend.
|
| void | reset () |
| | Reset internal state and stop any active stream.
|
| void | stop () |
| | Stop playback immediately.
|
| void | setAttenuation (qreal value) |
| | Set attenuation (volume multiplier) for playback.
|
| void | resetAttenuation () |
| | Reset attenuation to default (unity) value.
|
|
| void | error (QString message) const |
| | Emitted when an error occurs related to audio output.
|
| void | status (QString message) const |
| | Emitted to report informational status updates.
|
|
|
| SoundOutput ()=default |
| | Default-construct a SoundOutput helper.
|
| qreal | attenuation () const |
| | Current attenuation (volume multiplier).
|
| QAudioFormat | format () const |
| | Active audio format used by the output.
|
Manages audio output format, buffering and the underlying sink.
Responsible for configuring a QAudioSink, managing buffering latency, and applying attenuation for playback. Typical usage is to call setFormat() or setDeviceFormat() and then restart() with a prepared QIODevice for streaming audio.
◆ attenuation()
| qreal SoundOutput::attenuation |
( |
| ) |
const |
Current attenuation (volume multiplier).
Gets the current attenuation in decibels.
- Returns
- Attenuation factor where 1.0 is unity gain.
-
The attenuation value.
◆ error
| void SoundOutput::error |
( |
QString | message | ) |
const |
|
signal |
Emitted when an error occurs related to audio output.
- Parameters
-
| message | Human-readable error description. |
◆ format()
| QAudioFormat SoundOutput::format |
( |
| ) |
const |
Active audio format used by the output.
Gets the current audio format.
- Returns
- The QAudioFormat currently configured for playback.
-
The QAudioFormat object.
◆ reset
| void SoundOutput::reset |
( |
| ) |
|
|
slot |
Reset internal state and stop any active stream.
Resets the audio output.
◆ resetAttenuation
| void SoundOutput::resetAttenuation |
( |
| ) |
|
|
slot |
Reset attenuation to default (unity) value.
Resets the attenuation to zero.
◆ restart
| void SoundOutput::restart |
( |
QIODevice * | source | ) |
|
|
slot |
Restart output streaming from the given QIODevice source.
Restarts audio output with the specified source.
- Parameters
-
| source | The device providing audio samples for playback. |
| source | The QIODevice to read audio data from. |
◆ resume
| void SoundOutput::resume |
( |
| ) |
|
|
slot |
Resume output after a suspend.
Resumes audio output.
◆ setAttenuation
| void SoundOutput::setAttenuation |
( |
qreal | a | ) |
|
|
slot |
Set attenuation (volume multiplier) for playback.
Sets the attenuation in decibels.
- Parameters
-
| value | Attenuation factor where 1.0 is no attenuation. |
| a | The attenuation value. |
◆ setDeviceFormat
| void SoundOutput::setDeviceFormat |
( |
QAudioDevice const & | device, |
|
|
QAudioFormat const & | format, |
|
|
unsigned | msBuffered = 0u ) |
|
slot |
Set device and explicit format to use for playback.
Sets the audio device and format.
- Parameters
-
| device | Output device to use. |
| format | Exact audio format to use for the sink. |
| msBuffered | Milliseconds of buffering to set up (0 = default). |
| device | The QAudioDevice to use. |
| format | The QAudioFormat to set. |
| msBuffered | The buffer size in milliseconds. |
◆ setFormat
| void SoundOutput::setFormat |
( |
QAudioDevice const & | device, |
|
|
unsigned | channels, |
|
|
unsigned | msBuffered = 0u ) |
|
slot |
Configure format based on device and channel count.
Sets the audio format based on the device and channel count.
- Parameters
-
| device | Output device to use. |
| channels | Number of channels (1 or 2). |
| msBuffered | Milliseconds of buffering to set up (0 = default). |
| device | The QAudioDevice to use. |
| channels | The number of audio channels (1 for mono, 2 for stereo). |
| msBuffered | The buffer size in milliseconds. |
◆ status
| void SoundOutput::status |
( |
QString | message | ) |
const |
|
signal |
Emitted to report informational status updates.
- Parameters
-
◆ stop
| void SoundOutput::stop |
( |
| ) |
|
|
slot |
Stop playback immediately.
Stops audio output.
◆ suspend
| void SoundOutput::suspend |
( |
| ) |
|
|
slot |
Temporarily suspend output streaming.
Suspends audio output.
The documentation for this class was generated from the following files: