!395 新增音频NDK 设置获取音量接口

Merge pull request !395 from ancimoon/master
This commit is contained in:
openharmony_ci 2024-03-25 10:11:00 +00:00 committed by Gitee
commit 1d53a5e45d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 44 additions and 1 deletions

View File

@ -250,6 +250,37 @@ OH_AudioStream_Result OH_AudioRenderer_GetSpeed(OH_AudioRenderer* renderer, floa
*/
OH_AudioStream_Result OH_AudioRenderer_SetSpeed(OH_AudioRenderer* renderer, float speed);
/**
* Set volume of current renderer.
*
* @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer()
* @param volume Volume to set which changes from 0.0 to 1.0.
* @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error.
* @since 12
*/
OH_AudioStream_Result OH_AudioRenderer_SetVolume(OH_AudioRenderer* renderer, float volume);
/**
* Changes the volume with ramp for a duration.
*
* @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer()
* @param volume Volume to set which changes from 0.0 to 1.0.
* @param durationMs Duration for volume ramp, in millisecond.
* @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error.
* @since 12
*/
OH_AudioStream_Result OH_AudioRenderer_SetVolumeWithRamp(OH_AudioRenderer* renderer, float volume, int32_t durationMs);
/**
* Get Volume of current renderer.
*
* @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer()
* @param volume Pointer to a variable to receive the volume.
* @return {@link #AUDIOSTREAM_SUCCESS} or an undesired error.
* @since 12
*/
OH_AudioStream_Result OH_AudioRenderer_GetVolume(OH_AudioRenderer* renderer, float* volume);
#ifdef __cplusplus
}
#endif

View File

@ -39,7 +39,7 @@
"first_introduced": "10",
"name": "OH_AudioStreamBuilder_SetRendererCallback"
},
{
{
"first_introduced": "11",
"name": "OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback"
},
@ -194,5 +194,17 @@
{
"first_introduced": "11",
"name": "OH_AudioRenderer_SetSpeed"
},
{
"first_introduced": "12",
"name": "OH_AudioRenderer_SetVolume"
},
{
"first_introduced": "12",
"name": "OH_AudioRenderer_SetVolumeWithRamp"
},
{
"first_introduced": "12",
"name": "OH_AudioRenderer_GetVolume"
}
]