![]() |
SoDaRadio-12.2.0-cut_dependencies:6c82803
|
Receives demodulated audio from SoDaServer and plays it. More...
#include <CLIAudio.hxx>
Public Member Functions | |
| AudioOutThread (const std::string &sockPath, const QAudioDevice &dev, float initVolume=0.0f, QObject *parent=nullptr) | |
| ~AudioOutThread () | |
| void | setVolume (float v) |
| Set playback volume (thread-safe). | |
| double | getRMS () const |
| Return the RMS of samples received in the last completed second. | |
| void | stopAudio () |
| Stop the thread cleanly. | |
Protected Member Functions | |
| void | run () override |
Private Attributes | |
| std::string | sock_path |
| QAudioDevice | device |
| std::atomic< float > | pending_volume |
| std::atomic< bool > | stop_flag |
| std::atomic< double > | last_rms {-1.0} |
Receives demodulated audio from SoDaServer and plays it.
Connects as a QLocalSocket client to sockPath (the server's _rxa socket). Incoming float32 samples are forwarded directly to a QAudioSink in push mode. Volume is adjustable at any time.
Create, call start(), then use setVolume() to unmute.
Definition at line 92 of file CLIAudio.hxx.
|
explicit |
| sockPath | Full path of the _rxa socket. |
| dev | Audio output device. |
| initVolume | Initial volume [0.0 = muted, 1.0 = full]. |
| parent | Optional Qt parent. |
| SoDaCLI::AudioOutThread::~AudioOutThread | ( | ) |
|
inline |
Return the RMS of samples received in the last completed second.
Returns -1.0 if no data has been received yet.
Definition at line 117 of file CLIAudio.hxx.
References last_rms.
|
overrideprotected |
|
inline |
Set playback volume (thread-safe).
| v | Linear volume in [0.0, 1.0]. |
Definition at line 111 of file CLIAudio.hxx.
References pending_volume.
| void SoDaCLI::AudioOutThread::stopAudio | ( | ) |
Stop the thread cleanly.
|
private |
Definition at line 129 of file CLIAudio.hxx.
|
private |
Definition at line 132 of file CLIAudio.hxx.
Referenced by getRMS().
|
private |
Definition at line 130 of file CLIAudio.hxx.
Referenced by setVolume().
|
private |
Definition at line 128 of file CLIAudio.hxx.
|
private |
Definition at line 131 of file CLIAudio.hxx.