redo scope, fix warning on strings
This commit is contained in:
parent
544396d82e
commit
a745768f9b
38
src/main.cpp
38
src/main.cpp
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
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. Scope", "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 const char* device = "default";
|
||||||
|
|
||||||
char* file;
|
char* file;
|
||||||
bool colorMode = 0; // 0 - Auto, 1 - Monochrome, 2 - 8-bit, 3 - Full
|
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>
|
#include <vector>
|
||||||
std::vector<int> bufbuf;
|
std::vector<int> bufbuf;
|
||||||
void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
|
void displayScope(xmp_module_info *mi, xmp_frame_info *fi) {
|
||||||
bufbuf.resize(fi->buffer_size);
|
|
||||||
const char* xbuf = (char*)fi->buffer;
|
const char* xbuf = (char*)fi->buffer;
|
||||||
float nxcol = 0;
|
int percol = (fi->buffer_size/(COLS-2));
|
||||||
int rate = 2;
|
bufbuf.resize(COLS-2);
|
||||||
int midLine = (LINES-4)/2;
|
|
||||||
int horzInc = 1;
|
wmove(dis, 0, 0);
|
||||||
for (int s = 0; s < fi->buffer_size; s++) {
|
for (int s = 0; s < COLS-2; s++) {
|
||||||
if (nxcol >= COLS-2) break;
|
int colsum = 0;
|
||||||
int l = lerp(bufbuf[s], lerp(xbuf[s-rate], xbuf[s], 0.5f), 0.5f);
|
for (int v = 0; v < percol; v++) {
|
||||||
int newpos = ((l+0x80) * (LINES - 4)) / 0xFF;
|
colsum += xbuf[(s*percol)+v];
|
||||||
horzInc = (newpos < midLine)?-1:1;
|
}
|
||||||
for (int j = midLine; j != newpos; j+=horzInc) {
|
int l = lerp(bufbuf[s], (colsum / percol)*2, 0.8f);
|
||||||
wmove(dis, j, (int)nxcol);
|
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, '|');
|
waddch(dis, '|');
|
||||||
}
|
}
|
||||||
wmove(dis, newpos, (int)nxcol);
|
wmove(dis, r, s);
|
||||||
waddch(dis, '|');
|
waddch(dis, '+');
|
||||||
nxcol+=(1.0*(COLS-2)/fi->buffer_size);
|
|
||||||
bufbuf[s] = l;
|
bufbuf[s] = l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -973,7 +977,7 @@ void addToEffects(int id, char efx, bool mem) {
|
||||||
efxmemtable[id] = mem;
|
efxmemtable[id] = mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPartOf(char* w1, char* w2) {
|
bool isPartOf(char* w1, const char* w2) {
|
||||||
int i=0;
|
int i=0;
|
||||||
int j=0;
|
int j=0;
|
||||||
while(w1[i]!='\0'){
|
while(w1[i]!='\0'){
|
||||||
|
|
|
@ -18,6 +18,6 @@ void displayPlayer();
|
||||||
void displayHelp();
|
void displayHelp();
|
||||||
void generateEffectsTable(char* type);
|
void generateEffectsTable(char* type);
|
||||||
void addToEffects(int id, char efx, bool mem);
|
void addToEffects(int id, char efx, bool mem);
|
||||||
bool isPartOf(char* w1, char* w2);
|
bool isPartOf(char* w1, const char* w2);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user