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.SoundPool 20 import androidx.annotation.RestrictTo 21 22 /** Interface for a XR Runtime SoundPoolExtensionsWrapper. */ 23 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX) 24 public interface SoundPoolExtensionsWrapper { 25 /** 26 * Plays a sound as a point source. 27 * 28 * @param soundPool The SoundPool to use. 29 * @param soundId The ID of the sound to play. 30 * @param params The PointSourceParams to use. 31 * @param volume The volume of the sound. 32 * @param priority The priority of the sound. 33 * @param loop Whether to loop the sound. 34 * @param rate The playback rate of the sound. 35 * @return The result of the play operation. 36 */ playnull37 public fun play( 38 soundPool: SoundPool, 39 soundId: Int, 40 params: PointSourceParams, 41 volume: Float, 42 priority: Int, 43 loop: Int, 44 rate: Float, 45 ): Int 46 47 /** 48 * Plays a sound as a sound field. 49 * 50 * @param soundPool The SoundPool to use. 51 * @param soundId The ID of the sound to play. 52 * @param attributes The SoundFieldAttributes to use. 53 * @param volume The volume of the sound. 54 * @param priority The priority of the sound. 55 * @param loop Whether to loop the sound. 56 * @param rate The playback rate of the sound. 57 * @return The result of the play operation. 58 */ 59 public fun play( 60 soundPool: SoundPool, 61 soundId: Int, 62 attributes: SoundFieldAttributes, 63 volume: Float, 64 priority: Int, 65 loop: Int, 66 rate: Float, 67 ): Int 68 69 /** 70 * Returns the spatial source type of the sound. 71 * 72 * @param soundPool The SoundPool to use. 73 * @param streamId The stream ID of the sound. 74 * @return The spatial source type of the sound. 75 */ 76 @SpatializerConstants.SourceType 77 public fun getSpatialSourceType(soundPool: SoundPool, streamId: Int): Int 78 } 79