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

Plays short notification sounds using an internal output stream. More...

#include <NotificationAudio.h>

Inheritance diagram for NotificationAudio:
Collaboration diagram for NotificationAudio:

Public Slots

void status (QString message)
 Relay a status message from internal components.
void error (QString message)
 Relay an error message from internal components.
void setDevice (const QAudioDevice &device, unsigned msBuffer=0)
 Set output device and optional buffering for playback.
void play (const QString &filePath)
 Play a sound file referenced by filePath.
void stop ()
 Stop any currently playing notification sound.

Public Member Functions

 NotificationAudio (QObject *parent=nullptr)
 Construct a NotificationAudio helper.
 ~NotificationAudio ()
 Destroy the NotificationAudio and release cached resources.

Detailed Description

Plays short notification sounds using an internal output stream.

The class maintains an in-memory cache of decoded PCM audio so that frequently used notification sounds play with minimal latency.

Constructor & Destructor Documentation

◆ NotificationAudio()

NotificationAudio::NotificationAudio ( QObject * parent = nullptr)
explicit

Construct a NotificationAudio helper.

Constructs a NotificationAudio object.

Parameters
parentOptional parent QObject.
parentThe parent QObject.
Returns
None.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~NotificationAudio()

NotificationAudio::~NotificationAudio ( )

Destroy the NotificationAudio and release cached resources.

Destructs the NotificationAudio object.

Here is the call graph for this function:

Member Function Documentation

◆ error

void NotificationAudio::error ( QString message)
slot

Relay an error message from internal components.

Handles error messages from the SoundOutput.

Parameters
messageError description.
messageThe error message.
Here is the caller graph for this function:

◆ play

void NotificationAudio::play ( const QString & filePath)
slot

Play a sound file referenced by filePath.

Plays an audio file from the specified file path.

Parameters
filePathPath to an audio resource on disk.
filePathThe path to the audio file.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDevice

void NotificationAudio::setDevice ( const QAudioDevice & device,
unsigned msBuffer = 0 )
slot

Set output device and optional buffering for playback.

Sets the audio device and buffer size.

Parameters
deviceAudio output device to use.
msBufferMilliseconds of buffer to allocate for playback.
deviceThe QAudioDevice to use.
msBufferThe buffer size in milliseconds.
Here is the caller graph for this function:

◆ status

void NotificationAudio::status ( QString message)
slot

Relay a status message from internal components.

Handles status messages from the SoundOutput.

Parameters
messageInformational text.
messageThe status message.
Here is the call graph for this function:

◆ stop

void NotificationAudio::stop ( )
slot

Stop any currently playing notification sound.

Stops audio playback.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: