From 9cdbe37c876d0bed08c51a5c26c7b3011f5adc96 Mon Sep 17 00:00:00 2001 From: magekkkk Date: Thu, 13 Mar 2025 19:03:10 +0800 Subject: [PATCH] set volume mode apis in ohaudio and avplayer Signed-off-by: magekkkk --- .../common/native_audiostream_base.h | 75 +++++++++++++------ .../common/native_audiostreambuilder.h | 9 +-- 2 files changed, 57 insertions(+), 27 deletions(-) diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index aed8e102c..6ee620f36 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -36,12 +36,9 @@ * @since 10 * @version 1.0 */ - #ifndef NATIVE_AUDIOSTREAM_BASE_H #define NATIVE_AUDIOSTREAM_BASE_H - #include - #ifdef __cplusplus extern "C" { #endif @@ -114,31 +111,27 @@ typedef enum { * @since 10 */ AUDIOSTREAM_SAMPLE_U8 = 0, + /** * Signed 16 bit integer, little endian. * * @since 10 */ AUDIOSTREAM_SAMPLE_S16LE = 1, + /** * Signed 24 bit integer, little endian. * * @since 10 */ AUDIOSTREAM_SAMPLE_S24LE = 2, + /** * Signed 32 bit integer, little endian. * * @since 10 */ - AUDIOSTREAM_SAMPLE_S32LE = 3, - - /** - * Float 32, little endian. - * - * @since 18 - */ - AUDIOSTREAM_SAMPLE_F32LE = 4, + AUDIOSTREAM_SAMPLE_S32LE = 3 } OH_AudioStream_SampleFormat; /** @@ -153,12 +146,13 @@ typedef enum { * @since 10 */ AUDIOSTREAM_ENCODING_TYPE_RAW = 0, + /** * AudioVivid encoding type. * * @since 12 */ - AUDIOSTREAM_ENCODING_TYPE_AUDIOVIVID = 1, + AUDIOSTREAM_ENCODING_TYPE_AUDIOVIVID = 1 } OH_AudioStream_EncodingType; /** @@ -175,84 +169,97 @@ typedef enum { * @since 10 */ AUDIOSTREAM_USAGE_UNKNOWN = 0, + /** * Music usage. * * @since 10 */ AUDIOSTREAM_USAGE_MUSIC = 1, + /** * Voice communication usage. * * @since 10 */ AUDIOSTREAM_USAGE_VOICE_COMMUNICATION = 2, + /** * Voice assistant usage. * * @since 10 */ AUDIOSTREAM_USAGE_VOICE_ASSISTANT = 3, + /** * Alarm usage. * * @since 10 */ AUDIOSTREAM_USAGE_ALARM = 4, + /** * Voice message usage. * * @since 10 */ AUDIOSTREAM_USAGE_VOICE_MESSAGE = 5, + /** * Ringtone usage. * * @since 10 */ AUDIOSTREAM_USAGE_RINGTONE = 6, + /** * Notification usage. * * @since 10 */ AUDIOSTREAM_USAGE_NOTIFICATION = 7, + /** * Accessibility usage, such as screen reader. * * @since 10 */ AUDIOSTREAM_USAGE_ACCESSIBILITY = 8, + /** * Movie or video usage. * * @since 10 */ AUDIOSTREAM_USAGE_MOVIE = 10, + /** * Game sound effect usage. * * @since 10 */ AUDIOSTREAM_USAGE_GAME = 11, + /** * Audiobook usage. * * @since 10 */ AUDIOSTREAM_USAGE_AUDIOBOOK = 12, + /** * Navigation usage. * * @since 10 */ AUDIOSTREAM_USAGE_NAVIGATION = 13, - /** + + /** * Video call usage. * * @since 12 */ - AUDIOSTREAM_USAGE_VIDEO_COMMUNICATION = 17, + AUDIOSTREAM_USAGE_VIDEO_COMMUNICATION = 17 } OH_AudioStream_Usage; /** @@ -267,6 +274,7 @@ typedef enum { * @since 10 */ AUDIOSTREAM_LATENCY_MODE_NORMAL = 0, + /** * This is a low latency audio scene. * @@ -301,42 +309,48 @@ typedef enum { * @since 10 */ AUDIOSTREAM_STATE_INVALID = -1, + /** * Create new instance state. * * @since 10 */ AUDIOSTREAM_STATE_NEW = 0, + /** * The prepared state. * * @since 10 */ AUDIOSTREAM_STATE_PREPARED = 1, + /** * The stream is running. * * @since 10 */ AUDIOSTREAM_STATE_RUNNING = 2, + /** * The stream is stopped. * * @since 10 */ AUDIOSTREAM_STATE_STOPPED = 3, + /** * The stream is released. * * @since 10 */ AUDIOSTREAM_STATE_RELEASED = 4, + /** * The stream is paused. * * @since 10 */ - AUDIOSTREAM_STATE_PAUSED = 5, + AUDIOSTREAM_STATE_PAUSED = 5 } OH_AudioStream_State; /** @@ -351,6 +365,7 @@ typedef enum { * @since 10 */ AUDIOSTREAM_INTERRUPT_FORCE = 0, + /** * Share type, application change audio state. * @@ -371,30 +386,35 @@ typedef enum { * @since 10 */ AUDIOSTREAM_INTERRUPT_HINT_NONE = 0, + /** * Resume the stream. * * @since 10 */ AUDIOSTREAM_INTERRUPT_HINT_RESUME = 1, + /** * Pause the stream. * * @since 10 */ AUDIOSTREAM_INTERRUPT_HINT_PAUSE = 2, + /** * Stop the stream. * * @since 10 */ AUDIOSTREAM_INTERRUPT_HINT_STOP = 3, + /** * Ducked the stream. * * @since 10 */ AUDIOSTREAM_INTERRUPT_HINT_DUCK = 4, + /** * Unducked the stream. * @@ -415,18 +435,21 @@ typedef enum { * @since 10 */ AUDIOSTREAM_SOURCE_TYPE_INVALID = -1, + /** * Mic source type. * * @since 10 */ AUDIOSTREAM_SOURCE_TYPE_MIC = 0, + /** * Voice recognition source type. * * @since 10 */ AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION = 1, + /** * Playback capture source type. * @@ -435,24 +458,28 @@ typedef enum { * @since 10 */ AUDIOSTREAM_SOURCE_TYPE_PLAYBACK_CAPTURE = 2, + /** * Voice communication source type. * * @since 10 */ AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION = 7, + /** * Voice message source type. * * @since 12 */ AUDIOSTREAM_SOURCE_TYPE_VOICE_MESSAGE = 10, + /** * Camcorder source type. * * @since 13 */ AUDIOSTREAM_SOURCE_TYPE_CAMCORDER = 13, + /** * Unprocessed source type. * @@ -471,6 +498,7 @@ typedef enum { * Share mode */ AUDIOSTREAM_INTERRUPT_MODE_SHARE = 0, + /** * Independent mode */ @@ -489,12 +517,13 @@ typedef enum { * @since 12 */ EFFECT_NONE = 0, + /** * Audio Effect Mode effect default. * * @since 12 */ - EFFECT_DEFAULT = 1, + EFFECT_DEFAULT = 1 } OH_AudioStream_AudioEffectMode; /** @@ -635,13 +664,16 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { typedef enum { /* Unknown. */ REASON_UNKNOWN = 0, + /* New Device available. */ REASON_NEW_DEVICE_AVAILABLE = 1, + /* Old Device unavailable. Applications should consider to pause the audio playback when this reason is reported. */ REASON_OLD_DEVICE_UNAVAILABLE = 2, + /* Device is overrode by user or system. */ - REASON_OVERRODE = 3, + REASON_OVERRODE = 3 } OH_AudioStream_DeviceChangeReason; /** @@ -691,10 +723,11 @@ typedef enum { * @since 12 */ AUDIO_STREAM_PRIVACY_TYPE_PUBLIC = 0, + /** Privacy type that stream can not be captured. * @since 12 */ - AUDIO_STREAM_PRIVACY_TYPE_PRIVATE = 1, + AUDIO_STREAM_PRIVACY_TYPE_PRIVATE = 1 } OH_AudioStream_PrivacyType; /** @@ -705,8 +738,9 @@ typedef enum { typedef enum { /** Result of audio data callabck is invalid. */ AUDIO_DATA_CALLBACK_RESULT_INVALID = -1, + /** Result of audio data callabck is valid. */ - AUDIO_DATA_CALLBACK_RESULT_VALID = 0, + AUDIO_DATA_CALLBACK_RESULT_VALID = 0 } OH_AudioData_Callback_Result; /** @@ -748,10 +782,9 @@ typedef enum { */ AUDIOSTREAM_VOLUMEMODE_APP_INDIVIDUAL = 1 } OH_AudioStream_VolumeMode; - #ifdef __cplusplus } #endif - #endif // NATIVE_AUDIOSTREAM_BASE_H + /** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index cedc25bdc..1e2e05ffa 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -36,10 +36,8 @@ * @since 10 * @version 1.0 */ - #ifndef NATIVE_AUDIOSTREAM_BUILDER_H #define NATIVE_AUDIOSTREAM_BUILDER_H - #include "native_audiostream_base.h" #include "native_audiorenderer.h" #ifdef __cplusplus @@ -80,8 +78,8 @@ OH_AudioStream_Result OH_AudioStreamBuilder_Destroy(OH_AudioStreamBuilder* build * * @since 10 * - * @param builder Reference created by OH_AudioStreamBuilder - * @param rate Pointer to a variable that will be set for the channel count. + * @param capturer Reference created by OH_AudioStreamBuilder + * @param channelCount Pointer to a variable that will be set for the channel count. * @return Function result code: * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: @@ -377,10 +375,9 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererWriteDataCallback(OH_Audi */ OH_AudioStream_Result OH_AudioStreamBuilder_SetVolumeMode(OH_AudioStreamBuilder* builder, OH_AudioStream_VolumeMode volumeMode); - #ifdef __cplusplus } #endif - #endif // NATIVE_AUDIOSTREAM_BUILDER_H + /** @} */ \ No newline at end of file -- Gitee