redo scope, fix warning on strings

This commit is contained in:
Wirlaburla 2024-04-11 17:09:59 -05:00
parent 544396d82e
commit a745768f9b
2 changed files with 26 additions and 22 deletions

View File

@ -17,7 +17,7 @@
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. Scope", "4. Piano Roll", "5. Config", "6. Help" };
static char* device = "default";
static const char* device = "default";
char* file;
bool colorMode = 0; // 0 - Auto, 1 - Monochrome, 2 - 8-bit, 3 - Full
@ -633,24 +633,28 @@ int lerp (int a, int b, float f) {
#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], lerp(xbuf[s-rate], xbuf[s], 0.5f), 0.5f);
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);
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++) {
colsum += xbuf[(s*percol)+v];
}
int l = lerp(bufbuf[s], (colsum / percol)*2, 0.8f);
if (l >= 0x80) l = 0x80;
else if (l <= -0x80) l = -0x80;
int r = (1.0*(l+0x80)/0xFF)*(LINES-4);
for (int j = l; j != bufbuf[s]; j+=(bufbuf[s]>l?1:-1)) {
wmove(dis, (1.0*(j+0x80)/0xFF)*(LINES-4), s);
waddch(dis, '|');
}
wmove(dis, newpos, (int)nxcol);
waddch(dis, '|');
nxcol+=(1.0*(COLS-2)/fi->buffer_size);
wmove(dis, r, s);
waddch(dis, '+');
bufbuf[s] = l;
}
}
@ -973,7 +977,7 @@ void addToEffects(int id, char efx, bool mem) {
efxmemtable[id] = mem;
}
bool isPartOf(char* w1, char* w2) {
bool isPartOf(char* w1, const char* w2) {
int i=0;
int j=0;
while(w1[i]!='\0'){

View File

@ -18,6 +18,6 @@ void displayPlayer();
void displayHelp();
void generateEffectsTable(char* type);
void addToEffects(int id, char efx, bool mem);
bool isPartOf(char* w1, char* w2);
bool isPartOf(char* w1, const char* w2);
#endif