replace channel bar page with scope/waveform
This commit is contained in:
parent
f97e50612f
commit
a4e3734568
|
@ -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')
|
||||||
|
|
42
src/main.cpp
42
src/main.cpp
|
@ -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;
|
|
||||||
struct xmp_channel_info cinfo = fi->channel_info[y];
|
|
||||||
if (y > (LINES - 3)+vOffset) break;
|
|
||||||
wmove(dis, y-vOffset, 0);
|
|
||||||
int cvol = (cinfo.volume * (COLS - 5)) / (64 * (vol / 100));
|
|
||||||
wattron(dis, no_pair);
|
|
||||||
wprintw(dis, "%02X", y);
|
|
||||||
wattroff(dis, no_pair);
|
|
||||||
for (int c = 0; c < COLS - 5; c++) {
|
|
||||||
if (c < cvol) waddstr(dis, "#");
|
|
||||||
else waddstr(dis, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
std::vector<int> bufbuf;
|
||||||
|
void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
|
bufbuf.resize(fi->buffer_size);
|
||||||
|
const char* xbuf = (char*)fi->buffer;
|
||||||
|
float nxcol = 0;
|
||||||
|
int rate = 2;
|
||||||
|
int midLine = (LINES-4)/2;
|
||||||
|
int horzInc = 1;
|
||||||
|
for (int s = 0; s < fi->buffer_size; s++) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user