![]() |
SoDaRadio-12.2.0-cut_dependencies:6c82803
|
Qt audio interface class. More...
#include <AudioQt.hxx>
Public Member Functions | |
| ~AudioQt () | |
| int | send (void *buf, unsigned int len, bool when_ready=false) |
| send – send a buffer to the audio output | |
| bool | sendBufferReady (unsigned int len) |
| sendBufferReady – is there enough space in the audio device send buffer for a call from send? | |
| virtual int | recv (std::vector< float > &buf, bool when_ready=false) |
| recv – get a buffer of data from the audio input | |
| bool | recvBufferReady (unsigned int len) |
| recvBufferReady – are there samples waiting in the audio device? | |
| void | sleepOut () |
| stop the output stream so that we don't encounter a buffer underflow while the reciever is muted. | |
| void | wakeOut () |
| start the output stream | |
| virtual void | sleepIn () |
| stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive. | |
| virtual void | wakeIn () |
| start the input stream | |
| std::string | currentPlaybackState () |
| virtual std::string | currentCaptureState () |
| void | run () |
| the run method – maintains incoming audio sample buffers | |
| void | subscribeToMailBoxes (const std::vector< MailBoxBasePtr > &mailboxes) |
| the creator of this thread may offer one or more mailboxes to this object. | |
| Public Member Functions inherited from SoDa::AudioIfc | |
| virtual bool | setOutGain (float gain) |
| set the gain for the output device. | |
| virtual bool | setInGain (float gain) |
| set the gain for the input device. | |
| virtual float | getOutGain () |
| get the gain for the output device. | |
| virtual float | getInGain () |
| get the gain for the input device. | |
| Public Member Functions inherited from SoDa::Thread | |
| void | registerThread (SoDa::ThreadPtr me) |
| void | operator() () |
| void | start () |
| Execute the thread's run loop. | |
| void | join () |
| more properly "Wait for this thread to exit its run loop". | |
| void | execCommand (CommandPtr cmd) |
| Execute (dispatch) a message removed from the command stream to one of the basic Command handler functions. | |
| virtual void | execGetCommand (CommandPtr cmd) |
| optional method to handle "GET" commands – commands that request a response | |
| virtual void | execSetCommand (CommandPtr cmd) |
| optional method to handle "SET" commands – commands that set internal state in the object. | |
| virtual void | execRepCommand (CommandPtr cmd) |
| optional method that reports status or the result of some action. | |
| virtual void | shutDown () |
| optional method that performs cleanup – may not delete. | |
| void | sleep_ms (unsigned int milliseconds) |
| void | sleep_us (unsigned int microseconds) |
| uint32_t | getID () |
| Get the process/thread ID for this thread – helps with figuring out who caused a segfault. | |
| Public Member Functions inherited from SoDa::Base | |
| Base (const std::string &oname) | |
| The constructor – pass a name for the object. | |
| void | registerSelf (BasePtr ptr) |
| std::string & | getObjName () |
| get the name of this object | |
| BasePtr | findSoDaObject (const std::string &oname) |
| find a SoDa Object by name. | |
| double | getTime () |
| Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS). | |
| BasePtr | getSelfPtr () |
| get a pointer to myself. | |
| Public Member Functions inherited from SoDa::Debug | |
| Debug (std::string _unit_name=std::string("UNKNOWN")) | |
| Debug (const char *_unit_name_cstr) | |
| Debug (unsigned int _debug_level, std::string _unit_name=std::string("UNKNOWN")) | |
| Debug (unsigned int _debug_level, const char *_unit_name_cstr) | |
| void | debugMsg (const std::string &msg, unsigned int threshold=1) |
| void | debugMsg (const SoDa::Format &fmt, unsigned int threshold=1) |
| void | debugMsg (const char *msg, unsigned int threshold=1) |
| void | setDebugLevel (unsigned int v) |
| unsigned int | getDebugLevel () |
Static Public Member Functions | |
| static AudioQtPtr | make (unsigned int _sample_rate, unsigned int _sample_count_hint=1024, std::string audio_sock_basename=std::string("soda_")) |
| Static Public Member Functions inherited from SoDa::Debug | |
| static void | setDefaultLevel (unsigned int v) |
| static unsigned int | getDefaultLevel () |
| static void | setGlobalLevel (unsigned int v) |
| static unsigned int | getGlobalLevel () |
Protected Member Functions | |
| AudioQt (unsigned int _sample_rate, unsigned int _sample_count_hint=1024, std::string audio_sock_basename=std::string("soda_")) | |
| constructor | |
| void | setupNetwork (std::string audio_sock_basename) |
| setup the network sockets for the audio link to the user interface. | |
| Protected Member Functions inherited from SoDa::AudioIfc | |
| AudioIfc (unsigned int _sample_rate, unsigned int _sample_count_hint, const std::string &name="AudioIfc") | |
| Protected Member Functions inherited from SoDa::Thread | |
| Thread (const std::string &oname, const std::string &version=std::string("12.2.0")) | |
| make the thread object. | |
| Protected Member Functions inherited from SoDa::Debug | |
| std::string | curDateTime () |
Private Attributes | |
| std::shared_ptr< SoDa::UD::ServerSocket > | audio_rx_socket |
| std::shared_ptr< SoDa::UD::ServerSocket > | audio_tx_socket |
| CmdMBoxPtr | cmd_stream |
| command stream from UI and other units | |
| CmdMBox::Subscription | cmd_subs |
| subscription ID for command stream | |
| bool | ignore_tx_data |
| SoDa::CircularBuffer< char > * | audio_cbuffer_p |
| float | ang |
| float | ang_incr |
Additional Inherited Members | |
| Static Public Attributes inherited from SoDa::Debug | |
| static std::mutex | debug_msg_mutex |
| Protected Attributes inherited from SoDa::AudioIfc | |
| unsigned int | sample_rate |
| unsigned int | sample_count_hint |
| float | in_gain |
| float | out_gain |
| int | datatype_size |
| Protected Attributes inherited from SoDa::Thread | |
| std::weak_ptr< Thread > | self |
| A pointer to ourself. | |
| Protected Attributes inherited from SoDa::Debug | |
| std::string | unit_name |
| the name of the unit reporting status | |
| unsigned int | debug_level |
| the debug level (threshold) for messages | |
| Static Protected Attributes inherited from SoDa::Debug | |
| static unsigned int | default_debug_level |
| static unsigned int | global_debug_level |
Qt audio interface class.
AudioQt implements the interface specified by AudioIfc. It should be interchangable with other audio interface handlers.
When BasebandRX posts data to the audio interface, it is transmitted via a unix domain socket to the GUI where the audio output device is managed. In the standard SoDaRadio configuration, this is turned into a QtAudio output stream.
BasebandTX watches for incoming data on its audio input mailbox. This arrives from the GUI (a QtAudio stream) via a unix domain socket.
The AudioQt object runs as a thread, solely to listen in on the incoming (transmit) audio socket. As samples arrive, they are appended to a dequeue of buffers to be passed back to the BasebandTX object when it needs data. The listener thread also subscribes to the cmd mailbox ring: it throws away incoming and buffered samples while the radio is in TX mode. This allows the process sourcing the audio stream to be ignorant of the current state of the transceiver.
Definition at line 75 of file AudioQt.hxx.
|
protected |
constructor
| _sample_rate | in Hz 48000 is a good choice |
| _sample_count_hint | the size of the buffers passed to and from the audio device (in samples) |
| audio_sock_basename | starting string for the unix-domain sockets that carry the RX audio stream from the SoDaServer (radio) process and the TX audio stream from the Qt GUI. |
Referenced by make().
|
inline |
Definition at line 101 of file AudioQt.hxx.
|
inlinevirtual |
Reimplemented from SoDa::AudioIfc.
Definition at line 167 of file AudioQt.hxx.
|
inlinevirtual |
Reimplemented from SoDa::AudioIfc.
Definition at line 163 of file AudioQt.hxx.
|
inlinestatic |
Definition at line 91 of file AudioQt.hxx.
References AudioQt().
|
virtual |
recv – get a buffer of data from the audio input
| buf | float vector of samples coming from the audio input device |
| when_ready | if true, test with recvBufferReady and return 0 if not ready otherwise perform the recv regardless. |
Implements SoDa::AudioIfc.
|
virtual |
recvBufferReady – are there samples waiting in the audio device?
| len | the number of samples that we wish to get |
Implements SoDa::AudioIfc.
|
virtual |
the run method – maintains incoming audio sample buffers
Reimplemented from SoDa::Thread.
|
virtual |
send – send a buffer to the audio output
| buf | buffer of type described by the DataFormat selected at init |
| len | number of elements in the buffer to send |
| when_ready | if true, test with sendBufferReady and return 0 if not ready otherwise perform the send regardless. |
Implements SoDa::AudioIfc.
|
virtual |
sendBufferReady – is there enough space in the audio device send buffer for a call from send?
| len | the number of samples that we wish to send |
Implements SoDa::AudioIfc.
|
protected |
setup the network sockets for the audio link to the user interface.
|
virtual |
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive.
This will also empty the incoming transmit buffer.
Implements SoDa::AudioIfc.
|
inlinevirtual |
stop the output stream so that we don't encounter a buffer underflow while the reciever is muted.
Implements SoDa::AudioIfc.
Definition at line 144 of file AudioQt.hxx.
|
virtual |
the creator of this thread may offer one or more mailboxes to this object.
The thread may "subscribe" to the mailboxes as it chooses.
| mailboxes | A list of all mailboxes that we know about. |
Implements SoDa::Thread.
|
virtual |
start the input stream
Implements SoDa::AudioIfc.
|
inlinevirtual |
|
private |
Definition at line 199 of file AudioQt.hxx.
|
private |
Definition at line 200 of file AudioQt.hxx.
|
private |
Definition at line 196 of file AudioQt.hxx.
|
private |
Definition at line 184 of file AudioQt.hxx.
|
private |
Definition at line 185 of file AudioQt.hxx.
|
private |
command stream from UI and other units
Definition at line 188 of file AudioQt.hxx.
|
private |
subscription ID for command stream
Definition at line 189 of file AudioQt.hxx.
|
private |
Definition at line 191 of file AudioQt.hxx.