public final class MidiImpl extends Object implements Midi
The tick
represents the position in the sound data.
Example:
final Midi midi = AudioMidi.loadMidi(Medias.create("music.mid")); midi.play(false); Thread.sleep(1000); midi.pause(); Thread.sleep(1000); midi.resume(); midi.pause(); midi.stop();
VOLUME_MAX, VOLUME_MIN
Modifier and Type | Method and Description |
---|---|
long |
getTicks()
Get the total number of ticks.
|
void |
pause()
Pause the audio (can be resumed).
|
void |
play() |
void |
play(boolean loop)
Play the audio.
|
void |
resume()
Resume the audio (if paused).
|
void |
setLoop(long first,
long last)
Set loop area in tick.
|
void |
setStart(long tick)
Set starting tick (starting audio position).
|
void |
setVolume(int volume) |
void |
stop() |
public void play(boolean loop)
Midi
The audio will be played from the beginning (can be set by Midi.setStart(long)
) until the end.
In case of a loop, audio will be played in loop between the set ticks using Midi.setLoop(long, long)
.
public void setStart(long tick)
Midi
setStart
in interface Midi
tick
- The starting tick [0 - Midi.getTicks()
]
.public void setLoop(long first, long last)
Midi
setLoop
in interface Midi
first
- The first tick [0 - last}]
.last
- The last tick [first - Midi.getTicks()
}]
.public long getTicks()
Midi
public void pause()
Midi
Copyright © 2017 Byron 3D Games Studio. All rights reserved.