SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDaCLI::AudioInThread Class Reference

Captures microphone audio and sends it to SoDaServer. More...

#include <CLIAudio.hxx>

Inheritance diagram for SoDaCLI::AudioInThread:

Public Member Functions

 AudioInThread (const std::string &sockPath, const QAudioDevice &dev, float initGain=0.0f, QObject *parent=nullptr)
 ~AudioInThread ()
void setGain (float g)
 Set capture gain (thread-safe).
void stopAudio ()
 Stop the thread cleanly.

Protected Member Functions

void run () override

Private Attributes

std::string sock_path
QAudioDevice device
std::atomic< float > pending_gain
std::atomic< bool > stop_flag

Detailed Description

Captures microphone audio and sends it to SoDaServer.

Connects as a QLocalSocket client to sockPath (the server's _txa socket). Samples captured from a QAudioSource are scaled by the current gain and forwarded to the socket.

Create, call start(), then use setGain() to enable audio.

Definition at line 147 of file CLIAudio.hxx.

Constructor & Destructor Documentation

◆ AudioInThread()

SoDaCLI::AudioInThread::AudioInThread ( const std::string & sockPath,
const QAudioDevice & dev,
float initGain = 0.0f,
QObject * parent = nullptr )
explicit
Parameters
sockPathFull path of the _txa socket.
devAudio input device.
initGainInitial gain [0.0 = muted, 1.0 = unity].
parentOptional Qt parent.

◆ ~AudioInThread()

SoDaCLI::AudioInThread::~AudioInThread ( )

Member Function Documentation

◆ run()

void SoDaCLI::AudioInThread::run ( )
overrideprotected

◆ setGain()

void SoDaCLI::AudioInThread::setGain ( float g)
inline

Set capture gain (thread-safe).

Parameters
gLinear gain factor applied to each sample.

Definition at line 166 of file CLIAudio.hxx.

References pending_gain.

◆ stopAudio()

void SoDaCLI::AudioInThread::stopAudio ( )

Stop the thread cleanly.

Member Data Documentation

◆ device

QAudioDevice SoDaCLI::AudioInThread::device
private

Definition at line 178 of file CLIAudio.hxx.

◆ pending_gain

std::atomic<float> SoDaCLI::AudioInThread::pending_gain
private

Definition at line 179 of file CLIAudio.hxx.

Referenced by setGain().

◆ sock_path

std::string SoDaCLI::AudioInThread::sock_path
private

Definition at line 177 of file CLIAudio.hxx.

◆ stop_flag

std::atomic<bool> SoDaCLI::AudioInThread::stop_flag
private

Definition at line 180 of file CLIAudio.hxx.


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