1
0
Fork 0

improve midi player

This commit is contained in:
Sen 2025-08-25 18:31:15 +02:00
parent f8b07a32b9
commit 463601faa7
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
2 changed files with 28 additions and 10 deletions

View file

@ -23,8 +23,8 @@ public enum MidiBank implements Identifyable, Displayable {
SWTIMBR("swtimbr", "SWTimbr"), SWTIMBR("swtimbr", "SWTimbr"),
TMB_DEFAULT("tmb_default", "TMB"), TMB_DEFAULT("tmb_default", "TMB"),
WALLENCE("wallence", "Wallence"), WALLENCE("wallence", "Wallence"),
FAT2("fat2", "TheFatMan 2OP"), FAT2("fat2", "FatMan 2OP"),
FAT4("fat4", "TheFatMan 4OP"), FAT4("fat4", "FatMan 4OP"),
OP2X2("op2x2", "2x2OP"), OP2X2("op2x2", "2x2OP"),
WALLACE("wallace", "Wallace"), WALLACE("wallace", "Wallace"),
EARTHSIEG("earthsieg", "Earthsieg"), EARTHSIEG("earthsieg", "Earthsieg"),

View file

@ -7,6 +7,7 @@ import client.Client.FileMode;
import client.audio.MidiDecoder; import client.audio.MidiDecoder;
import client.gui.element.ActButton; import client.gui.element.ActButton;
import client.gui.element.ButtonCallback; import client.gui.element.ButtonCallback;
import client.gui.element.Element;
import client.gui.element.Fill; import client.gui.element.Fill;
import client.gui.element.GuiList; import client.gui.element.GuiList;
import client.gui.element.ListEntry; import client.gui.element.ListEntry;
@ -33,6 +34,24 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
GuiPlayer.this.select(); GuiPlayer.this.select();
} }
} }
private class Visualizer extends Element {
public Visualizer(int x, int y, int w, int h) {
super(x, y, w, h, null);
}
public boolean canHover() {
return false;
}
protected void drawBackground() {
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0xff000000);
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
}
}
public static enum RepeatMode { public static enum RepeatMode {
REPEAT_OFF("N"), REPEAT_OFF("N"),
@ -230,11 +249,11 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
public void init(int width, int height) { public void init(int width, int height) {
super.init(width, height); super.init(width, height);
this.setDimensions(320, height, 18, height - 18); this.setDimensions(360, height, 18, height - 18);
this.add(new NavButton(0, 0, 60, 18, GuiMenu.INSTANCE, "Zurück")); this.add(new NavButton(0, 0, 60, 18, GuiMenu.INSTANCE, "Zurück"));
this.add(new Fill(60, 0, 242, 18, "SKC OPL MIDI Player v 0.0.1 (~ Sen)", true)); this.add(new Fill(60, 0, 142, 18, "OPL MIDI Player"));
this.addSelector("mid_visualizer", 302, 0, 18, 18); this.addSelector("mid_visualizer", 202, 0, 158, 18);
this.playButton = this.add(new ActButton(0, height - 18, 18, 18, new ButtonCallback() { this.playButton = this.add(new ActButton(0, height - 18, 18, 18, new ButtonCallback() {
public void use(ActButton elem, PressType action) { public void use(ActButton elem, PressType action) {
@ -282,8 +301,8 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
} }
}, "X")); }, "X"));
this.addSelector("mid_opl_bank", 162, height - 18, 122, -18); this.addSelector("mid_opl_bank", 162, height - 18, 162, -18);
this.add(new ActButton(284, height - 18, 18, 18, new ButtonCallback() { this.add(new ActButton(324, height - 18, 18, 18, new ButtonCallback() {
public void use(ActButton elem, PressType action) { public void use(ActButton elem, PressType action) {
GuiPlayer.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "MIDIs laden", null, new FileCallback() { GuiPlayer.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "MIDIs laden", null, new FileCallback() {
public void selected(File file) { public void selected(File file) {
@ -292,7 +311,7 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
}); });
} }
}, "+")); }, "+"));
this.add(new ActButton(302, height - 18, 18, 18, new ButtonCallback() { this.add(new ActButton(342, height - 18, 18, 18, new ButtonCallback() {
public void use(ActButton elem, PressType action) { public void use(ActButton elem, PressType action) {
GuiPlayer.this.gm.showFileDialog(FileMode.DIRECTORY_LOAD, "MIDIs laden", null, new FileCallback() { GuiPlayer.this.gm.showFileDialog(FileMode.DIRECTORY_LOAD, "MIDIs laden", null, new FileCallback() {
public void selected(File file) { public void selected(File file) {
@ -306,8 +325,7 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
// GuiPlayer.this.test(0, 255, 500, 36); // GuiPlayer.this.test(0, 255, 500, 36);
// } // }
// }, "MIDI-Bank testen")); // }, "MIDI-Bank testen"));
this.add(new Visualizer(360, 0, width - 360, height));
// gui_add_custom(win, 720, 0, frame_x - 720, frame_y, gui_render_player);
this.updateDisplay(); this.updateDisplay();
} }