23#include "livekit/visibility.h"
28class AudioFrameBufferInfo;
29class OwnedAudioFrameBuffer;
48 AudioFrame(std::vector<std::int16_t> data,
int sample_rate,
int num_channels,
int samples_per_channel);
60 const std::vector<std::int16_t>& data() const noexcept {
return data_; }
61 std::vector<std::int16_t>& data() noexcept {
return data_; }
79 std::
string toString() const;
84 proto::AudioFrameBufferInfo toProto() const;
88 std::vector<std::int16_t> data_;
91 int samples_per_channel_;
Represents a raw PCM audio frame with interleaved int16 samples.
Definition audio_frame.h:37
AudioFrame(std::vector< std::int16_t > data, int sample_rate, int num_channels, int samples_per_channel)
Construct an AudioFrame from raw PCM samples.
std::size_t totalSamples() const noexcept
Number of samples in the buffer (per all channels).
Definition audio_frame.h:64
static AudioFrame create(int sample_rate, int num_channels, int samples_per_channel)
Create a new zero-initialized AudioFrame instance.
int numChannels() const noexcept
Number of channels.
Definition audio_frame.h:70
static AudioFrame fromOwnedInfo(const proto::OwnedAudioFrameBuffer &owned)
Construct an AudioFrame by copying data out of an OwnedAudioFrameBuffer.
int samplesPerChannel() const noexcept
Samples per channel.
Definition audio_frame.h:73
double duration() const noexcept
Duration in seconds (samplesPerChannel / sampleRate).
int sampleRate() const noexcept
Sample rate in Hz.
Definition audio_frame.h:67
Represents a real-time audio source with an internal audio queue.
Definition audio_source.h:35
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25