|
|
@ -28,25 +28,25 @@ Bounce but1 = Bounce(BUT1_PIN, 10); // 10 ms debounce |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// GUItool: begin automatically generated code
|
|
|
|
// GUItool: begin automatically generated code
|
|
|
|
AudioPlayQueue queue1; //xy=494,404
|
|
|
|
AudioPlayQueue queue_r; //xy=494,404
|
|
|
|
AudioPlayQueue queue2; //xy=494,404
|
|
|
|
AudioPlayQueue queue_l; //xy=494,404
|
|
|
|
AudioAnalyzePeak peak1; //xy=695,491
|
|
|
|
AudioAnalyzePeak peak_r; //xy=695,491
|
|
|
|
AudioAnalyzePeak peak2; //xy=695,491
|
|
|
|
AudioAnalyzePeak peak_l; //xy=695,491
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
AudioOutputI2S i2s1; //xy=1072,364
|
|
|
|
AudioOutputI2S i2s1; //xy=1072,364
|
|
|
|
AudioConnection patchCord1(queue1, peak1); |
|
|
|
AudioConnection patchCord1(queue_r, peak_r); |
|
|
|
AudioConnection patchCord2(queue2, peak2); |
|
|
|
AudioConnection patchCord2(queue_l, peak_l); |
|
|
|
AudioConnection patchCord5(queue1, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord3(queue_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord6(queue2, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord4(queue_l, 0, i2s1, 1); |
|
|
|
AudioControlSGTL5000 sgtl5000_1; //xy=700,536
|
|
|
|
AudioControlSGTL5000 sgtl5000_1; //xy=700,536
|
|
|
|
#else |
|
|
|
#else |
|
|
|
AudioOutputPT8211 pt8211_1; //xy=1079,320
|
|
|
|
AudioOutputPT8211 pt8211_1; //xy=1079,320
|
|
|
|
AudioAmplifier volume_r; //xy=818,370
|
|
|
|
AudioAmplifier volume_r; //xy=818,370
|
|
|
|
AudioAmplifier volume_l; //xy=818,411
|
|
|
|
AudioAmplifier volume_l; //xy=818,411
|
|
|
|
AudioConnection patchCord1(queue1, volume_r); |
|
|
|
AudioConnection patchCord1(queue_r, volume_r); |
|
|
|
AudioConnection patchCord2(queue2, volume_l); |
|
|
|
AudioConnection patchCord2(queue_l, volume_l); |
|
|
|
AudioConnection patchCord3(volume_r, peak1); |
|
|
|
AudioConnection patchCord3(volume_r, peak_r); |
|
|
|
AudioConnection patchCord4(volume_l, peak2); |
|
|
|
AudioConnection patchCord4(volume_l, peak_l); |
|
|
|
AudioConnection patchCord5(volume_r, 0, pt8211_1, 0); |
|
|
|
AudioConnection patchCord5(volume_r, 0, pt8211_1, 0); |
|
|
|
AudioConnection patchCord6(volume_l, 0, pt8211_1, 1); |
|
|
|
AudioConnection patchCord6(volume_l, 0, pt8211_1, 1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -105,6 +105,7 @@ void setup() |
|
|
|
enc1.write(INITIAL_ENC1_VALUE); |
|
|
|
enc1.write(INITIAL_ENC1_VALUE); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delay(500); |
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
|
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
|
Serial.println(F("https://about.teahub.io/dcoredump/MicroMDAEpiano")); |
|
|
|
Serial.println(F("https://about.teahub.io/dcoredump/MicroMDAEpiano")); |
|
|
@ -113,6 +114,7 @@ void setup() |
|
|
|
Serial.println(F(" bytes")); |
|
|
|
Serial.println(F(" bytes")); |
|
|
|
Serial.println(); |
|
|
|
Serial.println(); |
|
|
|
Serial.println(F("<setup start>")); |
|
|
|
Serial.println(F("<setup start>")); |
|
|
|
|
|
|
|
delay(1000); |
|
|
|
|
|
|
|
|
|
|
|
initial_values_from_eeprom(); |
|
|
|
initial_values_from_eeprom(); |
|
|
|
|
|
|
|
|
|
|
@ -195,35 +197,35 @@ void loop() |
|
|
|
|
|
|
|
|
|
|
|
handle_input(); |
|
|
|
handle_input(); |
|
|
|
|
|
|
|
|
|
|
|
audio_buffer_r = queue1.getBuffer(); |
|
|
|
audio_buffer_r = queue_r.getBuffer(); |
|
|
|
if (audio_buffer_r == NULL) |
|
|
|
if (audio_buffer_r == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Serial.println(F("E: audio_buffer_r allocation problems!")); |
|
|
|
Serial.println(F("E: audio_buffer_r allocation problems!")); |
|
|
|
} |
|
|
|
} |
|
|
|
audio_buffer_l = queue2.getBuffer(); |
|
|
|
audio_buffer_l = queue_l.getBuffer(); |
|
|
|
if (audio_buffer_l == NULL) |
|
|
|
if (audio_buffer_l == NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Serial.println(F("E: audio_buffer_l allocation problems!")); |
|
|
|
Serial.println(F("E: audio_buffer_l allocation problems!")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!queue1.available() || !queue2.available()) |
|
|
|
if (!queue_r.available() || !queue_l.available()) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
elapsedMicros t1; |
|
|
|
elapsedMicros t1; |
|
|
|
//ep->process(AUDIO_BLOCK_SAMPLES, audio_buffer);
|
|
|
|
ep->process(&audio_buffer_l,&audio_buffer_r,AUDIO_BLOCK_SAMPLES); |
|
|
|
uint32_t t2 = t1; |
|
|
|
uint32_t t2 = t1; |
|
|
|
if (t2 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun!
|
|
|
|
if (t2 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun!
|
|
|
|
xrun++; |
|
|
|
xrun++; |
|
|
|
if (t2 > render_time_max) |
|
|
|
if (t2 > render_time_max) |
|
|
|
render_time_max = t2; |
|
|
|
render_time_max = t2; |
|
|
|
if (peak1.available()) |
|
|
|
if (peak_r.available()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (peak1.read() > 0.99) |
|
|
|
if (peak_r.read() > 0.99) |
|
|
|
peak++; |
|
|
|
peak++; |
|
|
|
} |
|
|
|
} |
|
|
|
if (peak2.available()) |
|
|
|
if (peak_l.available()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (peak2.read() > 0.99) |
|
|
|
if (peak_l.read() > 0.99) |
|
|
|
peak++; |
|
|
|
peak++; |
|
|
|
} |
|
|
|
} |
|
|
|
#ifndef TEENSY_AUDIO_BOARD |
|
|
|
#ifndef TEENSY_AUDIO_BOARD |
|
|
@ -231,8 +233,8 @@ void loop() |
|
|
|
audio_buffer_r[i] *= vol_r; |
|
|
|
audio_buffer_r[i] *= vol_r; |
|
|
|
audio_buffer_l[i] *= vol_l; |
|
|
|
audio_buffer_l[i] *= vol_l; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
queue1.playBuffer(); |
|
|
|
queue_r.playBuffer(); |
|
|
|
queue2.playBuffer(); |
|
|
|
queue_l.playBuffer(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void handle_input(void) |
|
|
|
void handle_input(void) |
|
|
@ -739,14 +741,6 @@ void note_off(void) |
|
|
|
queue_midi_event(0x80, TEST_NOTE + 52, 0); // 14
|
|
|
|
queue_midi_event(0x80, TEST_NOTE + 52, 0); // 14
|
|
|
|
queue_midi_event(0x80, TEST_NOTE + 57, 0); // 15
|
|
|
|
queue_midi_event(0x80, TEST_NOTE + 57, 0); // 15
|
|
|
|
queue_midi_event(0x80, TEST_NOTE + 60, 0); // 16
|
|
|
|
queue_midi_event(0x80, TEST_NOTE + 60, 0); // 16
|
|
|
|
|
|
|
|
|
|
|
|
bool success = load_sysex(DEFAULT_SYSEXBANK, (++_voice_counter) - 1); |
|
|
|
|
|
|
|
if (success == false) |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("E: Cannot load SYSEX data")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
show_patch(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|