|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.samsung.util.AudioClip
An AudioClip plays, stops, resumes or pauses audio data received from the file or buffer.
if(AudioClip.isSupported()) {
String path = new String("\resource\sample.mmf")
AudioClip audioClip = new AudioClip(TYPE_MMF,path);
audioClip.play(1, 5);
audioClip.pause();
audioClip.resume();
audioClip.stop();
}
| Field Summary | |
static int |
TYPE_MIDI
The "MIDI" audio type constant. |
static int |
TYPE_MMF
The "MMF" audio type constant. |
static int |
TYPE_MP3
The "MP3" audio type constant. |
| Constructor Summary | |
AudioClip(int type,
byte[] audioData,
int audioOffset,
int audioLength)
Constructs a new instance of AudioClip with type and data which stored in
the specified byte array at the specified offset and length. |
|
AudioClip(int type,
java.lang.String filename)
Constructs a new instance of AudioClip with type and data from the named resource. |
|
| Method Summary | |
static boolean |
isSupported()
Gets an information whether audio clip is supported by the device. |
void |
pause()
Pauses audio. |
void |
play(int loop,
int volume)
Plays audio with specified volume for specified loop. |
void |
resume()
Resumes audio on a paused position. |
void |
stop()
Stops the audio and releases its resources. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int TYPE_MMF
Value 1 is assigned to TYPE_MMF.
public static final int TYPE_MP3
Value 2 is assigned to TYPE_MP3.
public static final int TYPE_MIDI
Value 3 is assigned to TYPE_MIDI.
| Constructor Detail |
public AudioClip(int type,
byte[] audioData,
int audioOffset,
int audioLength)
AudioClip with type and data which stored in
the specified byte array at the specified offset and length.
type - one of TYPE_MMF, TYPE_MP3, or TYPE_MIDI, Current devices only support TYPE_MMF.audioData - the array of audio data in a supported audio formataudioOffset - offset of audio dataaudioLength - length of audio data
java.lang.IllegalArgumentException - if type is not legal values
java.lang.NullPointerException - if audioData is
null
java.lang.ArrayIndexOutOfBoundsException - if audioOffset
or audioLength
specify an invalid range
public AudioClip(int type,
java.lang.String filename)
throws java.io.IOException
AudioClip with type and data from the named resource.
type - one of TYPE_MMF, TYPE_MP3, or TYPE_MIDI, Current devices only support TYPE_MMF.filename - the name of the resource containing the audio data in one of the supported audio formats
java.lang.IllegalArgumentException - if type is not legal values
java.lang.NullPointerException - if filename is null
java.io.IOException - if the resource does not exist| Method Detail |
public void play(int loop,
int volume)
loop - range 0 to 255volume - range from 0 to 5
java.lang.IllegalArgumentException - Thrown if loop, or volume are invalid value.
java.lang.IllegalStateException - Thrown if the device does not support AudioClippublic void stop()
If stop is called on a stopped AudioClip
the request is ignored.
java.lang.IllegalStateException - Thrown if the device does not support AudioClippublic void pause()
resume() to resume audio from the current position.
java.lang.IllegalStateException - Thrown if the device does not support AudioClipresumepublic void resume()
java.lang.IllegalStateException - Thrown if the device does not support AudioClippausepublic static boolean isSupported()
AudioClip is supported.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||