public class AudioClip extends Object
Constructor and Description |
---|
AudioClip(File file)
Constructs a new audio clip from an audio file.
|
AudioClip(File file,
boolean storeInMemory)
Constructs a new audio clip from an audio file.
|
AudioClip(String audioLocation)
Constructs a new audio clip from an audio file at a specified location.
|
AudioClip(String audioLocation,
boolean storeInMemory)
Constructs a new audio clip from an audio file at a specified location.
|
AudioClip(String packageName,
String fileName)
Constructs a new audio clip from an audio resource located in specified
package and a given filename.
|
AudioClip(String packageName,
String fileName,
boolean storeInMemory)
Constructs a new audio clip from an audio resource located in specified
package and a given filename.
|
AudioClip(URL url)
Constructs a new audio clip from a resource specified by an URL.
|
AudioClip(URL url,
boolean storeInMemory)
Constructs a new audio clip from a resource specified by an URL.
|
Modifier and Type | Method and Description |
---|---|
double |
getVolume()
Returns volume of audio clip.
|
boolean |
isPlaying()
Returns whether this audio clip is playing.
|
void |
play()
Plays this audio clip.
|
void |
playAsActionSound()
Plays this audio clip as an action sound.
|
void |
playInLoop()
Plays this audio clip in the infinite loop.
|
void |
setVolume(double volume)
Sets volume of audio clip.
|
void |
stop()
Stops this audio clip.
|
void |
stopAllActionSounds()
Stops all action sounds of this audio clip.
|
public AudioClip(URL url, boolean storeInMemory)
url
- the URL of the audio filestoreInMemory
- true, if the audio file data should be loaded to memory, false
otherwise.public AudioClip(URL url)
url
- the URL of the audio filepublic AudioClip(File file, boolean storeInMemory)
file
- the audio file.storeInMemory
- true, if the audio file data should be loaded to memory, false
otherwise.public AudioClip(File file)
file
- the audio file.public AudioClip(String audioLocation, boolean storeInMemory)
audioLocation
- the string with location of an audio file (file or resource).storeInMemory
- true, if the audio file data should be loaded to memory, false
otherwise.public AudioClip(String audioLocation)
audioLocation
- the string with location of an audio file (file or resource).public AudioClip(String packageName, String fileName, boolean storeInMemory)
packageName
- the package where resource file is searchedfileName
- the filename (in the package given by parameter packageName)storeInMemory
- true, if the audio file data should be loaded to memory, false
otherwise.public AudioClip(String packageName, String fileName)
packageName
- the package where resource file is searchedfileName
- the filename (in the package given by parameter packageName)public void play()
public void stop()
public void playInLoop()
public boolean isPlaying()
public void playAsActionSound()
public void stopAllActionSounds()
public double getVolume()
public void setVolume(double volume)
volume
- the desired volume of audio clip.Copyright © 2017. All rights reserved.