1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AUDIO_CAPTURER_SOURCE_H
17 #define AUDIO_CAPTURER_SOURCE_H
18 
19 #include <cstdio>
20 #include <list>
21 
22 #include "audio_info.h"
23 #include "i_audio_capturer_source.h"
24 
25 namespace OHOS {
26 namespace AudioStandard {
27 #define AUDIO_CHANNELCOUNT 2
28 #define AUDIO_SAMPLE_RATE_48K 48000
29 #define DEEP_BUFFER_CAPTURE_PERIOD_SIZE 4096
30 #define INT_32_MAX 0x7fffffff
31 #define PERIOD_SIZE 1024
32 #define PATH_LEN 256
33 #define AUDIO_BUFF_SIZE (16 * 1024)
34 #define PCM_8_BIT 8
35 #define PCM_16_BIT 16
36 
37 class AudioCapturerSource : public IAudioCapturerSource {
38 public:
39     static AudioCapturerSource *GetInstance(const std::string &halName = "primary",
40         const SourceType sourceType = SourceType::SOURCE_TYPE_MIC,
41         const char *sourceName = "Built_in_wakeup");
42     static AudioCapturerSource *GetMicInstance(void);
43     static AudioCapturerSource *GetWakeupInstance(bool isMirror = false);
44 
45 protected:
46     AudioCapturerSource() = default;
47     ~AudioCapturerSource() = default;
48 };
49 }  // namespace AudioStandard
50 }  // namespace OHOS
51 #endif  // AUDIO_CAPTURER_SOURCE_H
52