Compare commits

..

2 Commits

Author SHA1 Message Date
a745768f9b redo scope, fix warning on strings 2024-04-11 17:09:59 -05:00
544396d82e Add default build directory 2024-04-11 17:04:40 -05:00
3 changed files with 27 additions and 22 deletions

View File

@ -3,6 +3,7 @@ project(trakker)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED True)
SET(CMAKE_CXX_FLAGS "-O3")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR})
find_package(Git)
find_package(ALSA REQUIRED)

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