Represents a raw PCM audio frame with interleaved int16 samples.
More...
#include <audio_frame.h>
|
| | AudioFrame (std::vector< std::int16_t > data, int sample_rate, int num_channels, int samples_per_channel) |
| | Construct an AudioFrame from raw PCM samples.
|
| |
|
const std::vector< std::int16_t > & | data () const noexcept |
| |
|
std::vector< std::int16_t > & | data () noexcept |
| |
|
std::size_t | totalSamples () const noexcept |
| | Number of samples in the buffer (per all channels).
|
| |
|
int | sampleRate () const noexcept |
| | Sample rate in Hz.
|
| |
|
int | numChannels () const noexcept |
| | Number of channels.
|
| |
|
int | samplesPerChannel () const noexcept |
| | Samples per channel.
|
| |
|
double | duration () const noexcept |
| | Duration in seconds (samplesPerChannel / sampleRate).
|
| |
|
std::string | toString () const |
| | A human-readable description.
|
| |
|
|
static AudioFrame | create (int sample_rate, int num_channels, int samples_per_channel) |
| | Create a new zero-initialized AudioFrame instance.
|
| |
|
static AudioFrame | fromOwnedInfo (const proto::OwnedAudioFrameBuffer &owned) |
| | Construct an AudioFrame by copying data out of an OwnedAudioFrameBuffer.
|
| |
|
|
proto::AudioFrameBufferInfo | toProto () const |
| |
Represents a raw PCM audio frame with interleaved int16 samples.
AudioFrame holds decoded audio data along with metadata such as sample rate, number of channels, and samples per channel. It is used for capturing and processing audio in the LiveKit SDK.
◆ AudioFrame()
| livekit::AudioFrame::AudioFrame |
( |
std::vector< std::int16_t > |
data, |
|
|
int |
sample_rate, |
|
|
int |
num_channels, |
|
|
int |
samples_per_channel |
|
) |
| |
Construct an AudioFrame from raw PCM samples.
- Parameters
-
| data | Interleaved PCM samples (int16). |
| sample_rate | Sample rate (Hz). |
| num_channels | Number of channels. |
| samples_per_channel | Number of samples per channel. |
- Exceptions
-
| std::invalid_argument | if the data size is inconsistent with num_channels * samples_per_channel. |
The documentation for this class was generated from the following file: