Save current state.

chorus
Holger Wirtz 6 years ago
parent 071d50b99c
commit 6c14711c6f
  1. 54
      MicroMDAPiano.ino
  2. 13
      config.h
  3. 3
      mdaEPiano.h

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

@ -30,21 +30,18 @@
// Initial values // Initial values
#define MIDI_DEVICE Serial1 #define MIDI_DEVICE Serial1
#define USE_ONBOARD_USB_HOST 1 //#define USE_ONBOARD_USB_HOST 1
#define TEENSY_AUDIO_BOARD 1 #define TEENSY_AUDIO_BOARD 1
#define VOLUME 0.6 #define VOLUME 0.6
#define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI #define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI
#define DEFAULT_SYSEXBANK 0 #define AUDIO_MEM 4
#define DEFAULT_SYSEXSOUND 0
//#define DEXED_ENGINE DEXED_ENGINE_MODERN
#define AUDIO_MEM 2
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#if !defined(__MK66FX1M0__) // check for Teensy-3.6 #if !defined(__MK66FX1M0__) // check for Teensy-3.6
#define MAX_NOTES 11 // No? #define NVOCIES 11 // No?
#undef USE_ONBOARD_USB_HOST #undef USE_ONBOARD_USB_HOST
#else #else
#define MAX_NOTES 16 // Yes #define NVOICES 16 // Yes
#endif #endif
// Master key handling (comment for disabling) // Master key handling (comment for disabling)
@ -59,7 +56,7 @@
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
// Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard // Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard
//#define TEST_NOTE MIDI_E2 #define TEST_NOTE MIDI_E2
#define TEST_VEL_MIN 60 #define TEST_VEL_MIN 60
#define TEST_VEL_MAX 110 #define TEST_VEL_MAX 110

@ -5,11 +5,12 @@
#include <Audio.h> #include <Audio.h>
#include <string.h> #include <string.h>
#include "config.h"
#define NPARAMS 12 //number of parameters #define NPARAMS 12 //number of parameters
#define NPROGS 8 //number of programs #define NPROGS 8 //number of programs
#define NOUTS 2 //number of outputs #define NOUTS 2 //number of outputs
#define NVOICES 32 //max polyphony //#define NVOICES 32 //max polyphony
#define SUSTAIN 128 #define SUSTAIN 128
#define SILENCE 0.0001f //voice choking #define SILENCE 0.0001f //voice choking
#define WAVELEN 422414 //wave data bytes #define WAVELEN 422414 //wave data bytes

Loading…
Cancel
Save