![]() |
SDK Version 2.0.1
AnsuR Technologies ASMIRA SDK
|
Classes | |
| struct | asdk::audio_options_t |
| Audio encoder settings, see sdk_t::SetAudioOptions and sdk_t::AudioOptions. More... | |
| struct | asdk::audio_frame_t |
| Decoded room audio, delivered by DecodedAudioFrameFunc. More... | |
Typedefs | |
| typedef uint8_t | asdk::AudioFrameStateValue |
| typedef void(*) | asdk::EncodedAudioFrameFunc(const uint16_t srcID, const unsigned int timeStamp, const asdk::AudioFrameStateValue state, const unsigned char *audioEncoded, const size_t audioEncodedSize, void *opaque) |
| An encoded audio frame arrived, before any decoding. | |
| typedef void(*) | asdk::DecodedAudioFrameFunc(const audio_frame_t *audioFrame, void *opaque) |
| A received audio frame was decoded to PCM. | |
Enumerations | |
| enum | asdk::AudioFrameState { asdk::AudioFrameStateUndef = 0 , asdk::AudioFrameSpeex = 1 << 0 , asdk::AudioFrameOpus = 1 << 1 , asdk::AudioFrameServer = 1 << 2 } |
| Codec and origin of an encoded audio frame, as an AudioFrameStateValue. More... | |
| enum | asdk::AudioCodec { asdk::AudioCodecUndef , asdk::AudioCodecOpus , asdk::AudioCodecSpeex } |
| Audio codec enum, the encoder used by sdk_t::SendAudioFrame. More... | |
Functions | |
| Status | asdk::sdk_t::SendAudioFrame (const int16_t *samples, const uint32_t sampleCount, const uint32_t timeStamp=0) |
| Encodes and sends captured audio to the currently joined room. | |
| Status | asdk::sdk_t::SendEncodedAudioFrame (const void *data, const uint32_t size, const uint32_t timeStamp, const AudioFrameStateValue state) |
| Sends an already encoded audio frame to the currently joined room. | |
| Status | asdk::sdk_t::FlushAudioFrames () |
| Sends the audio frames still held back by the transmit queue. | |
| Status | asdk::sdk_t::SetAudioOptions (const audio_options_t *audioOptions) |
| Sets the audio encoder options. | |
| Status | asdk::sdk_t::AudioOptions (audio_options_t *audioOptions) |
| Gets the audio options in effect. | |
| void | asdk::sdk_t::SetEncodedAudioFrameCallback (EncodedAudioFrameFunc func, void *opaque=nullptr) |
| Encoded Audio Frame callback. | |
| void | asdk::sdk_t::SetDecodedAudioFrameCallback (DecodedAudioFrameFunc func, void *opaque=nullptr) |
| Decoded Audio Frame callback. | |
Variables | |
| static const uint32_t | asdk::AUDIO_SAMPLE_RATE = 16000 |
| static const uint32_t | asdk::AUDIO_CHANNELS = 1 |
| static const uint32_t | asdk::AUDIO_FRAME_SAMPLES = 320 |
Sending captured or already encoded audio to a room, and receiving the audio the server mixes from its members.
| typedef uint8_t asdk::AudioFrameStateValue |
Bit set of AudioFrameState values
Definition at line 421 of file asmirasdk.h.
| typedef void(*) asdk::EncodedAudioFrameFunc(const uint16_t srcID, const unsigned int timeStamp, const asdk::AudioFrameStateValue state, const unsigned char *audioEncoded, const size_t audioEncodedSize, void *opaque) |
An encoded audio frame arrived, before any decoding.
srcID is the sending client, state says which codec produced it. Use it when the source of the audio matters, DecodedAudioFrameFunc gives the mixed PCM instead.
Definition at line 852 of file asmirasdk.h.
| typedef void(*) asdk::DecodedAudioFrameFunc(const audio_frame_t *audioFrame, void *opaque) |
A received audio frame was decoded to PCM.
The server mixes the room audio, so one frame may hold several speakers, use EncodedAudioFrameFunc when the source matters. Called on the audio decoder thread, audioFrame is valid only for the duration of the callback.
Definition at line 920 of file asmirasdk.h.
Codec and origin of an encoded audio frame, as an AudioFrameStateValue.
A bit set. Exactly one codec bit is set; AudioFrameServer is an additional flag. Used by EncodedAudioFrameFunc and sdk_t::SendEncodedAudioFrame.
| Enumerator | ||
|---|---|---|
| AudioFrameStateUndef | 0 | Undefined |
| AudioFrameSpeex | 1 << 0 | Speex frame. Set either this or AudioFrameOpus, never both |
| AudioFrameOpus | 1 << 1 | Opus frame. Set either this or AudioFrameSpeex, never both |
| AudioFrameServer | 1 << 2 | Mixed by the server, may hold several sources |
Definition at line 413 of file asmirasdk.h.
| enum asdk::AudioCodec |
Audio codec enum, the encoder used by sdk_t::SendAudioFrame.
| Enumerator | |
|---|---|
| AudioCodecUndef | No encoder available, the audio module failed to load |
| AudioCodecOpus | Preferred |
| AudioCodecSpeex | Legacy, ASMIRA clients still decode it |
Definition at line 427 of file asmirasdk.h.
|
inline |
Encodes and sends captured audio to the currently joined room.
Takes signed 16 bit mono PCM at AUDIO_SAMPLE_RATE. Any sample count is accepted, the SDK accumulates it into the AUDIO_FRAME_SAMPLES frames the codecs require and keeps the remainder for the next call. Encoding and transmission are asynchronous, StatusOK means the samples were queued for the encoder. Frames are dropped while no room is joined. See SetAudioOptions for codec and bitrate.
| samples | Signed 16 bit PCM samples. |
| sampleCount | Number of samples (not bytes). |
| timeStamp | Presentation time in msec, zero derives it from the samples sent so far. |
Definition at line 1147 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Sends an already encoded audio frame to the currently joined room.
For clients that hold Opus or Speex frames of their own, a recording or a relay. The frame has to match the format the state flags declare, the SDK passes it on untouched.
| data | Encoded frame data. |
| size | Encoded frame size in bytes. |
| timeStamp | Presentation time in msec. |
| state | Frame state, AudioFrameOpus or AudioFrameSpeex. |
Definition at line 1168 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Sends the audio frames still held back by the transmit queue.
Audio frames are accumulated into packets (see audio_options_t::txQueueFrames), call this when the talk burst ends so the tail is not left waiting.
Definition at line 1185 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Sets the audio encoder options.
Read back the applied options with AudioOptions. Advertise DeviceCapabilityAudioOpus or DeviceCapabilityAudioSpeex on connect so the other room members know what this client sends.
| audioOptions | Options to apply. |
Definition at line 1202 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Gets the audio options in effect.
audio_options_t::codec reports AudioCodecUndef when the audio module is missing, in which case audio can neither be sent nor decoded.
| audioOptions | Options out. |
Definition at line 1218 of file asmirasdk.h.
References asdk::StatusErrorHandle.
|
inline |
Encoded Audio Frame callback.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1467 of file asmirasdk.h.
|
inline |
Decoded Audio Frame callback.
Received audio is only decoded when this callback is set.
| func | Callback to install. |
| opaque | Caller data passed back unchanged to every invocation. |
Definition at line 1553 of file asmirasdk.h.
|
static |
Audio PCM sample rate in Hz, the audio codecs accept no other rate
Definition at line 147 of file asmirasdk.h.
|
static |
Audio PCM channel count, mono
Definition at line 150 of file asmirasdk.h.
|
static |
PCM samples per encoded audio frame, 20 msec at AUDIO_SAMPLE_RATE
Definition at line 153 of file asmirasdk.h.