Working now!

This commit is contained in:
Neale Pickett 2020-11-25 21:38:29 -07:00
parent 13c72dae2a
commit 5d6bc54653
3 changed files with 16 additions and 15 deletions

View File

@ -9,26 +9,29 @@ void playDrones() {
} }
} }
void doPlay(Pipe pipe, Adafruit_SSD1306 display, bool forceDisplayUpdate) { void doPlay(bool forceDisplayUpdate) {
static Note last_note = NOTE_ZERO; static Note last_note = NOTE_ZERO;
bool updateDisplay = forceDisplayUpdate; bool updateDisplay = forceDisplayUpdate;
diag("silent?"); if (updateDisplay) {
display.clearDisplay();
display.fillRect(0, 0, 2, 2, SSD1306_WHITE);
display.display();
}
if (pipe.silent) { if (pipe.silent) {
Chanter.NoteOff(); Chanter.NoteOff();
} else { } else {
// Calculate pitch, and glissando pitch // Calculate pitch, and glissando pitch
uint16_t pitch = tuning.GetPitch(pipe.note); float pitch = tuning.GetPitch(pipe.note);
uint16_t glissandoPitch = tuning.GetPitch(pipe.glissandoNote); float glissandoPitch = tuning.GetPitch(pipe.glissandoNote);
diag("bend");
// Bend pitch if fewer than 3 half steps away // Bend pitch if fewer than 3 half steps away
if (abs(pipe.glissandoNote - pipe.note) < 3) { if (abs(pipe.glissandoNote - pipe.note) < 3) {
float diff = glissandoPitch - pitch; float diff = glissandoPitch - pitch;
pitch += diff * pipe.glissandoOpenness; pitch += diff * pipe.glissandoOpenness;
} }
diag("shelf");
// Apply a low shelf filter if this is the alternate fingering // Apply a low shelf filter if this is the alternate fingering
if (pipe.altFingering) { if (pipe.altFingering) {
biquad1.setLowShelf(0, 2000, 0.2, 1); biquad1.setLowShelf(0, 2000, 0.2, 1);
@ -44,12 +47,11 @@ void doPlay(Pipe pipe, Adafruit_SSD1306 display, bool forceDisplayUpdate) {
} }
} }
diag("check last note");
if (pipe.note != last_note) { if (pipe.note != last_note) {
updateDisplay = true; updateDisplay = true;
} }
diag("update display"); #if 0
if (updateDisplay) { if (updateDisplay) {
// Look up the note name // Look up the note name
const char *note_name = NoteName(pipe.note); const char *note_name = NoteName(pipe.note);
@ -65,7 +67,7 @@ void doPlay(Pipe pipe, Adafruit_SSD1306 display, bool forceDisplayUpdate) {
display.print(note_name); display.print(note_name);
display.display(); display.display();
//last_note = pipe.note; last_note = pipe.note;
} }
diag("play done"); #endif
} }

View File

@ -140,7 +140,7 @@ void setupInfo() {
display.setFont(); display.setFont();
display.setTextSize(1); display.setTextSize(1);
display.setCursor(0, 16); display.setCursor(0, 16);
display.print("build"); display.print("FC-1");
display.setCursor(0, 24); display.setCursor(0, 24);
display.print(buildDate); display.print(buildDate);
} }

View File

@ -194,6 +194,7 @@ void setup() {
playDrones(); playDrones();
diag("Done!"); diag("Done!");
display.dim(true);
} }
void loadPatch(uint8_t where) { void loadPatch(uint8_t where) {
@ -220,7 +221,7 @@ void loadPatch(uint8_t where) {
void loop() { void loop() {
static bool upSetting = false; // GET IT? static bool upSetting = true; // GET IT?
pipe.Update(); pipe.Update();
@ -242,8 +243,6 @@ void loop() {
} }
} }
diag("Play!"); doPlay(upSetting);
doPlay(pipe, display, upSetting);
upSetting = false; upSetting = false;
diag("Done!");
} }