addd midi test
This commit is contained in:
parent
dd38d049d4
commit
432b52ad6a
3 changed files with 42 additions and 16 deletions
|
@ -3462,22 +3462,7 @@ public class Client implements IThreadListener {
|
||||||
}
|
}
|
||||||
MidiHandle midi;
|
MidiHandle midi;
|
||||||
try {
|
try {
|
||||||
midi = new MidiHandle(data, this.midiNoWait, this.midiVoices, this.midiBank, this.midiKeep, this.midiUnknown, this.midiVelocity) {
|
midi = new MidiHandle(data, this.midiNoWait, this.midiVoices, this.midiBank, this.midiKeep, this.midiUnknown, this.midiVelocity);
|
||||||
private int pos = 0;
|
|
||||||
|
|
||||||
public long process() {
|
|
||||||
this.bank.progchange(this.chip, (byte)0, (byte)(this.pos < 128 ? this.pos : 0));
|
|
||||||
this.bank.progchange(this.chip, (byte)9, (byte)0);
|
|
||||||
Log.SOUND.info("MIDI-Test #%d", this.pos);
|
|
||||||
this.bank.noteon(this.chip, this.pos < 128 ? (byte)0 : (byte)9, (byte)(this.pos < 128 ? (byte)36 : (this.pos - 128)), (byte)127);
|
|
||||||
this.pos++;
|
|
||||||
if(this.pos == 128)
|
|
||||||
this.pos = 128 + 35;
|
|
||||||
else if(this.pos == 128 + 82)
|
|
||||||
this.pos = 0;
|
|
||||||
return 1000000000L;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
catch(Throwable e) {
|
catch(Throwable e) {
|
||||||
Log.SOUND.error(e, "Konnte MIDI '%s' nicht laden", file);
|
Log.SOUND.error(e, "Konnte MIDI '%s' nicht laden", file);
|
||||||
|
@ -3486,6 +3471,16 @@ public class Client implements IThreadListener {
|
||||||
midi.setDebug(this.midiDebug);
|
midi.setDebug(this.midiDebug);
|
||||||
this.audio.alMidi(midi);
|
this.audio.alMidi(midi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMidi() {
|
||||||
|
MidiHandle midi = new MidiHandle(this.midiVoices, this.midiBank, this.midiKeep, this.midiUnknown, this.midiVelocity);
|
||||||
|
midi.setDebug(this.midiDebug);
|
||||||
|
this.audio.alMidi(midi);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopMidi() {
|
||||||
|
this.audio.alMidi(null);
|
||||||
|
}
|
||||||
|
|
||||||
private void displayTick(int posX, int posY, int posZ) {
|
private void displayTick(int posX, int posY, int posZ) {
|
||||||
int range = 16;
|
int range = 16;
|
||||||
|
|
|
@ -7869,6 +7869,14 @@ public class AudioInterface implements Runnable {
|
||||||
this.bank = new BankHandle(this.chip, bank.getData(), keep, useunkn, (byte)velofunc);
|
this.bank = new BankHandle(this.chip, bank.getData(), keep, useunkn, (byte)velofunc);
|
||||||
this.playing = true;
|
this.playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MidiHandle(int voices, MidiBank bank, boolean keep, boolean useunkn, int velofunc) {
|
||||||
|
this.tracks = null;
|
||||||
|
this.tpqn = 0;
|
||||||
|
this.nowait = false;
|
||||||
|
this.chip = new OPLChip(48000, voices, 0, false, false);
|
||||||
|
this.bank = new BankHandle(this.chip, bank.getData(), keep, useunkn, (byte)velofunc);
|
||||||
|
}
|
||||||
|
|
||||||
private void setTempo(int tempo) {
|
private void setTempo(int tempo) {
|
||||||
this.uspb = tempo;
|
this.uspb = tempo;
|
||||||
|
@ -8122,6 +8130,19 @@ public class AudioInterface implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long process() {
|
public long process() {
|
||||||
|
if(this.tracks == null) {
|
||||||
|
this.bank.progchange(this.chip, (byte)0, (byte)(this.ticktime < 128 ? this.ticktime : 0));
|
||||||
|
this.bank.progchange(this.chip, (byte)9, (byte)0);
|
||||||
|
Log.SOUND.user("MIDI-Test %s%d", this.ticktime < 128 ? "#" : "P", this.ticktime < 128 ? this.ticktime : this.ticktime - 128);
|
||||||
|
this.bank.noteon(this.chip, this.ticktime < 128 ? (byte)0 : (byte)9, (byte)(this.ticktime < 128 ? (byte)36 : (this.ticktime - 128)), (byte)127);
|
||||||
|
this.ticktime++;
|
||||||
|
if(this.ticktime == 128)
|
||||||
|
this.ticktime = 128 + 35;
|
||||||
|
else if(this.ticktime == 128 + 82)
|
||||||
|
this.ticktime = 0;
|
||||||
|
return 500000000L;
|
||||||
|
}
|
||||||
|
|
||||||
if(!this.playing && (this.nowait || !this.chip.isPlaying())) {
|
if(!this.playing && (this.nowait || !this.chip.isPlaying())) {
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,16 @@ public class GuiMenu extends Gui {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, "MIDI-Player"));
|
}, "MIDI-Player"));
|
||||||
|
this.add(new ActButton(0, 130, 180, 0, new ButtonCallback() {
|
||||||
|
public void use(ActButton elem, PressType action) {
|
||||||
|
GuiMenu.this.gm.testMidi();
|
||||||
|
}
|
||||||
|
}, "MIDI-Bank testen"));
|
||||||
|
this.add(new ActButton(0, 150, 180, 0, new ButtonCallback() {
|
||||||
|
public void use(ActButton elem, PressType action) {
|
||||||
|
GuiMenu.this.gm.stopMidi();
|
||||||
|
}
|
||||||
|
}, "MIDI stoppen"));
|
||||||
this.shift();
|
this.shift();
|
||||||
this.add(new Label(4, 4, 200, 0, Color.VIOLET + Client.VERSION, true));
|
this.add(new Label(4, 4, 200, 0, Color.VIOLET + Client.VERSION, true));
|
||||||
this.splashLabel = this.add(new Label(0, 100, width, 0, ""));
|
this.splashLabel = this.add(new Label(0, 100, width, 0, ""));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue