fix tremolo
This commit is contained in:
parent
c3b1693ee4
commit
dd38d049d4
3 changed files with 27 additions and 17 deletions
|
@ -3462,12 +3462,28 @@ 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);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
midi.setDebug(this.midiDebug);
|
||||||
this.audio.alMidi(midi);
|
this.audio.alMidi(midi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7876,12 +7876,12 @@ public class AudioInterface implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String fmt, Object ... args) {
|
private void log(String fmt, Object ... args) {
|
||||||
|
Log.SOUND.info(fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debug(String fmt, Object ... args) {
|
private void debug(String fmt, Object ... args) {
|
||||||
if(this.debug)
|
if(this.debug)
|
||||||
this.log(fmt, args);
|
Log.SOUND.debug(fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processMeta(MidiTrack trk) {
|
private void processMeta(MidiTrack trk) {
|
||||||
|
@ -8252,7 +8252,7 @@ public class AudioInterface implements Runnable {
|
||||||
private static byte getnote(BankChannel ch, byte key, int id, boolean drum, BankInstr instr) {
|
private static byte getnote(BankChannel ch, byte key, int id, boolean drum, BankInstr instr) {
|
||||||
int note = (int)key;
|
int note = (int)key;
|
||||||
if(instr.fixed) { // || drum
|
if(instr.fixed) { // || drum
|
||||||
note = instr.percnum + (int)instr.channels[id].offset;
|
note = instr.percnum + instr.channels[id].offset;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
note += instr.channels[id].offset;
|
note += instr.channels[id].offset;
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class OPLChip {
|
||||||
short getModulation();
|
short getModulation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static interface envelope_sinfunc {
|
private static interface WaveFunc {
|
||||||
short calcPhase(short phase, short envelope);
|
short calcPhase(short phase, short envelope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ public class OPLChip {
|
||||||
{ 1, 1, 1, 0 }
|
{ 1, 1, 1, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final envelope_sinfunc[] WAVE_FUNCS = {
|
private static final WaveFunc[] WAVE_FUNCS = {
|
||||||
OPLChip::wave0,
|
OPLChip::wave0,
|
||||||
OPLChip::wave1,
|
OPLChip::wave1,
|
||||||
OPLChip::wave2,
|
OPLChip::wave2,
|
||||||
|
@ -669,17 +669,11 @@ public class OPLChip {
|
||||||
private byte eg_state;
|
private byte eg_state;
|
||||||
private byte eg_add;
|
private byte eg_add;
|
||||||
private byte vibpos;
|
private byte vibpos;
|
||||||
private byte tremolov;
|
private short tremolov;
|
||||||
private byte tremolopos;
|
private short tremolopos;
|
||||||
private int noise;
|
|
||||||
|
|
||||||
private int samplecnt;
|
private int samplecnt;
|
||||||
|
|
||||||
/* input: [0, 256), output: [0, 65536] */
|
|
||||||
private static int oplSin(double x) {
|
|
||||||
return ((int)(Math.sin((x) * Math.PI / 512.0) * 65536.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
//Envelope generator
|
//Envelope generator
|
||||||
|
|
||||||
private static short waveExp(int level)
|
private static short waveExp(int level)
|
||||||
|
@ -854,15 +848,15 @@ public class OPLChip {
|
||||||
|
|
||||||
if ((this.timer & 0x3f) == 0x3f)
|
if ((this.timer & 0x3f) == 0x3f)
|
||||||
{
|
{
|
||||||
this.tremolopos = (byte)((this.tremolopos + 1) % 210);
|
this.tremolopos = (short)((this.tremolopos + 1) % 210);
|
||||||
}
|
}
|
||||||
if (this.tremolopos < 105)
|
if (this.tremolopos < 105)
|
||||||
{
|
{
|
||||||
this.tremolov = (byte)(this.tremolopos >> this.tremoloshift);
|
this.tremolov = (short)(this.tremolopos >> this.tremoloshift);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.tremolov = (byte)((210 - this.tremolopos) >> this.tremoloshift);
|
this.tremolov = (short)((210 - this.tremolopos) >> this.tremoloshift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this.timer & 0x3ff) == 0x3ff)
|
if ((this.timer & 0x3ff) == 0x3ff)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue