Small fixes and debug output.

pull/4/head
Holger Wirtz 7 years ago
parent 41ff645b3b
commit e3c42a1457
  1. 15
      MicroDexed.ino
  2. 1
      config.h
  3. 52
      dexed.cpp

@ -83,7 +83,7 @@ void setup()
AudioMemoryUsageMaxReset(); AudioMemoryUsageMaxReset();
#endif #endif
load_sysex("ROM1A.SYX", 10); load_sysex("ROM1A.SYX", 17);
#ifdef DEBUG #ifdef DEBUG
show_patch(); show_patch();
#endif #endif
@ -134,13 +134,13 @@ void loop()
{ {
Serial.println(F("audio_buffer allocation problems!")); Serial.println(F("audio_buffer allocation problems!"));
} }
while (usbMIDI.read()) while (usbMIDI.read())
{ {
break_for_calculation = dexed->processMidiMessage(usbMIDI.getType(), usbMIDI.getData1(), usbMIDI.getData2()); break_for_calculation = dexed->processMidiMessage(usbMIDI.getType(), usbMIDI.getData1(), usbMIDI.getData2());
if (break_for_calculation == true) if (break_for_calculation == true)
break; break;
} }
if (!break_for_calculation) if (!break_for_calculation)
{ {
while (MIDI.read()) while (MIDI.read())
@ -157,7 +157,10 @@ void loop()
#if defined(SHOW_DEXED_TIMING) || defined(SHOW_XRUN) #if defined(SHOW_DEXED_TIMING) || defined(SHOW_XRUN)
elapsedMicros t1; elapsedMicros t1;
#endif #endif
Serial.println("1");
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer); dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer);
Serial.println("2");
#ifdef SHOW_XRUN #ifdef SHOW_XRUN
uint32_t t2 = t1; uint32_t t2 = t1;
if (t2 > 2900) // everything greater 2.9ms is a buffer underrun! if (t2 > 2900) // everything greater 2.9ms is a buffer underrun!
@ -216,6 +219,14 @@ void note_off(void)
bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2) bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2)
{ {
#ifdef SHOW_MIDI_EVENT
Serial.print("MIDI event type: ");
Serial.print(type, DEC);
Serial.print(" data1: ");
Serial.print(data1, DEC);
Serial.print(" data2: ");
Serial.println(data2, DEC);
#endif
return (dexed->processMidiMessage(type, data1, data2)); return (dexed->processMidiMessage(type, data1, data2));
} }

@ -16,6 +16,7 @@
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#define DEXED_ENGINE DEXED_ENGINE_MODERN #define DEXED_ENGINE DEXED_ENGINE_MODERN
//#define SHOW_DEXED_TIMING 1 //#define SHOW_DEXED_TIMING 1
#define SHOW_MIDI_EVENT 1
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
#define MAX_NOTES 16 #define MAX_NOTES 16

@ -1,26 +1,26 @@
/* /*
* MicroDexed MicroDexed
*
* MicroDexed is a port of the Dexed sound engine MicroDexed is a port of the Dexed sound engine
* (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield (https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield
*
* (c)2018 H. Wirtz <wirtz@parasitstudio.de> (c)2018 H. Wirtz <wirtz@parasitstudio.de>
*
* This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/ */
#include "synth.h" #include "synth.h"
#include "dexed.h" #include "dexed.h"
@ -155,6 +155,14 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
bool Dexed::processMidiMessage(uint8_t type, uint8_t data1, uint8_t data2) bool Dexed::processMidiMessage(uint8_t type, uint8_t data1, uint8_t data2)
{ {
#ifdef SHOW_MIDI_EVENT
Serial.print("MIDI event type: ");
Serial.print(type, DEC);
Serial.print(" data1: ");
Serial.print(data1, DEC);
Serial.print(" data2: ");
Serial.println(data2, DEC);
#endif
switch (type & 0xf0) { switch (type & 0xf0) {
case 0x80 : case 0x80 :
keyup(data1); keyup(data1);

Loading…
Cancel
Save