1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci#ifndef OHOS_DAUDIO_CONSTANTS_H
17094332d3Sopenharmony_ci#define OHOS_DAUDIO_CONSTANTS_H
18094332d3Sopenharmony_ci
19094332d3Sopenharmony_ci#include <string>
20094332d3Sopenharmony_ci#include <map>
21094332d3Sopenharmony_ci
22094332d3Sopenharmony_cinamespace OHOS {
23094332d3Sopenharmony_cinamespace DistributedHardware {
24094332d3Sopenharmony_ci// Distributed Auido Parameters
25094332d3Sopenharmony_ciconst std::string KEY_AUDIOPORT_DIR = "portdir";
26094332d3Sopenharmony_ciconst std::string KEY_AUDIOFORMAT = "format";
27094332d3Sopenharmony_ciconst std::string KEY_AUDIOCHANNELMASK = "channel";
28094332d3Sopenharmony_ciconst std::string KEY_AUDIOSAMPLERATE = "samplerate";
29094332d3Sopenharmony_ci
30094332d3Sopenharmony_ciconst std::string VALUE_AUDIOPORT_DIR_IN = "portdirin";
31094332d3Sopenharmony_ciconst std::string VALUE_AUDIOPORT_DIR_OUT = "portdirout";
32094332d3Sopenharmony_ciconst std::string VALUE_AUDIOPORT_DIR_INOUT = "portdirinout";
33094332d3Sopenharmony_ci
34094332d3Sopenharmony_ciconst std::string DEVICE_TYPE_OUTPUT_DEFAULT = "0";
35094332d3Sopenharmony_ciconst std::string DEVICE_TYPE_INPUT_DEFAULT = "1";
36094332d3Sopenharmony_ci
37094332d3Sopenharmony_ciconst std::string VOLUME_GROUP_ID = "VOLUME_GROUP_ID";
38094332d3Sopenharmony_ciconst std::string INTERRUPT_GROUP_ID = "INTERRUPT_GROUP_ID";
39094332d3Sopenharmony_ci
40094332d3Sopenharmony_ci// Distributed Auido Parameters
41094332d3Sopenharmony_ciconst std::string VOLUME_LEVEL = "VOLUME_LEVEL";
42094332d3Sopenharmony_ciconst std::string VOLUME_EVENT_TYPE = "EVENT_TYPE";
43094332d3Sopenharmony_ciconst std::string MAX_VOLUME_LEVEL = "MAX_VOLUME_LEVEL";
44094332d3Sopenharmony_ciconst std::string MIN_VOLUME_LEVEL = "MIN_VOLUME_LEVEL";
45094332d3Sopenharmony_ciconst std::string STREAM_MUTE_STATUS = "STREAM_MUTE_STATUS";
46094332d3Sopenharmony_ci
47094332d3Sopenharmony_ciconst std::string HDF_EVENT_RESULT_SUCCESS = "DH_SUCCESS";
48094332d3Sopenharmony_ciconst std::string HDF_EVENT_INIT_ENGINE_FAILED = "ERR_DH_AUDIO_INIT_ENGINE_FAILED";
49094332d3Sopenharmony_ciconst std::string HDF_EVENT_NOTIFY_SINK_FAILED = "ERR_DH_AUDIO_NOTIFY_SINK_FAILED";
50094332d3Sopenharmony_ciconst std::string HDF_EVENT_TRANS_SETUP_FAILED = "ERR_DH_AUDIO_TRANS_SETUP_FAILED";
51094332d3Sopenharmony_ciconst std::string HDF_EVENT_TRANS_START_FAILED = "ERR_DH_AUDIO_TRANS_START_FAILED";
52094332d3Sopenharmony_ciconst std::string HDF_EVENT_RESULT_FAILED = "DH_FAILED";
53094332d3Sopenharmony_ci
54094332d3Sopenharmony_ciconst std::string HDF_EVENT_RESTART = "restart";
55094332d3Sopenharmony_ciconst std::string HDF_EVENT_PAUSE = "pause";
56094332d3Sopenharmony_ci
57094332d3Sopenharmony_ciconst std::string PRINT_SPK = "spk";
58094332d3Sopenharmony_ciconst std::string PRINT_MIC = "mic";
59094332d3Sopenharmony_ciconst std::string PRINT_NONE = "none";
60094332d3Sopenharmony_ci
61094332d3Sopenharmony_ciconstexpr int32_t AUDIO_DEVICE_TYPE_UNKNOWN = 0;
62094332d3Sopenharmony_ciconstexpr int32_t AUDIO_DEVICE_TYPE_SPEAKER = 1;
63094332d3Sopenharmony_ciconstexpr int32_t AUDIO_DEVICE_TYPE_MIC = 2;
64094332d3Sopenharmony_ci
65094332d3Sopenharmony_ciconstexpr uint32_t DAUDIO_FADE_NORMALIZATION_FACTOR = 2;
66094332d3Sopenharmony_ciconstexpr uint32_t DAUDIO_FADE_POWER_NUM = 2;
67094332d3Sopenharmony_ciconstexpr uint32_t DAUDIO_FADE_MAXIMUM_VALUE = 2;
68094332d3Sopenharmony_ci
69094332d3Sopenharmony_ciconstexpr uint32_t VOLUME_GROUP_ID_DEFAULT = 0;
70094332d3Sopenharmony_ciconstexpr uint32_t INTERRUPT_GROUP_ID_DEFAULT = 0;
71094332d3Sopenharmony_ci
72094332d3Sopenharmony_ciconstexpr uint32_t AUDIO_SAMPLE_RATE_DEFAULT = 4800;
73094332d3Sopenharmony_ciconstexpr uint32_t AUDIO_CHANNEL_COUNT_DEFAULT = 2;
74094332d3Sopenharmony_ciconstexpr uint32_t AUDIO_FORMAT_DEFAULT = 16;
75094332d3Sopenharmony_ci
76094332d3Sopenharmony_ciconstexpr int32_t MILLISECOND_PER_SECOND = 1000;
77094332d3Sopenharmony_ciconstexpr uint32_t DEFAULT_AUDIO_DATA_SIZE = 3840;
78094332d3Sopenharmony_ciconstexpr size_t RENDER_MAX_FRAME_SIZE = 4096;
79094332d3Sopenharmony_ciconstexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10;
80094332d3Sopenharmony_ciconstexpr int64_t MAX_TIME_INTERVAL_US = 23000;
81094332d3Sopenharmony_ci
82094332d3Sopenharmony_ciconstexpr uint32_t AUDIO_DEFAULT_MAX_VOLUME_LEVEL = 15;
83094332d3Sopenharmony_ciconstexpr uint32_t AUDIO_DEFAULT_MIN_VOLUME_LEVEL = 0;
84094332d3Sopenharmony_ci
85094332d3Sopenharmony_ciconstexpr int32_t DAUDIO_MAX_ASHMEM_LEN = 100000;
86094332d3Sopenharmony_ciconstexpr int32_t DAUDIO_MIN_ASHMEM_LEN = 10;
87094332d3Sopenharmony_ci
88094332d3Sopenharmony_ciconstexpr const char *KEY_DH_ID = "dhId";
89094332d3Sopenharmony_ciconstexpr const char *KEY_STATE = "STATE";
90094332d3Sopenharmony_ciconstexpr const char *IS_UPDATEUI = "IS_UPDATEUI";
91094332d3Sopenharmony_ciconstexpr const char *VOLUME_CHANAGE = "VOLUME_CHANAGE";
92094332d3Sopenharmony_ciconstexpr const char *FIRST_VOLUME_CHANAGE = "FIRST_VOLUME_CHANAGE";
93094332d3Sopenharmony_ciconstexpr const char *INTERRUPT_EVENT = "INTERRUPT_EVENT";
94094332d3Sopenharmony_ciconstexpr const char *FORCE_TYPE = "FORCE_TYPE";
95094332d3Sopenharmony_ciconstexpr const char *HINT_TYPE = "HINT_TYPE";
96094332d3Sopenharmony_ciconstexpr const char *RENDER_STATE_CHANGE_EVENT = "RENDER_STATE_CHANGE_EVENT";
97094332d3Sopenharmony_ciconstexpr const char *AUDIO_STREAM_TYPE = "AUDIO_STREAM_TYPE";
98094332d3Sopenharmony_ciconstexpr int32_t LOW_LATENCY_RENDER_ID = 1 << 1 | 1 << 0;
99094332d3Sopenharmony_ciconstexpr int32_t DEFAULT_RENDER_ID = 1;
100094332d3Sopenharmony_ciconstexpr int32_t DEFAULT_CAPTURE_ID = 1 << 27 | 1 << 0;
101094332d3Sopenharmony_ci} // DistributeHardware
102094332d3Sopenharmony_ci} // OHOS
103094332d3Sopenharmony_ci#endif // OHOS_DAUDIO_CONSTANTS_H
104