LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
audio_processing_module.h
1/*
2 * Copyright 2025 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <cstdint>
20
21#include "livekit/audio_frame.h"
22#include "livekit/ffi_handle.h"
23
24namespace livekit {
25
45public:
49 struct Options {
52 bool echo_cancellation = false;
53
56 bool noise_suppression = false;
57
60 bool high_pass_filter = false;
61
64 bool auto_gain_control = false;
65
67 Options() = default;
68 };
69
77
84 explicit AudioProcessingModule(const Options &options);
85
86 virtual ~AudioProcessingModule() = default;
87
88 // Non-copyable
90 AudioProcessingModule &operator=(const AudioProcessingModule &) = delete;
91
92 // Movable
93 AudioProcessingModule(AudioProcessingModule &&) noexcept = default;
94 AudioProcessingModule &operator=(AudioProcessingModule &&) noexcept = default;
95
113
131
155 void setStreamDelayMs(int delay_ms);
156
157private:
159 bool valid() const noexcept { return handle_.valid(); }
160
162 std::uint64_t ffi_handle_id() const noexcept {
163 return static_cast<std::uint64_t>(handle_.get());
164 }
165
166 FfiHandle handle_;
167};
168
169} // namespace livekit
Represents a raw PCM audio frame with interleaved int16 samples.
Definition audio_frame.h:37
WebRTC Audio Processing Module (APM) for real-time audio enhancement.
Definition audio_processing_module.h:44
AudioProcessingModule(const Options &options)
Create a new Audio Processing Module with the specified options.
void processReverseStream(AudioFrame &frame)
Process the reverse (far-end/speaker) audio stream.
void processStream(AudioFrame &frame)
Process the forward (near-end/microphone) audio stream.
AudioProcessingModule()
Create a new Audio Processing Module with default options (all disabled).
void setStreamDelayMs(int delay_ms)
Set the estimated delay between the reverse and forward streams.
Configuration options for the Audio Processing Module.
Definition audio_processing_module.h:49
bool echo_cancellation
Definition audio_processing_module.h:52
bool noise_suppression
Definition audio_processing_module.h:56
bool high_pass_filter
Definition audio_processing_module.h:60
bool auto_gain_control
Definition audio_processing_module.h:64
Options()=default
Default constructor.