1
0
Fork 0

add midi visualizer

This commit is contained in:
Sen 2025-08-25 19:52:15 +02:00
parent 463601faa7
commit 93eb756d3c
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
2 changed files with 175 additions and 170 deletions

View file

@ -1,14 +1,14 @@
package client.audio; package client.audio;
public class OPLChip { public class OPLChip {
private static enum EnvState { public static enum EnvState {
ATTACK, ATTACK,
DECAY, DECAY,
SUSTAIN, SUSTAIN,
RELEASE RELEASE
}; };
private static interface ModGen { public static interface ModGen {
short getModulation(); short getModulation();
} }
@ -56,6 +56,7 @@ public class OPLChip {
public int note; public int note;
public int detune; public int detune;
public int pitch; public int pitch;
public int read_freq;
public OPLSlot(OPLChannel channel) { public OPLSlot(OPLChannel channel) {
this.channel = channel; this.channel = channel;
@ -352,6 +353,7 @@ public class OPLChip {
double dfreq = ((double)NOTES[key]) * pfrq; double dfreq = ((double)NOTES[key]) * pfrq;
freq = (int)dfreq; freq = (int)dfreq;
} }
this.read_freq = freq;
int block = 0; int block = 0;
while(MAX_FREQ[block] < freq) { while(MAX_FREQ[block] < freq) {
block++; block++;
@ -412,6 +414,10 @@ public class OPLChip {
public final OPLSlot[] slots = new OPLSlot[4]; public final OPLSlot[] slots = new OPLSlot[4];
public final ModGen[] out = new ModGen[this.slots.length]; public final ModGen[] out = new ModGen[this.slots.length];
public final int[] level = new int[2]; public final int[] level = new int[2];
public int read_algo;
public int read_fb1;
public int read_fb2;
public OPLChannel() { public OPLChannel() {
for(int z = 0; z < this.slots.length; z++) { for(int z = 0; z < this.slots.length; z++) {
@ -422,6 +428,9 @@ public class OPLChip {
} }
public void setAlgo(int algo, int feedback1, int feedback2) { public void setAlgo(int algo, int feedback1, int feedback2) {
this.read_algo = algo;
this.read_fb1 = feedback1;
this.read_fb2 = feedback2;
if ((algo & 0x04) != 0) if ((algo & 0x04) != 0)
{ {
switch (algo & 0x03) switch (algo & 0x03)

View file

@ -5,6 +5,12 @@ import java.nio.file.Files;
import client.Client.FileMode; import client.Client.FileMode;
import client.audio.MidiDecoder; import client.audio.MidiDecoder;
import client.audio.MidiHandle;
import client.audio.OPLChip;
import client.audio.OPLChip.EnvState;
import client.audio.OPLChip.ModGen;
import client.audio.OPLChip.OPLChannel;
import client.audio.OPLChip.OPLSlot;
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.Element;
@ -36,6 +42,8 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
} }
private class Visualizer extends Element { private class Visualizer extends Element {
private static final int[] plr_waveforms = {0xff00ff00, 0xffff0000, 0xff0000ff, 0xff00ffff, 0xffff00ff, 0xffffff00, 0xff80ff00, 0xff00ff80};
public Visualizer(int x, int y, int w, int h) { public Visualizer(int x, int y, int w, int h) {
super(x, y, w, h, null); super(x, y, w, h, null);
} }
@ -43,13 +51,167 @@ public class GuiPlayer extends GuiList<GuiPlayer.SongEntry> {
public boolean canHover() { public boolean canHover() {
return false; return false;
} }
private int gui_render_bar(int x, int y, int w, int h, int top, int bottom, int bg, int v) {
v = (v < 0) ? 0 : v;
Drawing.drawGradient(this.pos_x + x, this.pos_y + y, w, h, 0xff000000 | top, 0xff000000 | bottom);
if(++v < h)
Drawing.drawRect(this.pos_x + x, this.pos_y + y, w, h - v, 0xff000000 | bg);
return h;
}
private int gui_render_grad(int x, int y, int w, int h, int top, int bottom) {
Drawing.drawGradient(this.pos_x + x, this.pos_y + y, w, h, 0xff000000 | top, 0xff000000 | bottom);
return h;
}
private int gui_render_rect(int x, int y, int w, int h, int color) {
Drawing.drawRect(this.pos_x + x, this.pos_y + y, w, h, 0xff000000 | color);
return h;
}
private int gui_render_text(int x, int y, int color, String text) {
Font.set(Font.SMALL);
Drawing.drawText(text, this.pos_x + x, this.pos_y + y, 0xff000000 | color);
Font.unset();
return Font.SMALL.getHeight();
}
protected void drawBackground() { protected void drawBackground() {
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0xff000000); gui_render_grad(0, 0, this.size_x, this.size_y, this.gm.style.field_btm, this.gm.style.field_top);
if(!this.gm.midiVisualizer)
return;
MidiDecoder midi = this.gm.getAudioInterface().alGetMidi();
if(midi == null)
return;
OPLChip chip = midi.chip;
MidiHandle bank = midi.bank;
try {
int nch = chip.channel.length * 2;
int bx = this.size_x / 2 - (nch * 6 + 2) / 2;
int by = this.size_y / 2 - (698 + 20 * 4) / 2;
int x = bx;
int y = by;
y += 20;
y += gui_render_rect(x, y, nch * 6 + 2, 226, 0x3f0000) + 20;
y += gui_render_rect(x, y, nch * 6 + 2, 232, 0x003f00) + 20;
y += gui_render_rect(x, y, nch * 6 + 2, 232, 0x00003f) + 20;
y += gui_render_rect(x, y, nch * 6 + 2, 8, 0x2f2f2f);
for(int c = 0; c < nch; c++) {
OPLChannel channel = chip.channel[c / 2];
x = bx + 2 + 6 * c;
y = by + 2;
ModGen[] out = channel.out;
int accm = 0;
for(int z = 0; z < out.length; z++) {
accm += out[z].getModulation();
}
int chnlvl = (short)((accm * channel.level[c % 2]) >> 16);
chnlvl = chnlvl < 0 ? (-chnlvl) : chnlvl;
chnlvl = (chnlvl * 16) / 1024;
chnlvl = chnlvl > 64 ? 64 : chnlvl;
int freq = (int)(((float)channel.slots[0].read_freq) / 6210000.0f * 128.0f);
y += 20;
y += gui_render_bar(x, y, 4, 64, 0xff0000, 0x00ff00, 0x000000, chnlvl) + 2;
y += gui_render_rect(x, y, 4, 4, ((channel.slots[0].eg_out <= 0x100) || (channel.slots[1].eg_out <= 0x100)) ? 0x00ff00 : 0x000000) + 2;
y += gui_render_rect(x - (c % 2), y, 5, 4, (channel.read_algo & 0x04) != 0 ? 0xff00ff : 0x000000) + 2;
y += gui_render_grad(x, y, 4, 4, (channel.read_algo & (c % 2 == 0 ? 0x01 : 0x02)) != 0 ? 0x00ff00 : 0x808080, 0x0000ff) + 2;
y += gui_render_bar(x, y, 4, 8, 0x00ff00, 0xffff00, 0x000000, c % 2 == 0 ? channel.read_fb1 : channel.read_fb2) + 2;
y += gui_render_bar(x, y, 4, 128, 0x707070, 0x505050, 0x000000, freq) + 2;
gui_render_rect(x, y - 130 + (127 - freq), 4, 1, 0xff0000);
for(int o = 0; o < 2; o++) {
OPLSlot slot = channel.slots[(c % 2) * 2 + o];
y += 2;
y += 20;
y += gui_render_rect(x, y, 4, 4, slot.key ? 0x00ff00 : 0x000000) + 2;
y += gui_render_rect(x, y, 4, 4, slot.trem != chip.zeromod ? 0x5fdf00 : 0x000000);
y += gui_render_rect(x, y, 4, 4, slot.reg_vib ? 0xffff00 : 0x000000);
y += gui_render_rect(x, y, 4, 4, slot.reg_type ? 0xff0000 : 0x000000);
y += gui_render_rect(x, y, 4, 4, slot.reg_ksr ? 0x5f00bf : 0x000000) + 2;
y += gui_render_bar(x, y, 4, 16, 0xff0000, 0xffff00, 0x000000, slot.reg_mult) + 2;
y += gui_render_bar(x, y, 4, 64, 0xff0000, 0x00ff00, 0x000000, 63 - slot.reg_tl) + 2;
y += gui_render_bar(x, y, 4, 4, 0x7f00ff, 0x3f00ff, 0x000000, slot.reg_ksl) + 2;
y += gui_render_rect(x, y, 4, 8, 0x000000) + 2;
gui_render_rect(x, y - 10 + (7 - slot.reg_wf), 4, 1, plr_waveforms[slot.reg_wf]);
y += gui_render_bar(x, y, 4, 16, slot.eg_gen == EnvState.ATTACK ? 0xff0000 : 0xaf0000, slot.eg_gen == EnvState.ATTACK ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_ar) + 2;
y += gui_render_bar(x, y, 4, 16, slot.eg_gen == EnvState.DECAY ? 0xff0000 : 0xaf0000, slot.eg_gen == EnvState.DECAY ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_dr) + 2;
y += gui_render_bar(x, y, 4, 16, slot.eg_gen == EnvState.SUSTAIN ? 0xff0000 : 0xaf0000, slot.eg_gen == EnvState.SUSTAIN ? 0x00ffff : 0x00afaf, 0x000000, (slot.reg_sl > 15) ? 0 : (15 - slot.reg_sl)) + 2;
y += gui_render_bar(x, y, 4, 16, slot.eg_gen == EnvState.RELEASE ? 0xff0000 : 0xaf0000, slot.eg_gen == EnvState.RELEASE ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_rr) + 2;
y += gui_render_bar(x, y, 4, 32, 0xff0000, 0x0000ff, 0x000000, (0x1ff - slot.eg_rout) / 16) + 2;
}
y += 2;
y += 20;
gui_render_rect(x, y, 4, 4, bank.index == c / 2 ? 0x00ffff : 0x000000);
}
}
catch(Throwable e) {
}
} }
protected void drawForeground(int x1, int y1, int x2, int y2) { protected void drawForeground(int x1, int y1, int x2, int y2) {
if(!this.gm.midiVisualizer)
return;
MidiDecoder midi = this.gm.getAudioInterface().alGetMidi();
if(midi == null)
return;
OPLChip chip = midi.chip;
MidiHandle bank = midi.bank;
try {
int nch = chip.channel.length;
int bx = this.size_x / 2 - (nch * 6 + 2) / 2;
int by = this.size_y / 2 - (698 + 20 * 4) / 2;
int x = bx;
int y = by;
/*
x = bx - 84;
sprintf(&sys.work_buf[str_time(sys.work_buf, sgt.mid_time)], "\n%c%c%c%c %c",
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 0)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 1)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 2)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 3)) ? '*' : '.',
plr_wheel[(sgt.mid_tick >> 5) & 3]);
gui_render_text(x, y + 20, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d", STR_OPL_TICK, sgt.mid_tick);
gui_render_text(x, y + 60, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d / %d", STR_OPL_ACTIVE, bank.v_used, bank.voices.length);
gui_render_text(x, y + 100, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d +%dQ", STR_OPL_TEMPO, sgt.mid.uspb ? (60000000 / sgt.mid.uspb) : 0, sgt.mid.tpqn);
gui_render_text(x, y + 140, 0xffffff, sys.work_buf);
x = bx;
pthread_mutex_unlock(&sgt.lock);
y += 3;
gui_render_text(x, y, 0xffffff, STR_OPL_CHANNEL);
gui_render_text(x, y + 20 + 226, 0xffffff, STR_OPL_MODULATOR);
gui_render_text(x, y + 40 + 226 + 232, 0xffffff, STR_OPL_CARRIER);
gui_render_text(x, y + 60 + 226 + 232 * 2, 0xffffff, STR_OPL_POINTER);
y -= 3;
// x -= 86;
x += nch * 6 + 2 + 1;
y += 20;
gui_render_text(x, y + 0, 0xffffff, STR_OPL_OUTPUT);
gui_render_text(x, y + 70, 0xffffff, STR_OPL_MODE);
gui_render_text(x, y + 84, 0xffffff, STR_OPL_FEEDBACK);
gui_render_text(x, y + 98, 0xffffff, STR_OPL_FREQUENCY);
y += 226 + 20;
for(int o = 0; o < 2; o++) {
gui_render_text(x, y + 6, 0xffffff, STR_OPL_FLAGS);
gui_render_text(x, y + 24, 0xffffff, STR_OPL_MULTIPLIER);
gui_render_text(x, y + 42, 0xffffff, STR_OPL_LEVEL);
gui_render_text(x, y + 96, 0xffffff, STR_OPL_KEYSCALE);
gui_render_text(x, y + 110, 0xffffff, STR_OPL_WAVEFORM);
gui_render_text(x, y + 124, 0xffffff, STR_OPL_ATTACK);
gui_render_text(x, y + 142, 0xffffff, STR_OPL_DECAY);
gui_render_text(x, y + 160, 0xffffff, STR_OPL_SUSTAIN);
gui_render_text(x, y + 178, 0xffffff, STR_OPL_RELEASE);
gui_render_text(x, y + 196, 0xffffff, STR_OPL_ENVELOPE);
y += 232 + 20;
}
*/
}
catch(Throwable e) {
}
} }
} }
@ -361,27 +523,6 @@ STR(OPL_TICK, "", "Tick/Pos.")
STR(OPL_ACTIVE, "", "Aktiv") STR(OPL_ACTIVE, "", "Aktiv")
STR(OPL_TEMPO, "", "Tempo BPM") STR(OPL_TEMPO, "", "Tempo BPM")
STR(MID_PLAY, "s", "Spiele MIDI '$1'")
STR(CMD_PLAY_QUEUED, "d", "$1 MIDIs werden abgespielt")
STR(CMD_PLAY_STOPPED, "", "Wiedergabe ist angehalten")
STR(CMD_PLAY_PLAYING, "d", "$1 MIDIs sind in der Liste")
STR(CMD_PLAY_ENDED, "", "Wiedergabe gestoppt")
STR(CMD_PLAY_BANKID, "d", "Bank-ID: $1")
STR(PLR_MODE_NORM, "", "Normal")
STR(PLR_MODE_REPEAT, "", "Wiederholen")
STR(PLR_MODE_LOOP, "", "Schleife")
STR(PLR_MODE_RAND, "", "Zufällig")
STR(PLR_START, "", "Start")
STR(PLR_STOP, "", "Stop")
STR(PLR_PAUSE, "", "Pause")
STR(PLR_MODE, "", "Modus")
STR(PLR_PREV, "", "Vorheriger")
STR(PLR_NEXT, "", "Nächster")
STR(PLR_RANDOM, "", "Zufälliger")
STR(PLR_JUMP, "", "Springe zu")
#define SYM_PLAY "\U00100000" #define SYM_PLAY "\U00100000"
#define SYM_STOP "\U00100001" #define SYM_STOP "\U00100001"
#define SYM_PAUSE "\U00100002" #define SYM_PAUSE "\U00100002"
@ -439,150 +580,5 @@ void gui_plr_update(window_t *win) {
gui_update_text(elem); gui_update_text(elem);
gui_plr_update_text(win); gui_plr_update_text(win);
} }
static const uint plr_waveforms[] = {0xff00ff00, 0xffff0000, 0xff0000ff, 0xff00ffff, 0xffff00ff, 0xffffff00, 0xff80ff00, 0xff00ff80};
int gui_render_bar(gui_t *elem, int x, int y, int w, int h, uint top, uint bottom, uint bg, int v) {
v = (v < 0) ? 0 : v;
gfx_draw_rect(elem.pos_x + x, elem.pos_y + y, w, h, 0, 0, 0xff000000 | top, 0xff000000 | bottom, 0, 0);
if(++v < h)
gfx_draw_rect(elem.pos_x + x, elem.pos_y + y, w, h - v, 0, 0, 0xff000000 | bg, 0xff000000 | bg, 0, 0);
return h;
}
int gui_render_grad(gui_t *elem, int x, int y, int w, int h, uint top, uint bottom) {
gfx_draw_rect(elem.pos_x + x, elem.pos_y + y, w, h, 0, 0, 0xff000000 | top, 0xff000000 | bottom, 0, 0);
return h;
}
int gui_render_rect(gui_t *elem, int x, int y, int w, int h, uint color) {
gfx_draw_rect(elem.pos_x + x, elem.pos_y + y, w, h, 0, 0, 0xff000000 | color, 0xff000000 | color, 0, 0);
return h;
}
int gui_render_text(gui_t *elem, int x, int y, uint color, const char *text) {
txt_draw(elem.pos_x + x, elem.pos_y + y, 0, sys.font.yglyph, sys.font.yglyph, elem.pos_x + x, elem.pos_y + y, elem.pos_x + elem.size_x, elem.pos_y + elem.size_y,
0xff000000 | color, 0x00000000, &sys.font, text);
return sys.font.yglyph;
}
void gui_render_player(gui_t *elem, int value) {
elem.t_dirty = 1;
if(!value)
gui_render_grad(elem, 0, 0, elem.size_x, elem.size_y, sys.style.field_btm, sys.style.field_top);
if(snd.mid_visual ^ 1)
return;
pthread_mutex_lock(&sgt.lock);
if(!sgt.chip || !sgt.bank) {
pthread_mutex_unlock(&sgt.lock);
return;
}
OPLChip chip = sgt.chip;
bank_handle *bank = sgt.bank;
int nch = chip.n_voices;
int bx = elem.size_x / 2 - (nch * 6 + 2) / 2;
int by = elem.size_y / 2 - (698 + 20 * 4) / 2;
int x = bx;
int y = by;
if(value) {
x = bx - 84;
sprintf(&sys.work_buf[str_time(sys.work_buf, sgt.mid_time)], "\n%c%c%c%c %c",
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 0)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 1)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 2)) ? '*' : '.',
(sgt.mid.tpqn && (((sgt.mid_tick / sgt.mid.tpqn) & 3) == 3)) ? '*' : '.',
plr_wheel[(sgt.mid_tick >> 5) & 3]);
gui_render_text(elem, x, y + 20, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d", STR_OPL_TICK, sgt.mid_tick);
gui_render_text(elem, x, y + 60, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d / %d", STR_OPL_ACTIVE, bank.v_used, bank.voices.length);
gui_render_text(elem, x, y + 100, 0xffffff, sys.work_buf);
sprintf(sys.work_buf, COL_NEON"%s"COL_RESET"\n%d +%dQ", STR_OPL_TEMPO, sgt.mid.uspb ? (60000000 / sgt.mid.uspb) : 0, sgt.mid.tpqn);
gui_render_text(elem, x, y + 140, 0xffffff, sys.work_buf);
x = bx;
pthread_mutex_unlock(&sgt.lock);
y += 3;
gui_render_text(elem, x, y, 0xffffff, STR_OPL_CHANNEL);
gui_render_text(elem, x, y + 20 + 226, 0xffffff, STR_OPL_MODULATOR);
gui_render_text(elem, x, y + 40 + 226 + 232, 0xffffff, STR_OPL_CARRIER);
gui_render_text(elem, x, y + 60 + 226 + 232 * 2, 0xffffff, STR_OPL_POINTER);
y -= 3;
// x -= 86;
x += nch * 6 + 2 + 1;
y += 20;
gui_render_text(elem, x, y + 0, 0xffffff, STR_OPL_OUTPUT);
gui_render_text(elem, x, y + 70, 0xffffff, STR_OPL_MODE);
gui_render_text(elem, x, y + 84, 0xffffff, STR_OPL_FEEDBACK);
gui_render_text(elem, x, y + 98, 0xffffff, STR_OPL_FREQUENCY);
y += 226 + 20;
for(int o = 0; o < 2; o++) {
gui_render_text(elem, x, y + 6, 0xffffff, STR_OPL_FLAGS);
gui_render_text(elem, x, y + 24, 0xffffff, STR_OPL_MULTIPLIER);
gui_render_text(elem, x, y + 42, 0xffffff, STR_OPL_LEVEL);
gui_render_text(elem, x, y + 96, 0xffffff, STR_OPL_KEYSCALE);
gui_render_text(elem, x, y + 110, 0xffffff, STR_OPL_WAVEFORM);
gui_render_text(elem, x, y + 124, 0xffffff, STR_OPL_ATTACK);
gui_render_text(elem, x, y + 142, 0xffffff, STR_OPL_DECAY);
gui_render_text(elem, x, y + 160, 0xffffff, STR_OPL_SUSTAIN);
gui_render_text(elem, x, y + 178, 0xffffff, STR_OPL_RELEASE);
gui_render_text(elem, x, y + 196, 0xffffff, STR_OPL_ENVELOPE);
y += 232 + 20;
}
return;
}
y += 20;
y += gui_render_rect(elem, x, y, nch * 6 + 2, 226, 0x3f0000) + 20;
y += gui_render_rect(elem, x, y, nch * 6 + 2, 232, 0x003f00) + 20;
y += gui_render_rect(elem, x, y, nch * 6 + 2, 232, 0x00003f) + 20;
y += gui_render_rect(elem, x, y, nch * 6 + 2, 8, 0x2f2f2f);
for(int c = 0; c < nch; c++) {
OPLChannel channel = &chip.channel[c];
x = bx + 2 + 6 * c;
y = by + 2;
short **out = channel.out;
short accm = *out[0] + *out[1] + *out[2] + *out[3];
int chnlvl = 0;
for(int n = 0; n < 2; n++) {
chnlvl += (short)((accm * channel.level[n]) >> 16);
}
chnlvl = chnlvl < 0 ? (-chnlvl) : chnlvl;
chnlvl = (chnlvl * 16) / 2048;
chnlvl = chnlvl > 64 ? 64 : chnlvl;
int freq = (int)((((float)channel.f_num * 49716.0f) / powf(2.0f, 20.0f - (float)channel.block)) / 6210.0f * 128.0f);
y += 20;
y += gui_render_bar(elem, x, y, 4, 64, 0xff0000, 0x00ff00, 0x000000, chnlvl) + 2;
y += gui_render_rect(elem, x, y, 4, 4, ((channel.slots[0].eg_out <= 0x100) || (channel.slots[1].eg_out <= 0x100)) ? 0x00ff00 : 0x000000) + 2;
y += gui_render_rect(elem, x - (c & 1), y, 5, 4, channel.chtype != ch_2op ? 0xff00ff : 0x000000) + 2;
y += gui_render_grad(elem, x, y, 4, 4, channel.con ? 0x00ff00 : 0x808080, 0x0000ff) + 2;
y += gui_render_bar(elem, x, y, 4, 8, 0x00ff00, 0xffff00, 0x000000, channel.fb) + 2;
y += gui_render_bar(elem, x, y, 4, 128, 0x707070, 0x505050, 0x000000, freq) + 2;
gui_render_rect(elem, x, y - 130 + (127 - freq), 4, 1, 0xff0000);
for(int o = 0; o < 2; o++) {
opl3_slot *slot = channel.slots[o];
y += 2;
y += 20;
y += gui_render_rect(elem, x, y, 4, 4, slot.key ? 0x00ff00 : 0x000000) + 2;
y += gui_render_rect(elem, x, y, 4, 4, (slot.trem != (byte*)&slot.chip.zeromod) ? 0x5fdf00 : 0x000000);
y += gui_render_rect(elem, x, y, 4, 4, slot.reg_vib ? 0xffff00 : 0x000000);
y += gui_render_rect(elem, x, y, 4, 4, slot.reg_type ? 0xff0000 : 0x000000);
y += gui_render_rect(elem, x, y, 4, 4, slot.reg_ksr ? 0x5f00bf : 0x000000) + 2;
y += gui_render_bar(elem, x, y, 4, 16, 0xff0000, 0xffff00, 0x000000, slot.reg_mult) + 2;
y += gui_render_bar(elem, x, y, 4, 64, 0xff0000, 0x00ff00, 0x000000, 63 - slot.reg_tl) + 2;
y += gui_render_bar(elem, x, y, 4, 4, 0x7f00ff, 0x3f00ff, 0x000000, slot.reg_ksl) + 2;
y += gui_render_rect(elem, x, y, 4, 8, 0x000000) + 2;
gui_render_rect(elem, x, y - 10 + (7 - slot.reg_wf), 4, 1, plr_waveforms[slot.reg_wf]);
y += gui_render_bar(elem, x, y, 4, 16, slot.eg_gen == 0 ? 0xff0000 : 0xaf0000, slot.eg_gen == 0 ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_ar) + 2;
y += gui_render_bar(elem, x, y, 4, 16, slot.eg_gen == 1 ? 0xff0000 : 0xaf0000, slot.eg_gen == 1 ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_dr) + 2;
y += gui_render_bar(elem, x, y, 4, 16, slot.eg_gen == 2 ? 0xff0000 : 0xaf0000, slot.eg_gen == 2 ? 0x00ffff : 0x00afaf, 0x000000, (slot.reg_sl > 15) ? 0 : (15 - slot.reg_sl)) + 2;
y += gui_render_bar(elem, x, y, 4, 16, slot.eg_gen == 3 ? 0xff0000 : 0xaf0000, slot.eg_gen == 3 ? 0x00ffff : 0x00afaf, 0x000000, slot.reg_rr) + 2;
y += gui_render_bar(elem, x, y, 4, 32, 0xff0000, 0x0000ff, 0x000000, (0x1ff - slot.eg_rout) / 16) + 2;
}
y += 2;
y += 20;
gui_render_rect(elem, x, y, 4, 4, bank.voiceindex == c ? 0x00ffff : 0x000000);
}
pthread_mutex_unlock(&sgt.lock);
}
*/ */
} }