Added many missing Javadocs; other minor cleanup.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -228,7 +228,7 @@ public class MusicController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position in the current track, in ms.
|
||||
* Returns the position in the current track, in milliseconds.
|
||||
* If no track is loaded, 0 will be returned.
|
||||
*/
|
||||
public static int getPosition() {
|
||||
@@ -242,6 +242,7 @@ public class MusicController {
|
||||
|
||||
/**
|
||||
* Seeks to a position in the current track.
|
||||
* @param position the new track position (in ms)
|
||||
*/
|
||||
public static boolean setPosition(int position) {
|
||||
return (trackExists() && position >= 0 && player.setPosition(position / 1000f));
|
||||
@@ -259,6 +260,7 @@ public class MusicController {
|
||||
return -1;
|
||||
|
||||
if (duration == 0) {
|
||||
// TAudioFileFormat method only works for MP3s
|
||||
if (lastBeatmap.audioFilename.getName().endsWith(".mp3")) {
|
||||
try {
|
||||
AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(lastBeatmap.audioFilename);
|
||||
@@ -270,6 +272,8 @@ public class MusicController {
|
||||
}
|
||||
} catch (UnsupportedAudioFileException | IOException e) {}
|
||||
}
|
||||
|
||||
// fallback: use beatmap end time (often not the track duration)
|
||||
duration = lastBeatmap.endTime;
|
||||
}
|
||||
return duration;
|
||||
@@ -291,7 +295,7 @@ public class MusicController {
|
||||
|
||||
/**
|
||||
* Sets the music volume.
|
||||
* @param volume [0, 1]
|
||||
* @param volume the new volume [0, 1]
|
||||
*/
|
||||
public static void setVolume(float volume) {
|
||||
SoundStore.get().setMusicVolume((isTrackDimmed()) ? volume * dimLevel : volume);
|
||||
@@ -299,7 +303,7 @@ public class MusicController {
|
||||
|
||||
/**
|
||||
* Sets the music pitch (and speed).
|
||||
* @param pitch
|
||||
* @param pitch the new pitch
|
||||
*/
|
||||
public static void setPitch(float pitch) {
|
||||
SoundStore.get().setMusicPitch(pitch);
|
||||
|
||||
Reference in New Issue
Block a user