completed music panes

This commit is contained in:
Harrison Deng 2017-04-21 10:25:24 -05:00
parent 8e205891f1
commit f1fb1adf47
6 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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());
}
}
}

View File

@ -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);
}
}