completed music panes
This commit is contained in:
parent
8e205891f1
commit
f1fb1adf47
@ -275,8 +275,8 @@ right-double-arrow
|
||||
holo-pane
|
||||
rotate: false
|
||||
xy: 68, 8
|
||||
size: 3, 3
|
||||
split: 10, 10, 10, 10
|
||||
size: 20, 20
|
||||
split: 9, 9, 9, 9
|
||||
orig: 20, 20
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
@ -284,7 +284,7 @@ holo-pane-down
|
||||
rotate: false
|
||||
xy: 133, 8
|
||||
size: 20, 20
|
||||
split: 10, 10, 10, 10
|
||||
split: 9, 9, 9, 9
|
||||
orig: 20, 20
|
||||
offset: 0, 0
|
||||
index: -1
|
Binary file not shown.
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.1 KiB |
@ -51,6 +51,7 @@ public class PreGameScreen extends ScreenAdapter implements TransitionAdapter {
|
||||
//draw music selector
|
||||
MusicSelectionPage musicSelection = new MusicSelectionPage(core, mainMenu);
|
||||
stage.addActor(musicSelection);
|
||||
musicSelection.beginMusicSearch();
|
||||
|
||||
statusText = new Label(null, core.defaultSkin);
|
||||
statusText.setPosition(1.6f*Gdx.graphics.getWidth(), (Gdx.graphics.getHeight()-statusText.getHeight())/2);
|
||||
|
@ -44,10 +44,9 @@ public class MusicSelectable extends Button {
|
||||
songName = id3v2tag.getTitle();
|
||||
}
|
||||
} catch (UnsupportedTagException | InvalidDataException | IOException e) {
|
||||
e.printStackTrace();
|
||||
Gdx.app.debug("Music Selector", "Error while reading tag for " + musicFile.name());
|
||||
}
|
||||
|
||||
setSize(0.2f*Gdx.graphics.getWidth(), 0.8f*Gdx.graphics.getHeight());
|
||||
} else {
|
||||
wavinfo = new WavInfo(musicFile.file());
|
||||
durationInSeconds = wavinfo.getDurationInSeconds();
|
||||
|
@ -49,8 +49,9 @@ public class MusicSelectionPage extends Page {
|
||||
addActor(loading);
|
||||
|
||||
musicChoices = new Table();
|
||||
musicChoices.defaults().pad(10f);
|
||||
ScrollPane musicChoiceScroller = new ScrollPane(musicChoices);
|
||||
musicChoiceScroller.setSize(getHeight(), getWidth());
|
||||
musicChoiceScroller.setSize(getWidth(), getHeight()*0.85f);
|
||||
addActor(musicChoiceScroller);
|
||||
}
|
||||
|
||||
@ -80,7 +81,7 @@ public class MusicSelectionPage extends Page {
|
||||
this.skin = skin;
|
||||
this.musicDir = musicDir;
|
||||
|
||||
System.out.println(musicDir.exists());
|
||||
// System.out.println(musicDir.exists());
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +98,8 @@ public class MusicSelectionPage extends Page {
|
||||
}
|
||||
});
|
||||
for (int music = startingID; music < musicFiles.length && music < 15; music++) {
|
||||
musicChoices.add(new MusicSelectable(musicFiles[music], musicFileAnnotation, skin));
|
||||
MusicSelectable selectable = new MusicSelectable(musicFiles[music], musicFileAnnotation, skin);
|
||||
musicChoices.add(selectable).prefSize(0.2f*Gdx.graphics.getWidth(), 0.8f*Gdx.graphics.getHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,11 @@ public class WavInfo {
|
||||
private int byteRate;
|
||||
private FileInputStream audioFile;
|
||||
private DataInputStream readStream;
|
||||
private String fileName;
|
||||
|
||||
public WavInfo(File file) throws InvalidParameterException {
|
||||
try {
|
||||
fileName = file.getName();
|
||||
audioFile = new FileInputStream(file);
|
||||
initDataStream();
|
||||
getHeaderInfo();
|
||||
@ -58,8 +60,10 @@ public class WavInfo {
|
||||
|
||||
readStream.skipBytes(38); //38
|
||||
|
||||
// System.out.println(readBytesToString(4).equals("data"));
|
||||
|
||||
if (!readBytesToString(4).equals("data")) { // 4
|
||||
throw new InvalidParameterException("initial data section tag not found");
|
||||
throw new InvalidParameterException("initial data section tag not found on wav: " + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user