Ring Daemon 16.0.0
Loading...
Searching...
No Matches
audio_recorder.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 The Android Open Source Project
3 * Copyright 2015-2025 Savoir-faire Linux Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include <sys/types.h>
21#include <SLES/OpenSLES.h>
22#include <SLES/OpenSLES_Android.h>
23
24#include "audio_common.h"
25#include "buf_manager.h"
26#include "noncopyable.h"
27
28namespace jami {
29namespace opensl {
30
32{
33 SLObjectItf recObjectItf_;
34 SLRecordItf recItf_;
35 SLAndroidSimpleBufferQueueItf recBufQueueItf_;
36
37 jami::AudioFormat sampleInfo_;
38 AudioQueue* freeQueue_ {nullptr}; // user
39 AudioQueue* recQueue_ {nullptr}; // user
40 AudioQueue devShadowQueue_ {DEVICE_SHADOW_BUFFER_QUEUE_LEN}; // owner
41 uint32_t audioBufCount;
42 sample_buf silentBuf_;
43
44 EngineCallback callback_ {};
45 bool hasNativeAEC_ {false};
46 bool hasNativeNS_ {false};
47
48public:
52
53 bool start();
54 bool stop();
57 void registerCallback(EngineCallback cb) { callback_ = cb; }
58 size_t dbgGetDevBufCount();
59
60 bool hasNativeAEC() const { return hasNativeAEC_; }
61 bool hasNativeNS() const { return hasNativeNS_; }
62};
63
64} // namespace opensl
65} // namespace jami
#define DEVICE_SHADOW_BUFFER_QUEUE_LEN
void registerCallback(EngineCallback cb)
void processSLCallback(SLAndroidSimpleBufferQueueItf bq)
void setBufQueues(AudioQueue *freeQ, AudioQueue *recQ)
std::function< void()> EngineCallback
void emitSignal(Args... args)
Definition ring_signal.h:64
Simple macro to hide class' copy constructor and assignment operator.
Structure to hold sample rate and channel number associated with audio data.