public class SoundHandler extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
SoundHandler.SoundThread |
| Modifier and Type | Field and Description |
|---|---|
ArrayList<SoundHandler.SoundThread> |
threads
An array of all sound threads
|
| Constructor and Description |
|---|
SoundHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
init() |
void |
mute()
Mutes the sound
|
void |
mute(int threadIndex)
Mutes the sound of a specific thread
|
void |
playSound(File file,
int repeatTime) |
void |
playSound(InputStream stream,
int repeatTime) |
void |
playSound(URI uri,
int repeatTime)
Starts a thread to play a sound, provided in the passed file, at the
specified volume for the specified amount of time.
|
SoundHandler |
setMaxThreads(int max)
Sets the maximum amount of threads.
|
void |
stopSound(int index)
Stops a sound from playing.
|
void |
stopSound(SoundHandler.SoundThread thread)
Stops a sound from playing
|
void |
unmute()
Unmutes the sound.
|
void |
unmute(int threadIndex)
Unmutes the sound of a specific thread.
|
public ArrayList<SoundHandler.SoundThread> threads
public void init()
public SoundHandler setMaxThreads(int max)
max - public void playSound(URI uri, int repeatTime)
uri - repeatTime - (1 = repeat once, and -1 = play until stopSound() is
called).public void playSound(InputStream stream, int repeatTime)
public void playSound(File file, int repeatTime)
public void stopSound(int index)
index - (the index in the "threads" array)public void stopSound(SoundHandler.SoundThread thread)
thread - (a copy of the thread to stop)public void mute()
public void mute(int threadIndex)
threadIndex - public void unmute()
public void unmute(int threadIndex)
threadIndex - Copyright © 2022. All rights reserved.