Loading media/libaaudio/include/aaudio/AAudio.h +72 −0 Original line number Diff line number Diff line Loading @@ -444,6 +444,22 @@ enum { }; typedef int32_t aaudio_content_type_t; enum { /** * Constant indicating the audio content associated with these attributes will follow the * default platform behavior with regards to which content will be spatialized or not. */ AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO = 1, /** * Constant indicating the audio content associated with these attributes should never * be spatialized. */ AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER = 2, }; typedef int32_t aaudio_spatialization_behavior_t; /** * Defines the audio source. * An audio source defines both a default physical source of audio signal, and a recording Loading Loading @@ -981,6 +997,37 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, aaudio_content_type_t contentType) __INTRODUCED_IN(28); /** * Sets the behavior affecting whether spatialization will be used. * * The AAudio system will use this information to select whether the stream will go * through a spatializer effect or not when the effect is supported and enabled. * * Available since API level 32. * * @param builder reference provided by AAudio_createStreamBuilder() * @param spatializationBehavior the desired behavior with regards to spatialization, eg. * {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} */ AAUDIO_API void AAudioStreamBuilder_setSpatializationBehavior(AAudioStreamBuilder* builder, aaudio_spatialization_behavior_t spatializationBehavior) __INTRODUCED_IN(32); /** * Specifies whether the audio data of this output stream has already been processed for * spatialization. * * If the stream has been processed for spatialization, setting this to true will prevent * issues such as double-processing on platforms that will spatialize audio data. * * Available since API level 32. * * @param builder reference provided by AAudio_createStreamBuilder() * @param isSpatialized true if the content is already processed for binaural or transaural spatial * rendering, false otherwise. */ AAUDIO_API void AAudioStreamBuilder_setIsContentSpatialized(AAudioStreamBuilder* builder, bool isSpatialized) __INTRODUCED_IN(32); /** * Set the input (capture) preset for the stream. * Loading Loading @@ -1787,6 +1834,31 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUC AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) __INTRODUCED_IN(28); /** * Return the spatialization behavior for the stream. * * If none was explicitly set, it will return the default * {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} behavior. * * Available since API level 32. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return spatialization behavior, for example {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} */ AAUDIO_API aaudio_spatialization_behavior_t AAudioStream_getSpatializationBehavior( AAudioStream* stream) __INTRODUCED_IN(32); /** * Return whether the content of the stream is spatialized. * * Available since API level 32. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return true if the content is spatialized */ AAUDIO_API bool AAudioStream_isContentSpatialized(AAudioStream* stream) __INTRODUCED_IN(32); /** * Return the input preset for the stream. * Loading media/libaaudio/src/binding/AAudioStreamConfiguration.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,13 @@ AAudioStreamConfiguration::AAudioStreamConfiguration(const StreamParameters& par setUsage(parcelable.usage); static_assert(sizeof(aaudio_content_type_t) == sizeof(parcelable.contentType)); setContentType(parcelable.contentType); static_assert(sizeof(aaudio_spatialization_behavior_t) == sizeof(parcelable.spatializationBehavior)); setSpatializationBehavior(parcelable.spatializationBehavior); setIsContentSpatialized(parcelable.isContentSpatialized); static_assert(sizeof(aaudio_input_preset_t) == sizeof(parcelable.inputPreset)); setInputPreset(parcelable.inputPreset); setBufferCapacity(parcelable.bufferCapacity); Loading media/libaaudio/src/binding/aidl/aaudio/StreamParameters.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ parcelable StreamParameters { int /* aaudio_direction_t */ direction; // = AAUDIO_DIRECTION_OUTPUT; int /* aaudio_usage_t */ usage; // = AAUDIO_UNSPECIFIED; int /* aaudio_content_type_t */ contentType; // = AAUDIO_UNSPECIFIED; int /* aaudio_spatialization_behavior_t */spatializationBehavior; //= AAUDIO_UNSPECIFIED; boolean isContentSpatialized; // = false; int /* aaudio_input_preset_t */ inputPreset; // = AAUDIO_UNSPECIFIED; int bufferCapacity; // = AAUDIO_UNSPECIFIED; int /* aaudio_allowed_capture_policy_t */ allowedCapturePolicy; // = AAUDIO_UNSPECIFIED; Loading media/libaaudio/src/client/AudioStreamInternal.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { request.getConfiguration().setUsage(getUsage()); request.getConfiguration().setContentType(getContentType()); request.getConfiguration().setSpatializationBehavior(getSpatializationBehavior()); request.getConfiguration().setIsContentSpatialized(isContentSpatialized()); request.getConfiguration().setInputPreset(getInputPreset()); request.getConfiguration().setPrivacySensitive(isPrivacySensitive()); Loading Loading @@ -188,6 +190,8 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { setUsage(configurationOutput.getUsage()); setContentType(configurationOutput.getContentType()); setSpatializationBehavior(configurationOutput.getSpatializationBehavior()); setIsContentSpatialized(configurationOutput.isContentSpatialized()); setInputPreset(configurationOutput.getInputPreset()); // Save device format so we can do format conversion and volume scaling together. Loading media/libaaudio/src/core/AAudioAudio.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,18 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, streamBuilder->setContentType(contentType); } AAUDIO_API void AAudioStreamBuilder_setSpatializationBehavior(AAudioStreamBuilder* builder, aaudio_spatialization_behavior_t spatializationBehavior) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); streamBuilder->setSpatializationBehavior(spatializationBehavior); } AAUDIO_API void AAudioStreamBuilder_setIsContentSpatialized(AAudioStreamBuilder* builder, bool isSpatialized) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); streamBuilder->setIsContentSpatialized(isSpatialized); } AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, aaudio_input_preset_t inputPreset) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); Loading Loading @@ -503,6 +515,19 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea return audioStream->getContentType(); } AAUDIO_API aaudio_spatialization_behavior_t AAudioStream_getSpatializationBehavior( AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); return audioStream->getSpatializationBehavior(); } AAUDIO_API bool AAudioStream_isContentSpatialized(AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); return audioStream->isContentSpatialized(); } AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); Loading Loading
media/libaaudio/include/aaudio/AAudio.h +72 −0 Original line number Diff line number Diff line Loading @@ -444,6 +444,22 @@ enum { }; typedef int32_t aaudio_content_type_t; enum { /** * Constant indicating the audio content associated with these attributes will follow the * default platform behavior with regards to which content will be spatialized or not. */ AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO = 1, /** * Constant indicating the audio content associated with these attributes should never * be spatialized. */ AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER = 2, }; typedef int32_t aaudio_spatialization_behavior_t; /** * Defines the audio source. * An audio source defines both a default physical source of audio signal, and a recording Loading Loading @@ -981,6 +997,37 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, aaudio_content_type_t contentType) __INTRODUCED_IN(28); /** * Sets the behavior affecting whether spatialization will be used. * * The AAudio system will use this information to select whether the stream will go * through a spatializer effect or not when the effect is supported and enabled. * * Available since API level 32. * * @param builder reference provided by AAudio_createStreamBuilder() * @param spatializationBehavior the desired behavior with regards to spatialization, eg. * {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} */ AAUDIO_API void AAudioStreamBuilder_setSpatializationBehavior(AAudioStreamBuilder* builder, aaudio_spatialization_behavior_t spatializationBehavior) __INTRODUCED_IN(32); /** * Specifies whether the audio data of this output stream has already been processed for * spatialization. * * If the stream has been processed for spatialization, setting this to true will prevent * issues such as double-processing on platforms that will spatialize audio data. * * Available since API level 32. * * @param builder reference provided by AAudio_createStreamBuilder() * @param isSpatialized true if the content is already processed for binaural or transaural spatial * rendering, false otherwise. */ AAUDIO_API void AAudioStreamBuilder_setIsContentSpatialized(AAudioStreamBuilder* builder, bool isSpatialized) __INTRODUCED_IN(32); /** * Set the input (capture) preset for the stream. * Loading Loading @@ -1787,6 +1834,31 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUC AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) __INTRODUCED_IN(28); /** * Return the spatialization behavior for the stream. * * If none was explicitly set, it will return the default * {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} behavior. * * Available since API level 32. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return spatialization behavior, for example {@link #AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO} */ AAUDIO_API aaudio_spatialization_behavior_t AAudioStream_getSpatializationBehavior( AAudioStream* stream) __INTRODUCED_IN(32); /** * Return whether the content of the stream is spatialized. * * Available since API level 32. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return true if the content is spatialized */ AAUDIO_API bool AAudioStream_isContentSpatialized(AAudioStream* stream) __INTRODUCED_IN(32); /** * Return the input preset for the stream. * Loading
media/libaaudio/src/binding/AAudioStreamConfiguration.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,13 @@ AAudioStreamConfiguration::AAudioStreamConfiguration(const StreamParameters& par setUsage(parcelable.usage); static_assert(sizeof(aaudio_content_type_t) == sizeof(parcelable.contentType)); setContentType(parcelable.contentType); static_assert(sizeof(aaudio_spatialization_behavior_t) == sizeof(parcelable.spatializationBehavior)); setSpatializationBehavior(parcelable.spatializationBehavior); setIsContentSpatialized(parcelable.isContentSpatialized); static_assert(sizeof(aaudio_input_preset_t) == sizeof(parcelable.inputPreset)); setInputPreset(parcelable.inputPreset); setBufferCapacity(parcelable.bufferCapacity); Loading
media/libaaudio/src/binding/aidl/aaudio/StreamParameters.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ parcelable StreamParameters { int /* aaudio_direction_t */ direction; // = AAUDIO_DIRECTION_OUTPUT; int /* aaudio_usage_t */ usage; // = AAUDIO_UNSPECIFIED; int /* aaudio_content_type_t */ contentType; // = AAUDIO_UNSPECIFIED; int /* aaudio_spatialization_behavior_t */spatializationBehavior; //= AAUDIO_UNSPECIFIED; boolean isContentSpatialized; // = false; int /* aaudio_input_preset_t */ inputPreset; // = AAUDIO_UNSPECIFIED; int bufferCapacity; // = AAUDIO_UNSPECIFIED; int /* aaudio_allowed_capture_policy_t */ allowedCapturePolicy; // = AAUDIO_UNSPECIFIED; Loading
media/libaaudio/src/client/AudioStreamInternal.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,8 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { request.getConfiguration().setUsage(getUsage()); request.getConfiguration().setContentType(getContentType()); request.getConfiguration().setSpatializationBehavior(getSpatializationBehavior()); request.getConfiguration().setIsContentSpatialized(isContentSpatialized()); request.getConfiguration().setInputPreset(getInputPreset()); request.getConfiguration().setPrivacySensitive(isPrivacySensitive()); Loading Loading @@ -188,6 +190,8 @@ aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) { setUsage(configurationOutput.getUsage()); setContentType(configurationOutput.getContentType()); setSpatializationBehavior(configurationOutput.getSpatializationBehavior()); setIsContentSpatialized(configurationOutput.isContentSpatialized()); setInputPreset(configurationOutput.getInputPreset()); // Save device format so we can do format conversion and volume scaling together. Loading
media/libaaudio/src/core/AAudioAudio.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,18 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, streamBuilder->setContentType(contentType); } AAUDIO_API void AAudioStreamBuilder_setSpatializationBehavior(AAudioStreamBuilder* builder, aaudio_spatialization_behavior_t spatializationBehavior) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); streamBuilder->setSpatializationBehavior(spatializationBehavior); } AAUDIO_API void AAudioStreamBuilder_setIsContentSpatialized(AAudioStreamBuilder* builder, bool isSpatialized) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); streamBuilder->setIsContentSpatialized(isSpatialized); } AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, aaudio_input_preset_t inputPreset) { AudioStreamBuilder *streamBuilder = convertAAudioBuilderToStreamBuilder(builder); Loading Loading @@ -503,6 +515,19 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea return audioStream->getContentType(); } AAUDIO_API aaudio_spatialization_behavior_t AAudioStream_getSpatializationBehavior( AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); return audioStream->getSpatializationBehavior(); } AAUDIO_API bool AAudioStream_isContentSpatialized(AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); return audioStream->isContentSpatialized(); } AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) { AudioStream *audioStream = convertAAudioStreamToAudioStream(stream); Loading