JS8Call-Improved master
Loading...
Searching...
No Matches
SoundOutput Class Reference

Manages audio output format, buffering and the underlying sink. More...

#include <SoundOutput.h>

Inheritance diagram for SoundOutput:
Collaboration diagram for SoundOutput:

Public Slots

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.

Signals

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.

Public Member Functions

 SoundOutput ()=default
 Default-construct a SoundOutput helper.
qreal attenuation () const
 Current attenuation (volume multiplier).
QAudioFormat format () const
 Active audio format used by the output.

Detailed Description

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.

Member Function Documentation

◆ 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
messageHuman-readable error description.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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
sourceThe device providing audio samples for playback.
sourceThe QIODevice to read audio data from.
Here is the call graph for this function:

◆ 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
valueAttenuation factor where 1.0 is no attenuation.
aThe attenuation value.
Here is the caller graph for this function:

◆ 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
deviceOutput device to use.
formatExact audio format to use for the sink.
msBufferedMilliseconds of buffering to set up (0 = default).
deviceThe QAudioDevice to use.
formatThe QAudioFormat to set.
msBufferedThe buffer size in milliseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
deviceOutput device to use.
channelsNumber of channels (1 or 2).
msBufferedMilliseconds of buffering to set up (0 = default).
deviceThe QAudioDevice to use.
channelsThe number of audio channels (1 for mono, 2 for stereo).
msBufferedThe buffer size in milliseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ status

void SoundOutput::status ( QString message) const
signal

Emitted to report informational status updates.

Parameters
messageStatus text.

◆ 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: