49 void setDevice(QAudioDevice
const &device,
unsigned msBuffer);
66 void play(QByteArray
const &data, QAudioFormat
const &format);
91 void handleStateChanged(QAudio::State newState);
102 QAudioDevice m_device;
103 std::unique_ptr<QAudioSink> m_sink;
104 std::unique_ptr<QBuffer> m_buffer;
105 QAudioFormat m_currentFormat;
106 qreal m_volume = 1.0;
107 unsigned m_msBuffer = 0;
void status(QString message)
Emitted to provide informational status messages.
NotificationSoundOutput(QObject *parent=nullptr)
Construct a NotificationSoundOutput instance.
Definition NotificationSoundOutput.cpp:15
void error(QString message)
Emitted when an error occurs during setup or playback.
~NotificationSoundOutput() override
Destroy the NotificationSoundOutput and release audio resources.
Definition NotificationSoundOutput.cpp:20
void setAttenuation(qreal a)
Set attenuation factor applied to played audio.
Definition NotificationSoundOutput.cpp:44
void play(QByteArray const &data, QAudioFormat const &format)
Play the provided audio data using the given format.
Definition NotificationSoundOutput.cpp:60
void stop()
Stop playback immediately and release the playback buffer.
Definition NotificationSoundOutput.cpp:133
void setDevice(QAudioDevice const &device, unsigned msBuffer)
Select the audio output device and set the internal buffer size.
Definition NotificationSoundOutput.cpp:33