• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_SESSION_H
17 #define AUDIO_SESSION_H
18 
19 #include "audio_service_client.h"
20 
21 namespace OHOS {
22 namespace AudioStandard {
23 enum SessionType {
24     SESSION_CONTROL,
25     SESSION_PLAYBACK,
26     SESSION_RECORD
27 };
28 
29 struct AudioDevDescriptor {
30 };
31 
32 class AudioSession : public AudioServiceClient {
33 public:
34     AudioDevDescriptor *GetActiveAudioSinkDevice(uint32_t sessionID);
35     AudioDevDescriptor *GetActiveAudioSourceDevice(uint32_t sessionID);
36 
37     bool SetActiveAudioSinkDevice(uint32_t sessionID, const AudioDevDescriptor &audioDesc);
38     bool SetActiveAudioSourceDevice(uint32_t sessionID, const AudioDevDescriptor &audioDesc);
39     float GetAudioStreamVolume(uint32_t sessionID);
40     float GetAudioDeviceVolume(uint32_t sessionID);
41     bool SetAudioStreamVolume(uint32_t sessionID, float volume);
42     bool SetAudioDeviceVolume(uint32_t sessionID, float volume);
43 
44 private:
45     AudioSession *CreateSession(SessionType eSession);
46 };
47 } // namespace AudioStandard
48 } // namespace OHOS
49 #endif // AUDIO_SESSION_H
50