Compare commits
10 Commits
db19f85083
...
c82038a618
Author | SHA1 | Date | |
---|---|---|---|
c82038a618 | |||
652fe8a527 | |||
483a9d9287 | |||
b18bfa4ddd | |||
3122b31405 | |||
77884d97ff | |||
960fa3fc23 | |||
1135ad8993 | |||
5b4cb88dc0 | |||
5af741d9fb |
817
src/main.cpp
817
src/main.cpp
|
@ -2,6 +2,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
@ -17,6 +18,10 @@ static char *note_name[] = { "C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#
|
||||||
static char* pages[] = { "[1] Info", "[2] Pattern", "[3] Channel Bars", "[4] Piano Roll", "[5] About" };
|
static char* pages[] = { "[1] Info", "[2] Pattern", "[3] Channel Bars", "[4] Piano Roll", "[5] About" };
|
||||||
static char* device = "default";
|
static char* device = "default";
|
||||||
|
|
||||||
|
char* file;
|
||||||
|
bool colorMode = 0; // 0 - Auto, 1 - Monochrome, 2 - 8-bit, 3 - Full
|
||||||
|
int mtype = XMP_MODE_AUTO;
|
||||||
|
int smix = 70;
|
||||||
int display = 0;
|
int display = 0;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int vol;
|
int vol;
|
||||||
|
@ -27,15 +32,90 @@ int vOffset = 0;
|
||||||
int looped = 0;
|
int looped = 0;
|
||||||
bool stopped;
|
bool stopped;
|
||||||
bool loop;
|
bool loop;
|
||||||
std::map<int, char> effects;
|
std::map<int, char> efxtable;
|
||||||
|
std::map<int, bool> efxmemtable;
|
||||||
WINDOW *dis;
|
|
||||||
WINDOW *tab;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int err;
|
printf("TRAKKER %s (using XMP %s)\n", TRAKKER_VERSION, xmp_version);
|
||||||
snd_pcm_t *handle;
|
for (int a = 1; a < argc; ++a) {
|
||||||
snd_pcm_sframes_t frames;
|
if (strcmp(argv[a], "-h") == 0) {
|
||||||
|
printf("\n");
|
||||||
|
printf("Help\n");
|
||||||
|
printf("-h Show this message.\n");
|
||||||
|
printf("-d <num> Start on the specified panel.\n");
|
||||||
|
printf("-c <num> Force terminal color mode.\n");
|
||||||
|
printf(" 0 Auto (default)\n");
|
||||||
|
printf(" 1 Monochrome\n");
|
||||||
|
printf(" 2 8bit\n");
|
||||||
|
printf(" 3 Full\n");
|
||||||
|
printf("-s <num> Stereo Seperation\n");
|
||||||
|
printf("-t <type> Set module emulation type.\n");
|
||||||
|
printf(" auto Autodetect mode (default)\n");
|
||||||
|
printf(" mod Play as a generic MOD player\n");
|
||||||
|
printf(" noisetracker Play using Noisetracker quirks\n");
|
||||||
|
printf(" protracker Play using Protracker 1/2 quirks\n");
|
||||||
|
printf(" s3m Play as a generic S3M player\n");
|
||||||
|
printf(" st3 Play using ST3 bug emulation\n");
|
||||||
|
printf(" st3gus Play using ST3+GUS quirks\n");
|
||||||
|
printf(" xm Play as a generic XM player\n");
|
||||||
|
printf(" ft2 Play using FT2 bug emulation\n");
|
||||||
|
printf(" it Play using IT quirks\n");
|
||||||
|
printf(" itsmp Play using IT sample mode quirks\n");
|
||||||
|
exit(0);
|
||||||
|
} else if (strcmp(argv[a], "-d") == 0) {
|
||||||
|
int newdisplay = atoi(argv[a+1])-1;
|
||||||
|
if (newdisplay > 4 || newdisplay < 0)
|
||||||
|
fprintf(stderr, "Display argument is invalid.\n");
|
||||||
|
else {
|
||||||
|
printf("Setting display to \"%s\"\n", pages[newdisplay]);
|
||||||
|
display = newdisplay;
|
||||||
|
}
|
||||||
|
a++;
|
||||||
|
} else if (strcmp(argv[a], "-c") == 0) {
|
||||||
|
colorMode = atoi(argv[a+1]);
|
||||||
|
a++;
|
||||||
|
} else if (strcmp(argv[a], "-s") == 0) {
|
||||||
|
int newmix = atoi(argv[a+1]);
|
||||||
|
if (newmix > 100 || newmix < 0)
|
||||||
|
fprintf(stderr, "Stero seperation argument is invalid.\n");
|
||||||
|
else {
|
||||||
|
printf("Setting Stero seperation to %i%%\n", newmix);
|
||||||
|
smix = newmix;
|
||||||
|
}
|
||||||
|
a++;
|
||||||
|
} else if (strcmp(argv[a], "-t") == 0) {
|
||||||
|
char* newmode = argv[a+1];
|
||||||
|
if (strcmp(newmode, "mod") == 0) {
|
||||||
|
mtype = XMP_MODE_MOD;
|
||||||
|
} else if (strcmp(newmode, "noisetracker") == 0) {
|
||||||
|
mtype = XMP_MODE_NOISETRACKER;
|
||||||
|
} else if (strcmp(newmode, "protracker") == 0) {
|
||||||
|
mtype = XMP_MODE_PROTRACKER;
|
||||||
|
} else if (strcmp(newmode, "s3m") == 0) {
|
||||||
|
mtype = XMP_MODE_S3M;
|
||||||
|
} else if (strcmp(newmode, "st3") == 0) {
|
||||||
|
mtype = XMP_MODE_ST3;
|
||||||
|
} else if (strcmp(newmode, "st3gus") == 0) {
|
||||||
|
mtype = XMP_MODE_ST3GUS;
|
||||||
|
} else if (strcmp(newmode, "xm") == 0) {
|
||||||
|
mtype = XMP_MODE_XM;
|
||||||
|
} else if (strcmp(newmode, "ft2") == 0) {
|
||||||
|
mtype = XMP_MODE_FT2;
|
||||||
|
} else if (strcmp(newmode, "it") == 0) {
|
||||||
|
mtype = XMP_MODE_IT;
|
||||||
|
} else if (strcmp(newmode, "itsmp") == 0) {
|
||||||
|
mtype = XMP_MODE_ITSMP;
|
||||||
|
}
|
||||||
|
a++;
|
||||||
|
} else if (!file) {
|
||||||
|
file = argv[a];
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Unknown argument: %s\n", argv[a]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int err;
|
||||||
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
|
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
|
||||||
fprintf(stderr, "Playback open error: %s\n", snd_strerror(err));
|
fprintf(stderr, "Playback open error: %s\n", snd_strerror(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -46,78 +126,84 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
printf("%s initialized.\n", "ALSA");
|
printf("%s initialized.\n", "ALSA");
|
||||||
|
|
||||||
xmp_context xc;
|
|
||||||
xc = xmp_create_context();
|
xc = xmp_create_context();
|
||||||
if (xmp_load_module(xc, argv[1]) != 0) {
|
if (xmp_load_module(xc, file) != 0) {
|
||||||
fprintf(stderr, "Failed to load Module: %s\n", argv[1]);
|
fprintf(stderr, "Failed to load Module: %s\n", file);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
} else printf("Loaded Module: \"%s\"\n", argv[1]);
|
} else printf("Loaded Module: \"%s\"\n", file);
|
||||||
|
|
||||||
struct xmp_module_info xmi;
|
struct xmp_module_info xmi;
|
||||||
struct xmp_frame_info xfi;
|
struct xmp_frame_info xfi;
|
||||||
|
|
||||||
initscr();
|
initscr();
|
||||||
|
|
||||||
|
start_color();
|
||||||
|
if (colorMode == 1) goto colorless;
|
||||||
|
else if (colorMode == 2) goto color_8;
|
||||||
|
else if (colorMode == 3) goto color_full;
|
||||||
|
|
||||||
if (has_colors() == TRUE) {
|
if (has_colors() == TRUE) {
|
||||||
start_color();
|
|
||||||
if (can_change_color() == TRUE) {
|
if (can_change_color() == TRUE) {
|
||||||
// Primary Background
|
color_full:
|
||||||
init_pair(1, COLOR_BLACK, 8);
|
|
||||||
// Inactive Section
|
|
||||||
init_pair(2, 8, 7);
|
|
||||||
// Active Section
|
|
||||||
init_pair(3, 0, 12);
|
|
||||||
// Display
|
|
||||||
init_pair(4, 7, COLOR_BLACK);
|
|
||||||
// Display Row#
|
|
||||||
init_pair(5, 3, COLOR_BLACK);
|
|
||||||
// Display Playhead
|
|
||||||
init_pair(6, COLOR_WHITE, COLOR_BLUE);
|
|
||||||
// Display Playhead Row#
|
|
||||||
init_pair(7, COLOR_YELLOW, COLOR_BLUE);
|
|
||||||
// Display Stopped Playhead
|
|
||||||
init_pair(8, COLOR_WHITE, COLOR_RED);
|
|
||||||
// Display Stopped Playhead Row#
|
|
||||||
init_pair(9, COLOR_YELLOW, COLOR_RED);
|
|
||||||
} else {
|
|
||||||
// Primary Background
|
// Primary Background
|
||||||
init_pair(1, COLOR_BLACK, 8);
|
init_pair(1, COLOR_BLACK, 8);
|
||||||
// Inactive Section
|
// Inactive Section
|
||||||
init_pair(2, COLOR_BLACK, COLOR_WHITE);
|
init_pair(2, 8, 7);
|
||||||
// Active Section
|
// Active Section
|
||||||
init_pair(3, COLOR_BLACK, COLOR_CYAN);
|
init_pair(3, 0, 12);
|
||||||
// Display
|
// Display
|
||||||
init_pair(4, COLOR_WHITE, COLOR_BLACK);
|
init_pair(4, 7, COLOR_BLACK);
|
||||||
// Display Row#
|
// Display Row#
|
||||||
init_pair(5, COLOR_YELLOW, COLOR_BLACK);
|
init_pair(5, 3, COLOR_BLACK);
|
||||||
// Display Playhead
|
// Display Playhead
|
||||||
init_pair(6, COLOR_WHITE, COLOR_BLUE);
|
init_pair(6, COLOR_WHITE, COLOR_BLUE);
|
||||||
// Display Playhead Row#
|
// Display Playhead Row#
|
||||||
init_pair(7, COLOR_YELLOW, COLOR_BLUE);
|
init_pair(7, COLOR_YELLOW, COLOR_BLUE);
|
||||||
// Display Stopped Playhead
|
// Display Stopped Playhead
|
||||||
init_pair(8, COLOR_WHITE, COLOR_RED);
|
init_pair(8, COLOR_WHITE, COLOR_RED);
|
||||||
// Display Stopped Playhead Row#
|
// Display Stopped Playhead Row#
|
||||||
init_pair(9, COLOR_YELLOW, COLOR_RED);
|
init_pair(9, COLOR_YELLOW, COLOR_RED);
|
||||||
|
} else {
|
||||||
|
color_8:
|
||||||
|
// Primary Background
|
||||||
|
init_pair(1, COLOR_BLACK, 8);
|
||||||
|
// Inactive Section
|
||||||
|
init_pair(2, COLOR_BLACK, COLOR_WHITE);
|
||||||
|
// Active Section
|
||||||
|
init_pair(3, COLOR_BLACK, COLOR_CYAN);
|
||||||
|
// Display
|
||||||
|
init_pair(4, COLOR_WHITE, COLOR_BLACK);
|
||||||
|
// Display Row#
|
||||||
|
init_pair(5, COLOR_YELLOW, COLOR_BLACK);
|
||||||
|
// Display Playhead
|
||||||
|
init_pair(6, COLOR_WHITE, COLOR_BLUE);
|
||||||
|
// Display Playhead Row#
|
||||||
|
init_pair(7, COLOR_YELLOW, COLOR_BLUE);
|
||||||
|
// Display Stopped Playhead
|
||||||
|
init_pair(8, COLOR_WHITE, COLOR_RED);
|
||||||
|
// Display Stopped Playhead Row#
|
||||||
|
init_pair(9, COLOR_YELLOW, COLOR_RED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Primary Background
|
colorless:
|
||||||
init_pair(1, COLOR_BLACK, COLOR_BLACK);
|
// Primary Background
|
||||||
// Inactive Section
|
init_pair(1, COLOR_BLACK, COLOR_BLACK);
|
||||||
init_pair(2, COLOR_WHITE, COLOR_BLACK);
|
// Inactive Section
|
||||||
// Active Section
|
init_pair(2, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(3, COLOR_BLACK, COLOR_WHITE);
|
// Active Section
|
||||||
// Display
|
init_pair(3, COLOR_BLACK, COLOR_WHITE);
|
||||||
init_pair(4, COLOR_WHITE, COLOR_BLACK);
|
// Display
|
||||||
// Display Row#
|
init_pair(4, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(5, COLOR_WHITE, COLOR_BLACK);
|
// Display Row#
|
||||||
// Display Playhead
|
init_pair(5, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(6, COLOR_BLACK, COLOR_WHITE);
|
// Display Playhead
|
||||||
// Display Playhead Row#
|
init_pair(6, COLOR_BLACK, COLOR_WHITE);
|
||||||
init_pair(7, COLOR_BLACK, COLOR_WHITE);
|
// Display Playhead Row#
|
||||||
// Display Stopped Playhead
|
init_pair(7, COLOR_BLACK, COLOR_WHITE);
|
||||||
init_pair(8, COLOR_WHITE, COLOR_BLACK);
|
// Display Stopped Playhead
|
||||||
// Display Stopped Playhead Row#
|
init_pair(8, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(9, COLOR_WHITE, COLOR_BLACK);
|
// Display Stopped Playhead Row#
|
||||||
|
init_pair(9, COLOR_WHITE, COLOR_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
cbreak();
|
cbreak();
|
||||||
|
@ -133,20 +219,22 @@ int main(int argc, char *argv[]) {
|
||||||
int row, pos;
|
int row, pos;
|
||||||
xmp_get_module_info(xc, &xmi);
|
xmp_get_module_info(xc, &xmi);
|
||||||
row = pos = -1;
|
row = pos = -1;
|
||||||
generateEffectsTable(xmi.mod);
|
generateEffectsTable(xmi.mod->type);
|
||||||
|
xmp_set_player(xc, XMP_PLAYER_MODE, mtype);
|
||||||
xmp_start_player(xc, SAMPLERATE, 0);
|
xmp_start_player(xc, SAMPLERATE, 0);
|
||||||
|
xmp_set_player(xc, XMP_PLAYER_MIX, smix);
|
||||||
|
|
||||||
int key;
|
int key;
|
||||||
bool displayChanged;
|
bool displayChanged;
|
||||||
display = 0; displayChanged = true;
|
displayChanged = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
xmp_get_frame_info(xc, &xfi);
|
xmp_get_frame_info(xc, &xfi);
|
||||||
if (xmp_play_frame(xc) != 0 && !stopped) break;
|
if (xmp_play_frame(xc) != 0 && !stopped) break;
|
||||||
if (xfi.loop_count > looped && !loop) break;
|
if (xfi.loop_count > looped && !loop) break;
|
||||||
else looped = xfi.loop_count;
|
else looped = xfi.loop_count;
|
||||||
|
|
||||||
keys:
|
keys:
|
||||||
timeout(stopped?-1:0);
|
timeout(stopped?-1:0);
|
||||||
if ((key = getch()) != 0) {
|
if ((key = getch()) != 0) {
|
||||||
vol = xmp_get_player(xc, XMP_PLAYER_VOLUME);
|
vol = xmp_get_player(xc, XMP_PLAYER_VOLUME);
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -171,9 +259,11 @@ int main(int argc, char *argv[]) {
|
||||||
break;
|
break;
|
||||||
case KEY_PPAGE:
|
case KEY_PPAGE:
|
||||||
if (vOffset > vMin + LINES-6) vOffset-=(LINES-5);
|
if (vOffset > vMin + LINES-6) vOffset-=(LINES-5);
|
||||||
|
else vOffset = vMin;
|
||||||
break;
|
break;
|
||||||
case KEY_NPAGE:
|
case KEY_NPAGE:
|
||||||
if (vOffset < vMax - LINES-5) vOffset+=(LINES-5);
|
if (vOffset < vMax - LINES-6) vOffset+=(LINES-5);
|
||||||
|
else vOffset = vMax;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
hOffset = 0;
|
hOffset = 0;
|
||||||
|
@ -189,6 +279,14 @@ int main(int argc, char *argv[]) {
|
||||||
case ',':
|
case ',':
|
||||||
if (vol > 0) xmp_set_player(xc, XMP_PLAYER_VOLUME, vol-=5);
|
if (vol > 0) xmp_set_player(xc, XMP_PLAYER_VOLUME, vol-=5);
|
||||||
break;
|
break;
|
||||||
|
case '[':
|
||||||
|
if (smix > 0) smix-=5;
|
||||||
|
xmp_set_player(xc, XMP_PLAYER_MIX, smix);
|
||||||
|
break;
|
||||||
|
case ']':
|
||||||
|
if (smix < 100) smix+=5;
|
||||||
|
xmp_set_player(xc, XMP_PLAYER_MIX, smix);
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
loop = !loop;
|
loop = !loop;
|
||||||
break;
|
break;
|
||||||
|
@ -204,26 +302,26 @@ int main(int argc, char *argv[]) {
|
||||||
renderTrack(&xmi, &xfi);
|
renderTrack(&xmi, &xfi);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayChanged) {
|
if (displayChanged) {
|
||||||
werase(dis);
|
werase(dis);
|
||||||
werase(tab);
|
werase(tab);
|
||||||
hOffset = 0;
|
hOffset = 0;
|
||||||
vOffset = 0;
|
vOffset = 0;
|
||||||
move(0, 0);
|
move(0, 0);
|
||||||
for (int d = 0; d < sizeof(pages)/sizeof(*pages); d++) {
|
for (int d = 0; d < sizeof(pages)/sizeof(*pages); d++) {
|
||||||
printw(" ");
|
printw(" ");
|
||||||
chtype tpair;
|
chtype tpair;
|
||||||
if (display == d) tpair = COLOR_PAIR(3);
|
if (display == d) tpair = COLOR_PAIR(3);
|
||||||
else tpair = COLOR_PAIR(2);
|
else tpair = COLOR_PAIR(2);
|
||||||
attron(tpair);
|
attron(tpair);
|
||||||
printw(" "); printw(pages[d]); printw(" ");
|
printw(" "); printw(pages[d]); printw(" ");
|
||||||
attroff(tpair);
|
attroff(tpair);
|
||||||
printw(" ");
|
printw(" ");
|
||||||
}
|
}
|
||||||
mode = 0;
|
mode = 0;
|
||||||
wmove(tab, 0, 0);
|
wmove(tab, 0, 0);
|
||||||
displayChanged = false;
|
displayChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stopped) {
|
if (!stopped) {
|
||||||
frames = snd_pcm_bytes_to_frames(handle, xfi.buffer_size);
|
frames = snd_pcm_bytes_to_frames(handle, xfi.buffer_size);
|
||||||
|
@ -237,8 +335,8 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
if (xfi.row != row) {
|
if (xfi.row != row) {
|
||||||
row = xfi.row;
|
row = xfi.row;
|
||||||
|
renderTrack(&xmi, &xfi);
|
||||||
}
|
}
|
||||||
renderTrack(&xmi, &xfi);
|
|
||||||
wrefresh(tab);
|
wrefresh(tab);
|
||||||
wrefresh(dis);
|
wrefresh(dis);
|
||||||
} else goto keys;
|
} else goto keys;
|
||||||
|
@ -249,7 +347,7 @@ int main(int argc, char *argv[]) {
|
||||||
endwin();
|
endwin();
|
||||||
xmp_end_player(xc);
|
xmp_end_player(xc);
|
||||||
xmp_release_module(xc);
|
xmp_release_module(xc);
|
||||||
xmp_free_context(xc);
|
xmp_free_context(xc);
|
||||||
if ((err = snd_pcm_drain(handle)) < 0) {
|
if ((err = snd_pcm_drain(handle)) < 0) {
|
||||||
printf("snd_pcm_drain failed: %s\n", snd_strerror(err));
|
printf("snd_pcm_drain failed: %s\n", snd_strerror(err));
|
||||||
}
|
}
|
||||||
|
@ -280,9 +378,9 @@ void createWindows() {
|
||||||
void renderTrack(xmp_module_info *mi, xmp_frame_info *fi) {
|
void renderTrack(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
werase(dis);
|
werase(dis);
|
||||||
wclrtoeol(tab);
|
wclrtoeol(tab);
|
||||||
mvwprintw(tab, 0, 1, mi->mod->name);
|
mvwaddstr(tab, 0, 1, mi->mod->name);
|
||||||
mvwprintw(
|
mvwprintw(
|
||||||
tab,
|
tab,
|
||||||
0, COLS-12,
|
0, COLS-12,
|
||||||
"%02u:%02u/%02u:%02u",
|
"%02u:%02u/%02u:%02u",
|
||||||
((fi->time / 1000) / 60) % 60,
|
((fi->time / 1000) / 60) % 60,
|
||||||
|
@ -292,7 +390,7 @@ void renderTrack(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
);
|
);
|
||||||
mvwprintw(tab, 1, COLS-10, "VOL: %i%%", vol);
|
mvwprintw(tab, 1, COLS-10, "VOL: %i%%", vol);
|
||||||
mvwprintw(tab, 1, 1, "%i/%ibpm", fi->speed, fi->bpm);
|
mvwprintw(tab, 1, 1, "%i/%ibpm", fi->speed, fi->bpm);
|
||||||
mvwprintw(tab, LINES-2, (COLS/2)-4, "%s%s", stopped?"STOPPED":"PLAYING", loop?" [L]":"");
|
mvwprintw(tab, LINES-2, 1, "%s %s", stopped?"STOPPED":"PLAYING", loop?"[L]":"[ ]");
|
||||||
if (display == 0) {
|
if (display == 0) {
|
||||||
renderInfo(mi, fi);
|
renderInfo(mi, fi);
|
||||||
} else if (display == 1) {
|
} else if (display == 1) {
|
||||||
|
@ -311,52 +409,62 @@ void renderTrack(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
|
|
||||||
void renderInfo(xmp_module_info *mi, xmp_frame_info *fi) {
|
void renderInfo(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
wattron(dis, A_BOLD);
|
wattron(dis, A_BOLD);
|
||||||
mvwprintw(dis, 1-vOffset, 1, "Format:");
|
mvwaddstr(dis, 1-vOffset, 1, "Mode:");
|
||||||
mvwprintw(dis, 2-vOffset, 1, "Channels:");
|
mvwaddstr(dis, 2-vOffset, 1, "Format:");
|
||||||
mvwprintw(dis, 3-vOffset, 1, "Looping:");
|
mvwaddstr(dis, 3-vOffset, 1, "Stereo Mix:");
|
||||||
mvwprintw(dis, 5-vOffset, 1, "Instruments:");
|
mvwaddstr(dis, 4-vOffset, 1, "Channels:");
|
||||||
mvwprintw(dis, (7+mi->mod->ins)-vOffset, 1, "Samples:");
|
mvwaddstr(dis, 6-vOffset, 1, "Instruments:");
|
||||||
|
mvwaddstr(dis, (8+mi->mod->ins)-vOffset, 1, "Samples:");
|
||||||
wattroff(dis, A_BOLD);
|
wattroff(dis, A_BOLD);
|
||||||
|
|
||||||
mvwprintw(dis, 1-vOffset, 16, mi->mod->type);
|
mvwprintw(dis, 1-vOffset, 16, "%i", xmp_get_player(xc, XMP_PLAYER_MODE));
|
||||||
mvwprintw(dis, 2-vOffset, 16, "%i", mi->mod->chn);
|
mvwprintw(dis, 2-vOffset, 16, mi->mod->type);
|
||||||
mvwprintw(dis, 3-vOffset, 16, loop?"YES":"NO");
|
mvwprintw(dis, 3-vOffset, 16, "%i%%", smix);
|
||||||
mvwprintw(dis, 5-vOffset, 16, "%i", mi->mod->ins);
|
mvwprintw(dis, 4-vOffset, 16, "%i", mi->mod->chn);
|
||||||
mvwprintw(dis, (7+mi->mod->ins)-vOffset, 16, "%i", mi->mod->smp);
|
mvwprintw(dis, 6-vOffset, 16, "%i", mi->mod->ins);
|
||||||
|
mvwprintw(dis, (8+mi->mod->ins)-vOffset, 16, "%i", mi->mod->smp);
|
||||||
|
|
||||||
for (int xi = 0; xi < mi->mod->ins; xi++) {
|
for (int xi = 0; xi < mi->mod->ins; xi++) {
|
||||||
mvwprintw(dis, xi+6-vOffset, 1, "[%02X] %s", xi, mi->mod->xxi[xi].name);
|
mvwprintw(dis, xi+7-vOffset, 1, "[%02X] %s", xi, mi->mod->xxi[xi].name);
|
||||||
}
|
}
|
||||||
for (int xs = 0; xs < mi->mod->smp; xs++) {
|
for (int xs = 0; xs < mi->mod->smp; xs++) {
|
||||||
mvwprintw(dis, xs+(8+mi->mod->ins)-vOffset, 1, "[%02X] %s", xs, mi->mod->xxs[xs].name);
|
mvwprintw(dis, xs+(9+mi->mod->ins)-vOffset, 1, "[%02X] %s", xs, mi->mod->xxs[xs].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderAbout() {
|
void renderAbout() {
|
||||||
wattron(dis, A_BOLD);
|
wattron(dis, A_BOLD);
|
||||||
mvwprintw(dis, 1-vOffset, 2, "======== \\\\ // \\\\ //");
|
mvwaddstr(dis, 1-vOffset, 2, "######## ||##\\\\ //\\\\ || // || // ||### ||##\\\\");
|
||||||
mvwprintw(dis, 2-vOffset, 2, " || || // || //");
|
mvwaddstr(dis, 2-vOffset, 2, " || || || // \\\\ ||// ||// || || ||");
|
||||||
mvwprintw(dis, 3-vOffset, 2, " || \\\\// \\\\//");
|
mvwaddstr(dis, 3-vOffset, 2, " || ||##// ||##|| |#| |#| ||# ||##//");
|
||||||
mvwprintw(dis, 4-vOffset, 2, " || //==\\\\ //===|| ||\\\\ ||\\\\ //===\\\\ //===\\\\");
|
mvwaddstr(dis, 4-vOffset, 2, " || ||\\\\ || || ||\\\\ ||\\\\ || ||\\\\ ");
|
||||||
mvwprintw(dis, 5-vOffset, 2, " || || || | || \\\\ || \\\\ ||===// ||");
|
mvwaddstr(dis, 5-vOffset, 2, " || || \\\\ || || || \\\\ || \\\\ ||### || \\\\ ");
|
||||||
mvwprintw(dis, 6-vOffset, 2, " || || \\\\===|| || \\\\ || \\\\ \\\\___/ ||");
|
mvwaddstr(dis, 6-vOffset, 2, "=================================================");
|
||||||
mvwprintw(dis, 8-vOffset, 1, "TRAKKER v%s", TRAKKER_VERSION);
|
mvwaddstr(dis, 8-vOffset, 1, "TRAKKER");
|
||||||
mvwprintw(dis, 9-vOffset, 1, "libXMP v%s", xmp_version);
|
mvwaddstr(dis, 9-vOffset, 1, "libXMP");
|
||||||
|
|
||||||
mvwprintw(dis, 11-vOffset, 1, "[Spacebar]");
|
mvwaddstr(dis, 11-vOffset, 1, "[Spacebar]");
|
||||||
mvwprintw(dis, 12-vOffset, 1, "Number Keys");
|
mvwaddstr(dis, 12-vOffset, 1, "Number Keys");
|
||||||
mvwprintw(dis, 13-vOffset, 1, "Arrow Keys");
|
mvwaddstr(dis, 13-vOffset, 1, "[LF] and [RT]");
|
||||||
mvwprintw(dis, 14-vOffset, 1, "[,] and [.]");
|
mvwaddstr(dis, 14-vOffset, 1, "[UP] and [DN]");
|
||||||
mvwprintw(dis, 15-vOffset, 1, "[Return]");
|
mvwaddstr(dis, 15-vOffset, 1, "[,] and [.]");
|
||||||
mvwprintw(dis, 16-vOffset, 1, "[L]");
|
mvwaddstr(dis, 16-vOffset, 1, "[Return]");
|
||||||
|
mvwaddstr(dis, 17-vOffset, 1, "[L]");
|
||||||
|
mvwaddstr(dis, 18-vOffset, 1, "[PGUP] and [PGDN]");
|
||||||
|
mvwaddstr(dis, 19-vOffset, 1, "[[] and []]");
|
||||||
wattroff(dis, A_BOLD);
|
wattroff(dis, A_BOLD);
|
||||||
|
|
||||||
mvwprintw(dis, 11-vOffset, 16, "Play/Pause");
|
mvwaddstr(dis, 8-vOffset, 20, TRAKKER_VERSION);
|
||||||
mvwprintw(dis, 12-vOffset, 16, "Change Tab");
|
mvwaddstr(dis, 9-vOffset, 20, xmp_version);
|
||||||
mvwprintw(dis, 13-vOffset, 16, "Change Hori or Vert Display Offset");
|
mvwaddstr(dis, 11-vOffset, 20, "Play/Pause");
|
||||||
mvwprintw(dis, 14-vOffset, 16, "Control volume");
|
mvwaddstr(dis, 12-vOffset, 20, "Change Tab");
|
||||||
mvwprintw(dis, 15-vOffset, 16, "Reset Display");
|
mvwaddstr(dis, 13-vOffset, 20, "Change horizontal offset.");
|
||||||
mvwprintw(dis, 16-vOffset, 16, "Toggle Loop");
|
mvwaddstr(dis, 14-vOffset, 20, "Change vertical offset.");
|
||||||
|
mvwaddstr(dis, 15-vOffset, 20, "Control volume");
|
||||||
|
mvwaddstr(dis, 16-vOffset, 20, "Reset Display");
|
||||||
|
mvwaddstr(dis, 17-vOffset, 20, "Toggle Loop");
|
||||||
|
mvwaddstr(dis, 18-vOffset, 20, "Scroll vertically per page.");
|
||||||
|
mvwaddstr(dis, 19-vOffset, 20, "Change stereo mixing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderRows(xmp_module_info *mi, xmp_frame_info *fi) {
|
void renderRows(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
|
@ -365,7 +473,7 @@ void renderRows(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
if (mi->mod->xxo[j] == 0xFF) continue;
|
if (mi->mod->xxo[j] == 0xFF) continue;
|
||||||
chtype patpair = (j == fi->pos)?COLOR_PAIR(6):COLOR_PAIR(4);
|
chtype patpair = (j == fi->pos)?COLOR_PAIR(6):COLOR_PAIR(4);
|
||||||
wattron(dis, patpair);
|
wattron(dis, patpair);
|
||||||
mvwprintw(dis, LINES-5, (COLS/2)+(j*3)-(fi->pos*3), "%02X", mi->mod->xxo[j]);
|
mvwprintw(dis, LINES-5, (COLS/2)+(j*3)-(fi->pos*3)-3, "%02X", mi->mod->xxo[j]);
|
||||||
wattroff(dis, patpair);
|
wattroff(dis, patpair);
|
||||||
}
|
}
|
||||||
wattroff(tab, COLOR_PAIR(5));
|
wattroff(tab, COLOR_PAIR(5));
|
||||||
|
@ -410,7 +518,7 @@ void renderRows(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
else snprintf(vol, 4, "...");
|
else snprintf(vol, 4, "...");
|
||||||
|
|
||||||
char f1;
|
char f1;
|
||||||
if ((f1 = effects[event.fxt]) != NULL) snprintf(efx, 4, "%c%02X", f1, event.fxp);
|
if ((efxmemtable[event.fxt] || event.fxp != 0) && (f1 = efxtable[event.fxt]) != NULL) snprintf(efx, 4, "%c%02X", f1, event.fxp);
|
||||||
else snprintf(efx, 4, "...");
|
else snprintf(efx, 4, "...");
|
||||||
sprintf(lnbuf, "|%s %s %s %s", note, ins, vol, efx);
|
sprintf(lnbuf, "|%s %s %s %s", note, ins, vol, efx);
|
||||||
for (int z = 0; z < chnsize; z++) {
|
for (int z = 0; z < chnsize; z++) {
|
||||||
|
@ -441,8 +549,8 @@ void renderChannels(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
wprintw(dis, "%02X", y);
|
wprintw(dis, "%02X", y);
|
||||||
wattroff(dis, no_pair);
|
wattroff(dis, no_pair);
|
||||||
for (int c = 0; c < COLS - 5; c++) {
|
for (int c = 0; c < COLS - 5; c++) {
|
||||||
if (c < cvol) wprintw(dis, "#");
|
if (c < cvol) waddstr(dis, "#");
|
||||||
else wprintw(dis, " ");
|
else waddstr(dis, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,236 +569,243 @@ void renderInstruments(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
int note = (cinfo.note * (COLS - 4)) / 144;
|
int note = (cinfo.note * (COLS - 4)) / 144;
|
||||||
if (cinfo.instrument != y) continue;
|
if (cinfo.instrument != y) continue;
|
||||||
wmove(dis, y-vOffset, note+3);
|
wmove(dis, y-vOffset, note+3);
|
||||||
if (cinfo.volume >= 32) wprintw(dis, "#");
|
if (cinfo.volume >= 32) waddstr(dis, "#");
|
||||||
else if (cinfo.volume >= 16) wprintw(dis, "=");
|
else if (cinfo.volume >= 16) waddstr(dis, "=");
|
||||||
else if (cinfo.volume > 0) wprintw(dis, "-");
|
else if (cinfo.volume > 0) waddstr(dis, "-");
|
||||||
}
|
}
|
||||||
wmove(dis, y, COLS-4);
|
wmove(dis, y, COLS-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateEffectsTable(xmp_module *xm) {
|
void generateEffectsTable(char* type) {
|
||||||
if (isPartOf(xm->type, "669")) {
|
if (isPartOf(type, "669")) {
|
||||||
effects[96] = 'A';
|
addToEffects(96, 'A', true);
|
||||||
effects[97] = 'B';
|
addToEffects(97, 'B', true);
|
||||||
effects[98] = 'C';
|
addToEffects(98, 'C', true);
|
||||||
effects[99] = 'D';
|
addToEffects(99, 'D', true);
|
||||||
effects[100] = 'E';
|
addToEffects(100, 'E', true);
|
||||||
effects[126] = 'F';
|
addToEffects(126, 'F', true);
|
||||||
} else if (isPartOf(xm->type, "Farandole")) {
|
} else if (isPartOf(type, "Farandole")) {
|
||||||
effects[249] = '1';
|
addToEffects(249, '1', true);
|
||||||
effects[248] = '2';
|
addToEffects(248, '2', true);
|
||||||
effects[122] = '3';
|
addToEffects(122, '3', true);
|
||||||
effects[251] = '4';
|
addToEffects(251, '4', true);
|
||||||
effects[254] = '5';
|
addToEffects(254, '5', true);
|
||||||
effects[4] = '6';
|
addToEffects(4, '6', true);
|
||||||
effects[256] = '7';
|
addToEffects(256, '7', true);
|
||||||
effects[252] = '8';
|
addToEffects(252, '8', true);
|
||||||
effects[123] = '9';
|
addToEffects(123, '9', true);
|
||||||
effects[250] = 'C';
|
addToEffects(250, 'C', true);
|
||||||
effects[15] = 'F';
|
addToEffects(15, 'F', true);
|
||||||
} else if (isPartOf(xm->type, "Imago Orpheus")) {
|
} else if (isPartOf(type, "Imago Orpheus")) {
|
||||||
effects[1] = '1';
|
addToEffects(1, '1', true);
|
||||||
effects[2] = '2';
|
addToEffects(2, '2', true);
|
||||||
effects[3] = '3';
|
addToEffects(3, '3', true);
|
||||||
effects[4] = '4';
|
addToEffects(4, '4', true);
|
||||||
effects[5] = '5';
|
addToEffects(5, '5', true);
|
||||||
effects[6] = '6';
|
addToEffects(6, '6', true);
|
||||||
effects[7] = '7';
|
addToEffects(7, '7', true);
|
||||||
effects[8] = '8';
|
addToEffects(8, '8', true);
|
||||||
effects[9] = '9';
|
addToEffects(9, '9', true);
|
||||||
effects[10] = 'A';
|
addToEffects(10, 'A', true);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[12] = 'C';
|
addToEffects(12, 'C', true);
|
||||||
effects[13] = 'D';
|
addToEffects(13, 'D', true);
|
||||||
effects[14] = 'E';
|
addToEffects(14, 'E', true);
|
||||||
effects[15] = 'F';
|
addToEffects(15, 'F', true);
|
||||||
effects[16] = 'G';
|
addToEffects(16, 'G', true);
|
||||||
effects[17] = 'H';
|
addToEffects(17, 'H', true);
|
||||||
effects[18] = 'I';
|
addToEffects(18, 'I', true);
|
||||||
effects[19] = 'J';
|
addToEffects(19, 'J', true);
|
||||||
effects[20] = 'K';
|
addToEffects(20, 'K', true);
|
||||||
effects[21] = 'L';
|
addToEffects(21, 'L', true);
|
||||||
effects[22] = 'M';
|
addToEffects(22, 'M', true);
|
||||||
effects[23] = 'N';
|
addToEffects(23, 'N', true);
|
||||||
effects[24] = 'O';
|
addToEffects(24, 'O', true);
|
||||||
effects[25] = 'P';
|
addToEffects(25, 'P', true);
|
||||||
effects[26] = 'Q';
|
addToEffects(26, 'Q', true);
|
||||||
effects[27] = 'R';
|
addToEffects(27, 'R', true);
|
||||||
effects[28] = 'S';
|
addToEffects(28, 'S', true);
|
||||||
effects[29] = 'T';
|
addToEffects(29, 'T', true);
|
||||||
effects[30] = 'U';
|
addToEffects(30, 'U', true);
|
||||||
effects[31] = 'V';
|
addToEffects(31, 'V', true);
|
||||||
effects[32] = 'W';
|
addToEffects(32, 'W', true);
|
||||||
effects[33] = 'X';
|
addToEffects(33, 'X', true);
|
||||||
effects[34] = 'Y';
|
addToEffects(34, 'Y', true);
|
||||||
effects[35] = 'Z';
|
addToEffects(35, 'Z', true);
|
||||||
} else if (isPartOf(xm->type, "S3M")) {
|
} else if (isPartOf(type, "S3M")) {
|
||||||
effects[163] = 'A';
|
addToEffects(163, 'A', false);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[13] = 'C';
|
addToEffects(13, 'C', true);
|
||||||
effects[10] = 'D';
|
addToEffects(10, 'D', true);
|
||||||
effects[2] = 'E';
|
addToEffects(2, 'E', true);
|
||||||
effects[1] = 'F';
|
addToEffects(1, 'F', true);
|
||||||
effects[3] = 'G';
|
addToEffects(3, 'G', true);
|
||||||
effects[4] = 'H';
|
addToEffects(4, 'H', true);
|
||||||
effects[29] = 'I';
|
addToEffects(29, 'I', true);
|
||||||
effects[180] = 'J';
|
addToEffects(180, 'J', true);
|
||||||
effects[6] = 'K';
|
addToEffects(6, 'K', true);
|
||||||
effects[5] = 'L';
|
addToEffects(5, 'L', true);
|
||||||
effects[9] = 'O';
|
addToEffects(9, 'O', true);
|
||||||
effects[27] = 'Q';
|
addToEffects(27, 'Q', true);
|
||||||
effects[7] = 'R';
|
addToEffects(7, 'R', true);
|
||||||
effects[254] = 'S';
|
addToEffects(254, 'S', true);
|
||||||
effects[171] = 'T';
|
addToEffects(171, 'T', false);
|
||||||
effects[172] = 'U';
|
addToEffects(172, 'U', true);
|
||||||
effects[16] = 'V';
|
addToEffects(16, 'V', true);
|
||||||
effects[8] = 'X';
|
addToEffects(8, 'X', true);
|
||||||
effects[141] = 'X';
|
addToEffects(141, 'X', true);
|
||||||
effects[14] = 'S';
|
addToEffects(14, 'S', true);
|
||||||
} else if (isPartOf(xm->type, "IT")) {
|
} else if (isPartOf(type, "IT")) {
|
||||||
effects[163] = 'A';
|
addToEffects(163, 'A', false);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[142] = 'C';
|
addToEffects(142, 'C', true);
|
||||||
effects[10] = 'D';
|
addToEffects(10, 'D', true);
|
||||||
effects[2] = 'E';
|
addToEffects(2, 'E', true);
|
||||||
effects[1] = 'F';
|
addToEffects(1, 'F', true);
|
||||||
effects[3] = 'G';
|
addToEffects(3, 'G', true);
|
||||||
effects[4] = 'H';
|
addToEffects(4, 'H', true);
|
||||||
effects[29] = 'I';
|
addToEffects(29, 'I', true);
|
||||||
effects[180] = 'J';
|
addToEffects(180, 'J', true);
|
||||||
effects[6] = 'K';
|
addToEffects(6, 'K', true);
|
||||||
effects[5] = 'L';
|
addToEffects(5, 'L', true);
|
||||||
effects[128] = 'M';
|
addToEffects(128, 'M', true);
|
||||||
effects[129] = 'N';
|
addToEffects(129, 'N', true);
|
||||||
effects[9] = 'O';
|
addToEffects(9, 'O', false); // OpenMPT doc states this should be true but there is zero effect at 00 (0*256=0)
|
||||||
effects[137] = 'P';
|
addToEffects(137, 'P', true);
|
||||||
effects[27] = 'Q';
|
addToEffects(27, 'Q', true);
|
||||||
effects[7] = 'R';
|
addToEffects(7, 'R', true);
|
||||||
effects[254] = 'S';
|
addToEffects(254, 'S', true);
|
||||||
effects[135] = 'T';
|
addToEffects(135, 'T', false);
|
||||||
effects[172] = 'U';
|
addToEffects(172, 'U', true);
|
||||||
effects[16] = 'V';
|
addToEffects(16, 'V', true);
|
||||||
effects[17] = 'W';
|
addToEffects(17, 'W', true);
|
||||||
effects[8] = 'X';
|
addToEffects(8, 'X', true);
|
||||||
effects[138] = 'Y';
|
addToEffects(138, 'Y', true);
|
||||||
effects[141] = 'S';
|
addToEffects(141, 'S', true);
|
||||||
effects[136] = 'S';
|
addToEffects(136, 'S', true);
|
||||||
effects[14] = 'S';
|
addToEffects(14, 'S', true);
|
||||||
effects[192] = 'c';
|
addToEffects(192, 'c', true);
|
||||||
effects[193] = 'd';
|
addToEffects(193, 'd', true);
|
||||||
effects[194] = 'a';
|
addToEffects(194, 'a', true);
|
||||||
effects[195] = 'b';
|
addToEffects(195, 'b', true);
|
||||||
effects[132] = 'S';
|
addToEffects(132, 'S', true);
|
||||||
effects[139] = 'S';
|
addToEffects(139, 'S', true);
|
||||||
effects[140] = 'S';
|
addToEffects(140, 'S', true);
|
||||||
} else if (isPartOf(xm->type, "LIQ")) {
|
} else if (isPartOf(type, "LIQ")) {
|
||||||
effects[0] = 'A';
|
addToEffects(0, 'A', true);
|
||||||
effects[171] = 'B';
|
addToEffects(171, 'B', true);
|
||||||
effects[13] = 'C';
|
addToEffects(13, 'C', true);
|
||||||
effects[2] = 'D';
|
addToEffects(2, 'D', true);
|
||||||
effects[172] = 'F';
|
addToEffects(172, 'F', true);
|
||||||
effects[11] = 'J';
|
addToEffects(11, 'J', true);
|
||||||
effects[10] = 'L';
|
addToEffects(10, 'L', true);
|
||||||
effects[14] = 'M';
|
addToEffects(14, 'M', true);
|
||||||
effects[3] = 'N';
|
addToEffects(3, 'N', true);
|
||||||
effects[9] = 'O';
|
addToEffects(9, 'O', true);
|
||||||
effects[163] = 'S';
|
addToEffects(163, 'S', true);
|
||||||
effects[7] = 'T';
|
addToEffects(7, 'T', true);
|
||||||
effects[1] = 'U';
|
addToEffects(1, 'U', true);
|
||||||
effects[4] = 'V';
|
addToEffects(4, 'V', true);
|
||||||
effects[5] = 'X';
|
addToEffects(5, 'X', true);
|
||||||
effects[6] = 'Y';
|
addToEffects(6, 'Y', true);
|
||||||
} else if (isPartOf(xm->type, "Oktalyzer")) {
|
} else if (isPartOf(type, "Oktalyzer")) {
|
||||||
effects[1] = '1';
|
addToEffects(1, '1', true);
|
||||||
effects[2] = '2';
|
addToEffects(2, '2', true);
|
||||||
effects[112] = '0';
|
addToEffects(112, '0', true);
|
||||||
effects[113] = '0';
|
addToEffects(113, '0', true);
|
||||||
effects[114] = '0';
|
addToEffects(114, '0', true);
|
||||||
effects[115] = '6';
|
addToEffects(115, '6', true);
|
||||||
effects[116] = '5';
|
addToEffects(116, '5', true);
|
||||||
effects[156] = '6';
|
addToEffects(156, '6', true);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[15] = 'F';
|
addToEffects(15, 'F', true);
|
||||||
effects[157] = '5';
|
addToEffects(157, '5', true);
|
||||||
effects[12] = 'C';
|
addToEffects(12, 'C', true);
|
||||||
effects[10] = 'A';
|
addToEffects(10, 'A', true);
|
||||||
effects[174] = 'E';
|
addToEffects(174, 'E', true);
|
||||||
effects[17] = 'E';
|
addToEffects(17, 'E', true);
|
||||||
effects[0] = '0';
|
addToEffects(0, '0', true);
|
||||||
} else if (isPartOf(xm->type, "STX")) {
|
} else if (isPartOf(type, "STX")) {
|
||||||
effects[15] = 'A';
|
addToEffects(15, 'A', true);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[13] = 'C';
|
addToEffects(13, 'C', true);
|
||||||
effects[10] = 'D';
|
addToEffects(10, 'D', true);
|
||||||
effects[2] = 'E';
|
addToEffects(2, 'E', true);
|
||||||
effects[1] = 'F';
|
addToEffects(1, 'F', true);
|
||||||
effects[3] = 'G';
|
addToEffects(3, 'G', true);
|
||||||
effects[4] = 'H';
|
addToEffects(4, 'H', true);
|
||||||
effects[29] = 'I';
|
addToEffects(29, 'I', true);
|
||||||
effects[0] = 'J';
|
addToEffects(0, 'J', true);
|
||||||
} else if (isPartOf(xm->type, "Funk")) {
|
} else if (isPartOf(type, "Funk")) {
|
||||||
effects[121] = 'A';
|
addToEffects(121, 'A', true);
|
||||||
effects[120] = 'B';
|
addToEffects(120, 'B', true);
|
||||||
effects[122] = 'C';
|
addToEffects(122, 'C', true);
|
||||||
effects[123] = 'D';
|
addToEffects(123, 'D', true);
|
||||||
effects[124] = 'G';
|
addToEffects(124, 'G', true);
|
||||||
effects[125] = 'H';
|
addToEffects(125, 'H', true);
|
||||||
effects[0] = 'L';
|
addToEffects(0, 'L', true);
|
||||||
effects[12] = 'N';
|
addToEffects(12, 'N', true);
|
||||||
effects[127] = 'O';
|
addToEffects(127, 'O', true);
|
||||||
effects[14] = 'O';
|
addToEffects(14, 'O', true);
|
||||||
effects[15] = 'O';
|
addToEffects(15, 'O', true);
|
||||||
} else {
|
} else {
|
||||||
effects[0] = '0';
|
addToEffects(0, '0', false);
|
||||||
effects[1] = '1';
|
addToEffects(1, '1', false);
|
||||||
effects[2] = '2';
|
addToEffects(2, '2', false);
|
||||||
effects[3] = '3';
|
addToEffects(3, '3', true);
|
||||||
effects[4] = '4';
|
addToEffects(4, '4', true);
|
||||||
effects[5] = '5';
|
addToEffects(5, '5', false);
|
||||||
effects[6] = '6';
|
addToEffects(6, '6', false);
|
||||||
effects[7] = '7';
|
addToEffects(7, '7', true);
|
||||||
effects[8] = '8';
|
addToEffects(8, '8', true);
|
||||||
effects[9] = '9';
|
addToEffects(9, '9', true);
|
||||||
effects[10] = 'A';
|
addToEffects(10, 'A', false);
|
||||||
effects[11] = 'B';
|
addToEffects(11, 'B', true);
|
||||||
effects[12] = 'C';
|
addToEffects(12, 'C', true);
|
||||||
effects[13] = 'D';
|
addToEffects(13, 'D', true);
|
||||||
effects[14] = 'E';
|
addToEffects(14, 'E', false);
|
||||||
effects[15] = 'F';
|
addToEffects(15, 'F', true);
|
||||||
effects[16] = 'G';
|
addToEffects(16, 'G', true);
|
||||||
effects[27] = 'Q';
|
addToEffects(27, 'Q', true);
|
||||||
effects[181] = 'P';
|
addToEffects(181, 'P', true);
|
||||||
effects[17] = 'H';
|
addToEffects(17, 'H', true);
|
||||||
effects[21] = 'L';
|
addToEffects(21, 'L', true);
|
||||||
effects[164] = 'c';
|
addToEffects(164, 'c', true);
|
||||||
effects[33] = 'X';
|
addToEffects(33, 'X', true);
|
||||||
effects[20] = 'K';
|
addToEffects(20, 'K', true);
|
||||||
effects[25] = 'P';
|
addToEffects(25, 'P', true);
|
||||||
effects[29] = 'T';
|
addToEffects(29, 'T', true);
|
||||||
effects[146] = '4';
|
addToEffects(146, '4', true);
|
||||||
effects[160] = 'x';
|
addToEffects(160, 'x', true);
|
||||||
effects[161] = 'x';
|
addToEffects(161, 'x', true);
|
||||||
effects[171] = 'F';
|
addToEffects(171, 'F', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We do not care for previous effects (memory = true) because it's a tracker.
|
||||||
|
// 'mem' is only for discarding zero values.
|
||||||
|
void addToEffects(int id, char efx, bool mem) {
|
||||||
|
efxtable[id] = efx;
|
||||||
|
efxmemtable[id] = mem;
|
||||||
|
}
|
||||||
|
|
||||||
bool isPartOf(char* w1, char* w2) {
|
bool isPartOf(char* w1, char* w2) {
|
||||||
int i=0;
|
int i=0;
|
||||||
int j=0;
|
int j=0;
|
||||||
while(w1[i]!='\0'){
|
while(w1[i]!='\0'){
|
||||||
if(w1[i] == w2[j]) {
|
if(w1[i] == w2[j]) {
|
||||||
int init = i;
|
int init = i;
|
||||||
while (w1[i] == w2[j] && w2[j]!='\0') {
|
while (w1[i] == w2[j] && w2[j]!='\0') {
|
||||||
j++;
|
j++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(w2[j]=='\0') {
|
if(w2[j]=='\0') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
j=0;
|
j=0;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
|
@ -1,6 +1,12 @@
|
||||||
#ifndef TRAKKER_H
|
#ifndef TRAKKER_H
|
||||||
#define TRAKKER_H
|
#define TRAKKER_H
|
||||||
|
|
||||||
|
xmp_context xc;
|
||||||
|
snd_pcm_t *handle;
|
||||||
|
snd_pcm_sframes_t frames;
|
||||||
|
WINDOW *dis;
|
||||||
|
WINDOW *tab;
|
||||||
|
|
||||||
void destroyWindows();
|
void destroyWindows();
|
||||||
void createWindows();
|
void createWindows();
|
||||||
void renderInfo(xmp_module_info *mi, xmp_frame_info *fi);
|
void renderInfo(xmp_module_info *mi, xmp_frame_info *fi);
|
||||||
|
@ -9,7 +15,8 @@ void renderTrack(xmp_module_info *mi, xmp_frame_info *fi);
|
||||||
void renderRows(xmp_module_info *mi, xmp_frame_info *fi);
|
void renderRows(xmp_module_info *mi, xmp_frame_info *fi);
|
||||||
void renderChannels(xmp_module_info *mi, xmp_frame_info *fi);
|
void renderChannels(xmp_module_info *mi, xmp_frame_info *fi);
|
||||||
void renderInstruments(xmp_module_info *mi, xmp_frame_info *fi);
|
void renderInstruments(xmp_module_info *mi, xmp_frame_info *fi);
|
||||||
void generateEffectsTable(xmp_module *xm);
|
void generateEffectsTable(char* type);
|
||||||
|
void addToEffects(int id, char efx, bool mem);
|
||||||
bool isPartOf(char* w1, char* w2);
|
bool isPartOf(char* w1, char* w2);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user