Add audio stream use for only one volume bar of a device

Signed-off-by: zhujie <zhujie81@huawei.com>
This commit is contained in:
zhujie 2022-04-26 15:12:01 +08:00
parent 61b42f20b2
commit f908838c68
2 changed files with 9 additions and 13 deletions

View File

@ -177,11 +177,9 @@ public:
*/
STREAM_ALL = 100
};
static AudioVolumeType GetStreamAllVolumeTypes[] = { STREAM_MUSIC,
STREAM_RING,
STREAM_NOTIFICATION,
STREAM_VOICE_CALL,
STREAM_VOICE_ASSISTANT};
static AudioVolumeType GetStreamAllVolumeTypes[] = {
STREAM_MUSIC, STREAM_RING, STREAM_NOTIFICATION, STREAM_VOICE_CALL, STREAM_VOICE_ASSISTANT
};
static AudioSystemManager *GetInstance();
static float MapVolumeToHDI(int32_t volume);
static int32_t MapVolumeFromHDI(float volume);

View File

@ -252,16 +252,15 @@ int32_t AudioSystemManager::SetVolume(AudioSystemManager::AudioVolumeType volume
}
if (volumeType == STREAM_ALL) {
int32_t flag = AUDIO_CLIENT_SUCCESS;
for (auto &&audioVolumeType : GetAllVolumeTypes) {
AudioStreamType StreamVolType = (AudioStreamType)audioVolumeType;
float volumeToHdi = MapVolumeToHDI(volume);
int32_t setResult = AudioPolicyManager::GetInstance().SetStreamVolume(StreamVolType, volumeToHdi);
if (setResult != flat) {
flag = setResult;
if (setResult != SUCCESS) {
return ERROR;
}
}
return flag;
return SUCCESS;
}
/* Call Audio Policy SetStreamVolume */
@ -346,16 +345,15 @@ int32_t AudioSystemManager::SetMute(AudioSystemManager::AudioVolumeType volumeTy
}
if (volumeType == STREAM_ALL) {
int32_t flag = AUDIO_CLIENT_SUCCESS;
for (auto &&audioVolumeType : GetAllVolumeTypes) {
AudioStreamType StreamVolType = (AudioStreamType)audioVolumeType;
float volumeToHdi = MapVolumeToHDI(volume);
int32_t setResult = AudioPolicyManager::GetInstance().SetStreamVolume(StreamVolType, volumeToHdi);
if (setResult != flat) {
flag = setResult;
if (setResult != SUCCESS) {
return ERROR;
}
}
return flag;
return SUCCESS;
}
/* Call Audio Policy SetStreamMute */