1 /* 2 * Copyright 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.xr.runtime.internal 18 19 import android.media.AudioTrack 20 import androidx.annotation.RestrictTo 21 22 /** Interface for a XR Runtime AudioTrackExtensionsWrapper */ 23 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX) 24 public interface AudioTrackExtensionsWrapper { 25 /** 26 * Returns the [PointSourceParams] of the AudioTrack. 27 * 28 * @param track The AudioTrack to get the PointSourceParams from. 29 * @return The PointSourceParams of the AudioTrack. 30 */ getPointSourceParamsnull31 public fun getPointSourceParams(track: AudioTrack): PointSourceParams? 32 33 /** 34 * Returns the SoundFieldAttributes of the AudioTrack. 35 * 36 * @param track The AudioTrack to get the SoundFieldAttributes from. 37 * @return The SoundFieldAttributes of the AudioTrack. 38 */ 39 public fun getSoundFieldAttributes(track: AudioTrack): SoundFieldAttributes? 40 41 /** 42 * Returns the spatial source type of the AudioTrack. 43 * 44 * @param track The AudioTrack to get the spatial source type from. 45 * @return The spatial source type of the AudioTrack. 46 */ 47 @SpatializerConstants.SourceType public fun getSpatialSourceType(track: AudioTrack): Int 48 49 /** 50 * Sets the PointSourceParams of the AudioTrack. 51 * 52 * <p>The new PointSourceParams will be applied if the [SpatializerConstants.SourceType] of the 53 * AudioTrack was either [SpatializerConstants.DEFAULT]0 or [SpatializerConstants.POINT_SOURCE]. 54 * If the [SpatializerConstants.SourceType] was [SpatializerConstants.SOUND_FIELD], then this 55 * method will have no effect. 56 * 57 * @param track The AudioTrack to set the PointSourceParams on. 58 * @param params The PointSourceParams to set. 59 */ 60 public fun setPointSourceParams(track: AudioTrack, params: PointSourceParams) 61 62 /** 63 * Sets the PointSourceParams of the AudioTrack. 64 * 65 * @param builder The AudioTrack.Builder to set the PointSourceParams on. 66 * @param params The PointSourceParams to set. 67 * @return The AudioTrack.Builder with the PointSourceAttributes set. 68 */ 69 public fun setPointSourceParams( 70 builder: AudioTrack.Builder, 71 params: PointSourceParams, 72 ): AudioTrack.Builder 73 74 /** 75 * Sets the SoundFieldAttributes of the AudioTrack. 76 * 77 * @param builder The AudioTrack.Builder to set the SoundFieldAttributes on. 78 * @param attributes The SoundFieldAttributes to set. 79 * @return The AudioTrack.Builder with the SoundFieldAttributes set. 80 */ 81 public fun setSoundFieldAttributes( 82 builder: AudioTrack.Builder, 83 attributes: SoundFieldAttributes, 84 ): AudioTrack.Builder 85 } 86