change view keys up one

This commit is contained in:
Wirlaburla 2023-03-02 21:28:55 -06:00
parent 7a064fe3da
commit e737780bb9
2 changed files with 28 additions and 16 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: wirlaburla <wirlaburla@worlio.com> # Maintainer: wirlaburla <wirlaburla@worlio.com>
pkgname=trakker-git pkgname=trakker-git
pkgver=0.2.2 pkgver=0.2.2.0
pkgrel=1 pkgrel=1
pkgdesc='' pkgdesc=''
arch=('x86_64' 'aarch64') arch=('x86_64' 'aarch64')

View File

@ -92,11 +92,12 @@ int main(int argc, char *argv[]) {
xmp_start_player(c, SAMPLERATE, 0); xmp_start_player(c, SAMPLERATE, 0);
updateTrack(mi.mod->name, mi.mod->type); updateTrack(mi.mod->name, mi.mod->type);
while (true) { while (true) {
xmp_get_frame_info(c, &fi); xmp_get_frame_info(c, &fi);
if (xmp_play_frame(c) != 0 && !is_stopped) break; if (xmp_play_frame(c) != 0 && !is_stopped) break;
if (!looper && fi.loop_count > 0) break; if (!looper && fi.loop_count > 0) break;
// Print Top-Right time
mvprintw( mvprintw(
0, COLS-11, 0, COLS-11,
"%02u:%02u/%02u:%02u", "%02u:%02u/%02u:%02u",
@ -106,6 +107,14 @@ int main(int argc, char *argv[]) {
(fi.total_time / 1000) % 60 (fi.total_time / 1000) % 60
); );
/* - Handles Key Events
* Key timeout is set to 0 to become non-blocking if playing. This allows
* Continualy looping to play the track without requiring a key press.
* Once the playstate changes through the boolean 'is_stopped', the timeout
* changes to -1 for an infinite timeout in the 'keys' loop which will loop
* until is_stopped is false. The block state is for efficiency.
*/
keys: keys:
wtimeout(win, is_stopped?-1:0); wtimeout(win, is_stopped?-1:0);
if ((key = wgetch(win)) != 0) { if ((key = wgetch(win)) != 0) {
@ -138,11 +147,13 @@ int main(int argc, char *argv[]) {
case 'l': case 'l':
looper = !looper; looper = !looper;
break; break;
case '0': detail = 0; break; case '1':
case '1': detail = 1; break; case '2':
case '2': detail = 2; break; case '3':
case '3': detail = 3; break; case '4':
case '4': detail = 4; break; case '5':
detail = std::atoi(key);
break;
}; };
renderRows(win, &mi, &fi); renderRows(win, &mi, &fi);
} }
@ -212,11 +223,12 @@ void renderRows(WINDOW* win, xmp_module_info *mi, xmp_frame_info *fi) {
int view_chanOffset = chanOffset; int view_chanOffset = chanOffset;
int view_detail = detail; int view_detail = detail;
int dlvl; int dlvl;
if (detail == 4) dlvl = 19; // Set proper sizes for channels.
else if (detail == 3) dlvl = 15; if (detail == 5) dlvl = 19;
else if (detail == 2) dlvl = 11; else if (detail == 4) dlvl = 15;
else if (detail == 1) dlvl = 7; else if (detail == 3) dlvl = 11;
else dlvl = 2; else if (detail == 2) dlvl = 7;
else dlvl = 3;
for (int y = 0; y < LINES - 2; y++) { for (int y = 0; y < LINES - 2; y++) {
int trow = (fi->row - ((LINES - 2) / 2))+y; int trow = (fi->row - ((LINES - 2) / 2))+y;
if (trow > fi->num_rows-1 || trow < 0) { continue;} if (trow > fi->num_rows-1 || trow < 0) { continue;}
@ -241,7 +253,7 @@ void renderRows(WINDOW* win, xmp_module_info *mi, xmp_frame_info *fi) {
struct xmp_event event = mi->mod->xxt[track]->event[trow]; struct xmp_event event = mi->mod->xxt[track]->event[trow];
if (i > 0 && i == chanOffset) wprintw(win, "<"); if (i > 0 && i == chanOffset) wprintw(win, "<");
else wprintw(win, "|"); else wprintw(win, "|");
if (detail >= 1) { if (detail >= 2) {
if (event.note > 0x80) { if (event.note > 0x80) {
wprintw(win, "=== "); wprintw(win, "=== ");
} else if (event.note > 0) { } else if (event.note > 0) {
@ -257,7 +269,7 @@ void renderRows(WINDOW* win, xmp_module_info *mi, xmp_frame_info *fi) {
wprintw(win, "--"); wprintw(win, "--");
} }
if (detail >= 2) { if (detail >= 3) {
int vol; int vol;
if ((vol = event.vol) != 0) { if ((vol = event.vol) != 0) {
// I made this wall... // I made this wall...
@ -282,14 +294,14 @@ void renderRows(WINDOW* win, xmp_module_info *mi, xmp_frame_info *fi) {
wprintw(win, " ---"); wprintw(win, " ---");
} }
if (detail >= 3) { if (detail >= 4) {
char f1; char f1;
if ((f1 = getEffectType(event.fxt)) != 0) if ((f1 = getEffectType(event.fxt)) != 0)
wprintw(win, " %c%02X", f1, event.fxp); wprintw(win, " %c%02X", f1, event.fxp);
else else
wprintw(win, " ---"); wprintw(win, " ---");
if (detail >= 4) { if (detail >= 5) {
char f2; char f2;
if ((f2 = getEffectType(event.fxt)) != 0) if ((f2 = getEffectType(event.fxt)) != 0)
wprintw(win, " %c%02X", f2, event.f2p); wprintw(win, " %c%02X", f2, event.f2p);