SoundPool.Load Method

Definition

Overloads

Load(AssetFileDescriptor, Int32)

Load the sound from an asset file descriptor.

Load(String, Int32)

Load the sound from the specified path.

Load(Context, Int32, Int32)

Load the sound from the specified APK resource.

Load(FileDescriptor, Int64, Int64, Int32)

Load the sound from a FileDescriptor.

Load(AssetFileDescriptor, Int32)

Load the sound from an asset file descriptor.

[Android.Runtime.Register("load", "(Landroid/content/res/AssetFileDescriptor;I)I", "GetLoad_Landroid_content_res_AssetFileDescriptor_IHandler")]
public virtual int Load (Android.Content.Res.AssetFileDescriptor? afd, int priority);
[<Android.Runtime.Register("load", "(Landroid/content/res/AssetFileDescriptor;I)I", "GetLoad_Landroid_content_res_AssetFileDescriptor_IHandler")>]
abstract member Load : Android.Content.Res.AssetFileDescriptor * int -> int
override this.Load : Android.Content.Res.AssetFileDescriptor * int -> int

Parameters

afd
AssetFileDescriptor

an asset file descriptor

priority
Int32

the priority of the sound. Currently has no effect. Use a value of 1 for future compatibility.

Returns

a sound ID. This value can be used to play or unload the sound.

Attributes

Remarks

Load the sound from an asset file descriptor.

Java documentation for android.media.SoundPool.load(android.content.res.AssetFileDescriptor, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Load(String, Int32)

Load the sound from the specified path.

[Android.Runtime.Register("load", "(Ljava/lang/String;I)I", "GetLoad_Ljava_lang_String_IHandler")]
public virtual int Load (string? path, int priority);
[<Android.Runtime.Register("load", "(Ljava/lang/String;I)I", "GetLoad_Ljava_lang_String_IHandler")>]
abstract member Load : string * int -> int
override this.Load : string * int -> int

Parameters

path
String

the path to the audio file

priority
Int32

the priority of the sound. Currently has no effect. Use a value of 1 for future compatibility.

Returns

a sound ID. This value can be used to play or unload the sound.

Attributes

Remarks

Load the sound from the specified path.

Java documentation for android.media.SoundPool.load(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Load(Context, Int32, Int32)

Load the sound from the specified APK resource.

[Android.Runtime.Register("load", "(Landroid/content/Context;II)I", "GetLoad_Landroid_content_Context_IIHandler")]
public virtual int Load (Android.Content.Context? context, int resId, int priority);
[<Android.Runtime.Register("load", "(Landroid/content/Context;II)I", "GetLoad_Landroid_content_Context_IIHandler")>]
abstract member Load : Android.Content.Context * int * int -> int
override this.Load : Android.Content.Context * int * int -> int

Parameters

context
Context

the application context

resId
Int32

the resource ID

priority
Int32

the priority of the sound. Currently has no effect. Use a value of 1 for future compatibility.

Returns

a sound ID. This value can be used to play or unload the sound.

Attributes

Remarks

Load the sound from the specified APK resource.

Note that the extension is dropped. For example, if you want to load a sound from the raw resource file "explosion.mp3", you would specify "R.raw.explosion" as the resource ID. Note that this means you cannot have both an "explosion.wav" and an "explosion.mp3" in the res/raw directory.

Java documentation for android.media.SoundPool.load(android.content.Context, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Load(FileDescriptor, Int64, Int64, Int32)

Load the sound from a FileDescriptor.

[Android.Runtime.Register("load", "(Ljava/io/FileDescriptor;JJI)I", "GetLoad_Ljava_io_FileDescriptor_JJIHandler")]
public virtual int Load (Java.IO.FileDescriptor? fd, long offset, long length, int priority);
[<Android.Runtime.Register("load", "(Ljava/io/FileDescriptor;JJI)I", "GetLoad_Ljava_io_FileDescriptor_JJIHandler")>]
abstract member Load : Java.IO.FileDescriptor * int64 * int64 * int -> int
override this.Load : Java.IO.FileDescriptor * int64 * int64 * int -> int

Parameters

fd
FileDescriptor

a FileDescriptor object

offset
Int64

offset to the start of the sound

length
Int64

length of the sound

priority
Int32

the priority of the sound. Currently has no effect. Use a value of 1 for future compatibility.

Returns

a sound ID. This value can be used to play or unload the sound.

Attributes

Remarks

Load the sound from a FileDescriptor.

This version is useful if you store multiple sounds in a single binary. The offset specifies the offset from the start of the file and the length specifies the length of the sound within the file.

Java documentation for android.media.SoundPool.load(java.io.FileDescriptor, long, long, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to