1 /* 2 * Copyright (c) 2024 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 #ifndef AUDIO_SESSION_INFO_H 16 #define AUDIO_SESSION_INFO_H 17 18 namespace OHOS { 19 namespace AudioStandard { 20 enum class AudioConcurrencyMode { 21 INVALID = -1, 22 DEFAULT = 0, 23 MIX_WITH_OTHERS = 1, 24 DUCK_OTHERS = 2, 25 PAUSE_OTHERS = 3, 26 SILENT = 4, 27 STANDALONE = 5, 28 }; 29 30 struct AudioSessionStrategy { 31 mutable AudioConcurrencyMode concurrencyMode; 32 }; 33 34 enum class AudioSessionDeactiveReason { 35 LOW_PRIORITY = 0, // All audio streams have been interrupted. 36 TIMEOUT = 1, // The audio session remains empty for one minute. 37 }; 38 39 struct AudioSessionDeactiveEvent { 40 AudioSessionDeactiveReason deactiveReason; 41 }; 42 43 enum class AudioSessionType { 44 DEFAULT = 0, 45 MEDIA = 1, 46 SONIFICATION = 2, 47 CALL = 3, 48 VOIP = 4, 49 SYSTEM = 5, 50 NOTIFICATION = 6, 51 DTMF = 7, 52 VOICE_ASSISTANT = 8, 53 }; 54 55 /** 56 * Audio session scene. 57 * @since 20 58 */ 59 enum class AudioSessionScene { 60 /** 61 * Invalid audio session scene. 62 * @since 20 63 */ 64 INVALID = -1, 65 /** 66 * Scene for media. 67 * @since 20 68 */ 69 MEDIA = 0, 70 /** 71 * Scene for game. 72 * @since 20 73 */ 74 GAME = 1, 75 /** 76 * Scene for voice communication. 77 * @since 20 78 */ 79 VOICE_COMMUNICATION = 2, 80 }; 81 82 /** 83 * Enumerates the session state change hints. 84 * @since 20 85 */ 86 enum class AudioSessionStateChangeHint { 87 /** 88 * Invalid audio session state change hint. 89 * @since 20 90 */ 91 INVALID = -1, 92 /** 93 * Resume the playback. 94 * @since 20 95 */ 96 RESUME = 0, 97 98 /** 99 * Paused/Pause the playback. 100 * @since 20 101 */ 102 PAUSE = 1, 103 104 /** 105 * Stopped/Stop the playback due to focus priority. 106 * @since 20 107 */ 108 STOP = 2, 109 110 /** 111 * Stopped/Stop the playback due to no audio stream for a long time. 112 * @since 20 113 */ 114 TIME_OUT_STOP = 3, 115 116 /** 117 * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) 118 * @since 20 119 */ 120 DUCK = 4, 121 122 /** 123 * Unducked the playback. 124 * @since 20 125 */ 126 UNDUCK = 5, 127 }; 128 129 /** 130 * Audio session state changed event. 131 * @since 20 132 */ 133 struct AudioSessionStateChangedEvent { 134 /** 135 * Audio session state changed hints. 136 * @since 20 137 */ 138 AudioSessionStateChangeHint stateChangeHint; 139 }; 140 } // namespace AudioStandard 141 } // namespace OHOS 142 #endif // AUDIO_SESSION_INFO_H 143