replace channel bar page with scope/waveform

This commit is contained in:
Wirlaburla 2024-03-20 19:07:36 -05:00
parent f97e50612f
commit a4e3734568
3 changed files with 29 additions and 21 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Nick G. <wirlaburla@worlio.com> # Maintainer: Nick G. <wirlaburla@worlio.com>
pkgname=trakker-git pkgname=trakker-git
pkgver=0.5.1 pkgver=0.5.2.r3.gf97e506
pkgrel=1 pkgrel=1
pkgdesc='A terminal-based tracker interface for libxmp.' pkgdesc='A terminal-based tracker interface for libxmp.'
arch=('x86_64') arch=('x86_64')

View File

@ -16,7 +16,7 @@
#define BUFFER_SIZE 250000 #define BUFFER_SIZE 250000
static std::string note_name[] = { "C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#", "A ", "A#", "B " }; static std::string note_name[] = { "C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#", "A ", "A#", "B " };
static std::string pages[] = { "1. Info", "2. Pattern", "3. Bars", "4. Piano Roll", "5. Config", "6. Help" }; static std::string pages[] = { "1. Info", "2. Pattern", "3. Scope", "4. Piano Roll", "5. Config", "6. Help" };
static char* device = "default"; static char* device = "default";
char* file; char* file;
@ -437,7 +437,7 @@ void displayHeader(xmp_module_info *mi, xmp_frame_info *fi) {
} else if (display == 1) { } else if (display == 1) {
displayPatterns(mi, fi); displayPatterns(mi, fi);
} else if (display == 2) { } else if (display == 2) {
displayVolumes(mi, fi); displayScope(mi, fi);
} else if (display == 3) { } else if (display == 3) {
displayNoteRoll(mi, fi); displayNoteRoll(mi, fi);
} else if (display == 4) { } else if (display == 4) {
@ -599,22 +599,30 @@ void displayPatterns(xmp_module_info *mi, xmp_frame_info *fi) {
} }
} }
void displayVolumes(xmp_module_info *mi, xmp_frame_info *fi) { int lerp (int a, int b, float f) {
int chns = mi->mod->chn; return a + f * (b - a);
chtype no_pair = COLOR_PAIR(5); }
for (int y = vOffset; y < chns; y++) {
if (y > (LINES - 4)+vOffset || y < 0) continue; #include <vector>
struct xmp_channel_info cinfo = fi->channel_info[y]; std::vector<int> bufbuf;
if (y > (LINES - 3)+vOffset) break; void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
wmove(dis, y-vOffset, 0); bufbuf.resize(fi->buffer_size);
int cvol = (cinfo.volume * (COLS - 5)) / (64 * (vol / 100)); const char* xbuf = (char*)fi->buffer;
wattron(dis, no_pair); float nxcol = 0;
wprintw(dis, "%02X", y); int rate = 2;
wattroff(dis, no_pair); int midLine = (LINES-4)/2;
for (int c = 0; c < COLS - 5; c++) { int horzInc = 1;
if (c < cvol) waddstr(dis, "#"); for (int s = 0; s < fi->buffer_size; s++) {
else waddstr(dis, " "); if (nxcol >= COLS-2) break;
int l = lerp(bufbuf[s], xbuf[s], 0.2f);
int newpos = ((l+0x80) * (LINES - 4)) / 0xFF;
horzInc = (newpos < midLine)?-1:1;
for (int j = midLine; j != newpos; j+=horzInc) {
wmove(dis, j, (int)nxcol);
waddch(dis, '|');
} }
nxcol+=(1.0*(COLS-2)/fi->buffer_size);
bufbuf[s] = l;
} }
} }

View File

@ -12,7 +12,7 @@ void createWindows();
void displayHeader(xmp_module_info *mi, xmp_frame_info *fi); void displayHeader(xmp_module_info *mi, xmp_frame_info *fi);
void displayInfo(xmp_module_info *mi, xmp_frame_info *fi); void displayInfo(xmp_module_info *mi, xmp_frame_info *fi);
void displayPatterns(xmp_module_info *mi, xmp_frame_info *fi); void displayPatterns(xmp_module_info *mi, xmp_frame_info *fi);
void displayVolumes(xmp_module_info *mi, xmp_frame_info *fi); void displayScope(xmp_module_info *mi, xmp_frame_info *fi);
void displayNoteRoll(xmp_module_info *mi, xmp_frame_info *fi); void displayNoteRoll(xmp_module_info *mi, xmp_frame_info *fi);
void displayPlayer(); void displayPlayer();
void displayHelp(); void displayHelp();