scope adjustments

This commit is contained in:
Wirlaburla 2024-05-01 00:42:53 -05:00
parent 5cc62a1bfc
commit 86557d9cf4

View File

@ -607,7 +607,7 @@ void displayPatterns(xmp_module_info *mi, xmp_frame_info *fi) {
if (showEffects) {
char f1;
if ((efxmemtable[event.fxt] || event.fxp != 0) && (f1 = efxtable[event.fxt]) != NULL) snprintf(efx, 4, "%c%02X", f1, event.fxp);
if ((efxmemtable[event.fxt] || event.fxp != 0) && (f1 = efxtable[event.fxt])) snprintf(efx, 4, "%c%02X", f1, event.fxp);
else snprintf(efx, 4, "...");
sprintf(lnbuf, "|%s %s %s %s", note, ins, vol, efx);
} else sprintf(lnbuf, "|%s %s %s", note, ins, vol);
@ -631,11 +631,12 @@ int lerp (int a, int b, float f) {
}
#include <vector>
std::vector<int> bufbuf;
void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
const char* xbuf = (char*)fi->buffer;
int percol = (fi->buffer_size/(COLS-2));
bufbuf.resize(COLS-2);
wmove(dis, 0, 0);
for (int s = 0; s < COLS-2; s++) {
int colsum = 0;
for (int v = 0; v < percol; v++) {
@ -644,14 +645,24 @@ void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
int l = (colsum / percol)*2;
if (l >= 0x80) l = 0x80;
else if (l <= -0x80) l = -0x80;
int r = (1.0*(l+0x80)/0xFF)*(LINES-4);
for (int j = 0; j != l; j+=(l>0?1:-1)) {
wmove(dis, (1.0*(j+0x80)/0xFF)*(LINES-4), s);
waddch(dis, '#');
bufbuf[s] = l;
}
wmove(dis, r, s);
waddch(dis, '=');
wmove(dis, 0, 0);
wprintw(dis, "%i", percol);
for (int t = 0; t < COLS-2; t++) {
//int r = (1.0*(bufbuf[t]+0x80)/0xFF)*(LINES-4);
int r = (1.0*(lerp(bufbuf[t-1], bufbuf[t], 0.5f)+0x80)/0xFF)*(LINES-4);
wmove(dis, r, t);
chtype pixpair = COLOR_PAIR(10);
if (std::abs(bufbuf[t-1] - bufbuf[t]) > 64)
pixpair = COLOR_PAIR(12);
else if (std::abs(bufbuf[t-1] - bufbuf[t]) > 32)
pixpair = COLOR_PAIR(11);
wattron(dis, pixpair);
waddch(dis, ' ');
wattroff(dis, pixpair);
}
}