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 17)
SET(CMAKE_CXX_STANDARD_REQUIRED True) SET(CMAKE_CXX_STANDARD_REQUIRED True)
SET(CMAKE_CXX_FLAGS "-O3") SET(CMAKE_CXX_FLAGS "-O3")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR})
find_package(Git) find_package(Git)
find_package(ALSA REQUIRED) 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 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,26 +633,30 @@ 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;
waddch(dis, '|'); else if (l <= -0x80) l = -0x80;
} int r = (1.0*(l+0x80)/0xFF)*(LINES-4);
wmove(dis, newpos, (int)nxcol);
waddch(dis, '|'); for (int j = l; j != bufbuf[s]; j+=(bufbuf[s]>l?1:-1)) {
nxcol+=(1.0*(COLS-2)/fi->buffer_size); wmove(dis, (1.0*(j+0x80)/0xFF)*(LINES-4), s);
bufbuf[s] = l; waddch(dis, '|');
} }
wmove(dis, r, s);
waddch(dis, '+');
bufbuf[s] = l;
}
} }
void displayNoteRoll(xmp_module_info *mi, xmp_frame_info *fi) { void displayNoteRoll(xmp_module_info *mi, xmp_frame_info *fi) {
@ -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'){

View File

@ -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