proper key input

This commit is contained in:
y4my4my4m 2023-09-04 22:05:16 +09:00
parent c92f7db428
commit a2444fc172

View file

@ -101,43 +101,38 @@ U0 EnterPattern(Pattern *pattern) {
NoteCell *cell; NoteCell *cell;
for (row = 0; row < TRACK_LENGTH; row++) { for (row = 0; row < TRACK_LENGTH; row++) {
cell = &pattern->cells[row]; cell = &pattern->cells[row];
Print("Enter note for row $$LTGREEN$$%d$$FG$$ (0-127, 0 for none): ", row); cell->note = I64Get("Enter note for row $$LTGREEN$$%d$$FG$$ (0-127, 0 for none): ", row);
cell->note = KeyGet(&sc);
"%d\n", cell->note;
if (cell->note) { if (cell->note) {
Print("Enter velocity for note (1-127): "); cell->velocity = I64Get("Enter velocity for note (1-127): ");
cell->velocity = KeyGet(&sc);
"%d\n", cell->velocity;
if (cell->velocity) { if (cell->velocity) {
Print("Enter instrument for note (1-5): ");  Print("Enter instrument for note (1-5): ");
switch (KeyGet(&sc)) { switch (KeyGet(&sc)) {
case '1': case '1':
cell->instrument = PULSE1; cell->instrument = PULSE1;
"PULSE1\n"; "PULSE1\n";
break; break;
case '2': case '2':
cell->instrument = PULSE2; cell->instrument = PULSE2;
"PULSE2\n"; "PULSE2\n";
break; break;
case '3': case '3':
cell->instrument = TRIANGLE; cell->instrument = TRIANGLE;
"TRIANGLE\n"; "TRIANGLE\n";
break; break;
case '4': case '4':
cell->instrument = NOISE; cell->instrument = NOISE;
"NOISE\n"; "NOISE\n";
break; break;
case '5': case '5':
cell->instrument = SAMPLE; cell->instrument = SAMPLE;
"SAMPLE\n"; "SAMPLE\n";
break; break;
default: default:
cell->instrument = INSTRUMENT_NONE; cell->instrument = INSTRUMENT_NONE;
"SINE\n"; "SINE\n";
break; break;
// return;
} }
AudioPlayNote(cell->note, cell->velocity, cell->instrument); AudioPlayNote(cell->note, cell->velocity, cell->instrument);
} }
} }
@ -229,5 +224,5 @@ U0 MusicTracker() {
} }
} }
CleanupWaveformGen(); // Free the sample buffer CleanupWaveformGen(); // Free the sample buffer
Kill("Oscilloscope"); //Kill("Oscilloscope");
} }