1 /* 2 * Copyright (c) 2022-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 OHOS_DAUDIO_CONSTANTS_H 17 #define OHOS_DAUDIO_CONSTANTS_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 // Distributed Auido Parameters 24 const std::string KEY_AUDIOPORT_DIR = "portdir"; 25 const std::string KEY_AUDIOFORMAT = "format"; 26 const std::string KEY_AUDIOCHANNELMASK = "channel"; 27 const std::string KEY_AUDIOSAMPLERATE = "samplerate"; 28 29 const std::string VALUE_AUDIOPORT_DIR_IN = "portdirin"; 30 const std::string VALUE_AUDIOPORT_DIR_OUT = "portdirout"; 31 const std::string VALUE_AUDIOPORT_DIR_INOUT = "portdirinout"; 32 33 const std::string DEVICE_TYPE_OUTPUT_DEFAULT = "0"; 34 const std::string DEVICE_TYPE_INPUT_DEFAULT = "1"; 35 36 const std::string VOLUME_GROUP_ID = "VOLUME_GROUP_ID"; 37 const std::string INTERRUPT_GROUP_ID = "INTERRUPT_GROUP_ID"; 38 39 // Distributed Auido Parameters 40 const std::string VOLUME_LEVEL = "VOLUME_LEVEL"; 41 const std::string VOLUME_EVENT_TYPE = "EVENT_TYPE"; 42 const std::string MAX_VOLUME_LEVEL = "MAX_VOLUME_LEVEL"; 43 const std::string MIN_VOLUME_LEVEL = "MIN_VOLUME_LEVEL"; 44 const std::string STREAM_MUTE_STATUS = "STREAM_MUTE_STATUS"; 45 46 const std::string HDF_EVENT_RESULT_SUCCESS = "DH_SUCCESS"; 47 const std::string HDF_EVENT_RESULT_FAILED = "DH_FAILED"; 48 49 const std::string HDF_EVENT_RESTART = "restart"; 50 const std::string HDF_EVENT_PAUSE = "pause"; 51 52 constexpr int32_t AUDIO_DEVICE_TYPE_UNKNOWN = 0; 53 constexpr int32_t AUDIO_DEVICE_TYPE_SPEAKER = 1; 54 constexpr int32_t AUDIO_DEVICE_TYPE_MIC = 2; 55 56 constexpr uint32_t DAUDIO_FADE_NORMALIZATION_FACTOR = 2; 57 constexpr uint32_t DAUDIO_FADE_POWER_NUM = 2; 58 constexpr uint32_t DAUDIO_FADE_MAXIMUM_VALUE = 2; 59 60 constexpr uint32_t VOLUME_GROUP_ID_DEFAULT = 0; 61 constexpr uint32_t INTERRUPT_GROUP_ID_DEFAULT = 0; 62 63 constexpr uint32_t AUDIO_SAMPLE_RATE_DEFAULT = 4800; 64 constexpr uint32_t AUDIO_CHANNEL_COUNT_DEFAULT = 2; 65 constexpr uint32_t AUDIO_FORMAT_DEFAULT = 16; 66 67 constexpr int32_t MILLISECOND_PER_SECOND = 1000; 68 constexpr uint32_t DEFAULT_AUDIO_DATA_SIZE = 4096; 69 constexpr int64_t AUDIO_OFFSET_FRAME_NUM = 10; 70 71 constexpr uint32_t AUDIO_DEFAULT_MAX_VOLUME_LEVEL = 15; 72 constexpr uint32_t AUDIO_DEFAULT_MIN_VOLUME_LEVEL = 0; 73 74 constexpr int32_t DAUDIO_MAX_ASHMEM_LEN = 100000; 75 constexpr int32_t DAUDIO_MIN_ASHMEM_LEN = 10; 76 } // DistributeHardware 77 } // OHOS 78 #endif // OHOS_DAUDIO_CONSTANTS_H 79