Removed AUDIO_BLOCK_SIZE in config.h

Added support for optionaly not using the reverb (needed for T_3.x when
xruns appear).
pull/6/head
Holger Wirtz 5 years ago
parent f6b68c4d8c
commit 2aad206764
  1. 5
      MicroDexed.ino
  2. 106
      UI.hpp
  3. 34
      config.h
  4. 2
      effect_stereo_mono.h

@ -176,7 +176,7 @@ void setup()
pinMode(SDCARD_CS_PIN, OUTPUT); pinMode(SDCARD_CS_PIN, OUTPUT);
pinMode(U8X8_CS_PIN, OUTPUT); pinMode(U8X8_CS_PIN, OUTPUT);
#endif #endif
#ifdef ENABLE_LCD_UI #ifdef ENABLE_LCD_UI
setup_ui(); setup_ui();
#else #else
@ -313,8 +313,11 @@ void setup()
master_mixer_r.gain(0, 1.0); master_mixer_r.gain(0, 1.0);
master_mixer_l.gain(0, 1.0); master_mixer_l.gain(0, 1.0);
#ifdef USE_REVERB
freeverbs1.roomsize(configuration.reverb_roomsize / 100.0); freeverbs1.roomsize(configuration.reverb_roomsize / 100.0);
freeverbs1.damping(configuration.reverb_damping / 100.0); freeverbs1.damping(configuration.reverb_damping / 100.0);
#endif
master_mixer_r.gain(1, 0.0); master_mixer_r.gain(1, 0.0);
master_mixer_l.gain(1, 0.0); master_mixer_l.gain(1, 0.0);

106
UI.hpp

@ -146,12 +146,10 @@ void UI_func_engine(uint8_t param);
void UI_func_information(uint8_t param); void UI_func_information(uint8_t param);
void UI_func_voice_selection(uint8_t param); void UI_func_voice_selection(uint8_t param);
void UI_func_volume(uint8_t param); void UI_func_volume(uint8_t param);
void UI_func_back(uint8_t param); void UI_function_not_enabled(void);
void UI_func_goToRootMenu(uint8_t param);
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign);
void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign); void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign);
// normal menu // normal menu
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change) LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control);
@ -206,20 +204,20 @@ uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0};
const uint8_t * flipped_scroll_bar[5]; const uint8_t * flipped_scroll_bar[5];
uint8_t * rotTile(const uint8_t * tile) { uint8_t * rotTile(const uint8_t * tile) {
uint8_t * newt = new uint8_t[8]; uint8_t * newt = new uint8_t[8];
for (int x = 0; x < 8; x++) { for (int x = 0; x < 8; x++) {
uint8_t newb = 0; uint8_t newb = 0;
for (int y = 0 ; y < 8; y++){ for (int y = 0 ; y < 8; y++) {
newb |= (tile[y] << x) & 0x80; newb |= (tile[y] << x) & 0x80;
newb >>= 1; newb >>= 1;
}
newt[x] = newb;
} }
return newt; newt[x] = newb;
}
return newt;
} }
#endif #endif
void setup_ui(void){ void setup_ui(void) {
// LCD Begin // LCD Begin
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.init(); lcd.init();
@ -245,13 +243,13 @@ void setup_ui(void){
lcd.createChar(2, (uint8_t*)scroll_bar[2]); lcd.createChar(2, (uint8_t*)scroll_bar[2]);
lcd.createChar(3, (uint8_t*)scroll_bar[3]); lcd.createChar(3, (uint8_t*)scroll_bar[3]);
lcd.createChar(4, (uint8_t*)scroll_bar[4]); lcd.createChar(4, (uint8_t*)scroll_bar[4]);
#else #else
for (int x=0; x < 5; x++) { for (int x = 0; x < 5; x++) {
flipped_scroll_bar[x] = rotTile(scroll_bar[x]); flipped_scroll_bar[x] = rotTile(scroll_bar[x]);
} }
#endif #endif
// LCDMenuLib Setup // LCDMenuLib Setup
LCDML_setup(_LCDML_DISP_cnt); LCDML_setup(_LCDML_DISP_cnt);
// Enable Menu Rollover // Enable Menu Rollover
//LCDML.MENU_enRollover(); //LCDML.MENU_enRollover();
@ -458,7 +456,7 @@ void encoder_right_up(void)
change_disp_sd(true); change_disp_sd(true);
#endif #endif
eeprom_write(); eeprom_write();
} }
UI_func_voice_selection(0); UI_func_voice_selection(0);
break; break;
@ -698,9 +696,9 @@ void lcdml_menu_display(void)
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), n); lcd.setCursor((_LCDML_DISP_cols - 1), n);
lcd.write((uint8_t)0); lcd.write((uint8_t)0);
#else #else
lcd.drawTile((_LCDML_DISP_cols - 1), n, 1, flipped_scroll_bar[0]); lcd.drawTile((_LCDML_DISP_cols - 1), n, 1, flipped_scroll_bar[0]);
lcd.setCursor((_LCDML_DISP_cols), n+1); lcd.setCursor((_LCDML_DISP_cols), n + 1);
#endif #endif
} }
else { else {
@ -719,27 +717,27 @@ void lcdml_menu_display(void)
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), 0); lcd.setCursor((_LCDML_DISP_cols - 1), 0);
lcd.write((uint8_t)1); lcd.write((uint8_t)1);
#else #else
lcd.drawTile((_LCDML_DISP_cols - 1), 0, 1, flipped_scroll_bar[1]); lcd.drawTile((_LCDML_DISP_cols - 1), 0, 1, flipped_scroll_bar[1]);
lcd.setCursor((_LCDML_DISP_cols), 1); lcd.setCursor((_LCDML_DISP_cols), 1);
#endif #endif
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) { } else if (scrollbar_cur_pos == (scrollbar_max - 1)) {
// max pos // max pos
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1)); lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1));
lcd.write((uint8_t)4); lcd.write((uint8_t)4);
#else #else
lcd.drawTile((_LCDML_DISP_cols - 1), (n_max - 1), 1, flipped_scroll_bar[4]); lcd.drawTile((_LCDML_DISP_cols - 1), (n_max - 1), 1, flipped_scroll_bar[4]);
lcd.setCursor((_LCDML_DISP_cols), (n_max)); lcd.setCursor((_LCDML_DISP_cols), (n_max));
#endif #endif
} else { } else {
// between // between
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max); lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max);
lcd.write((uint8_t)(scroll_pos % n_max) + 1); lcd.write((uint8_t)(scroll_pos % n_max) + 1);
#else #else
lcd.drawTile((_LCDML_DISP_cols - 1), scroll_pos / n_max, 1, flipped_scroll_bar[(scroll_pos % n_max) + 1]); lcd.drawTile((_LCDML_DISP_cols - 1), scroll_pos / n_max, 1, flipped_scroll_bar[(scroll_pos % n_max) + 1]);
lcd.setCursor((_LCDML_DISP_cols), (scroll_pos / n_max)+1); lcd.setCursor((_LCDML_DISP_cols), (scroll_pos / n_max) + 1);
#endif #endif
} }
} }
@ -777,6 +775,7 @@ void UI_func_sound(uint8_t param)
void UI_func_reverb_roomsize(uint8_t param) void UI_func_reverb_roomsize(uint8_t param)
{ {
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
// setup function // setup function
@ -816,10 +815,14 @@ void UI_func_reverb_roomsize(uint8_t param)
// you can here reset some global vars or do nothing // you can here reset some global vars or do nothing
eeprom_write(); eeprom_write();
} }
#else
UI_function_not_enabled();
#endif
} }
void UI_func_reverb_damping(uint8_t param) void UI_func_reverb_damping(uint8_t param)
{ {
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
// setup function // setup function
@ -859,10 +862,14 @@ void UI_func_reverb_damping(uint8_t param)
// you can here reset some global vars or do nothing // you can here reset some global vars or do nothing
eeprom_write(); eeprom_write();
} }
#else
UI_function_not_enabled();
#endif
} }
void UI_func_reverb_level(uint8_t param) void UI_func_reverb_level(uint8_t param)
{ {
#ifdef USE_REVERB
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
// setup function // setup function
@ -904,6 +911,9 @@ void UI_func_reverb_level(uint8_t param)
// you can here reset some global vars or do nothing // you can here reset some global vars or do nothing
eeprom_write(); eeprom_write();
} }
#else
UI_function_not_enabled();
#endif
} }
void UI_func_chorus_frequency(uint8_t param) void UI_func_chorus_frequency(uint8_t param)
@ -1677,7 +1687,7 @@ void UI_func_voice_selection(uint8_t param)
break; break;
} }
for (int x = 2; x < LCD_rows; x++) { for (int x = 2; x < LCD_rows; x++) {
lcd.show(x, 0, LCD_cols+1, " "); lcd.show(x, 0, LCD_cols + 1, " ");
} }
} }
@ -1706,12 +1716,37 @@ void UI_func_volume(uint8_t param)
lcd.show(1, 15, 1, "]"); lcd.show(1, 15, 1, "]");
} }
void UI_function_not_enabled(void)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
// setup function
lcd.setCursor(0, 0);
lcd.print(F("Function not"));
lcd.setCursor(0, 1);
lcd.print(F("enabled!"));
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if (LCDML.BT_checkEnter())
{
LCDML.FUNC_goBackToMenu();
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign) void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign)
{ {
int16_t tmp = 0; int16_t tmp = 0;
uint16_t p; uint16_t p;
bool non_zero_found=false; bool non_zero_found = false;
if (size < 1) if (size < 1)
return; return;
@ -1736,6 +1771,7 @@ void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool
{ {
p = int(pow(10, i)); p = int(pow(10, i));
tmp = int(var / p); tmp = int(var / p);
if (tmp == 0) if (tmp == 0)
{ {
if (zeros == true) if (zeros == true)
@ -1773,7 +1809,15 @@ void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bo
if (brackets == true) if (brackets == true)
lcd.print(F("[")); lcd.print(F("["));
lcd_display_int(int(number), size_number, zeros, false, sign); if (int(number) == 0)
{
if (zeros == true)
lcd.print(F("00"));
else
lcd.print(F(" 0"));
}
else
lcd_display_int(int(number), size_number, zeros, false, sign);
lcd.print(F(".")); lcd.print(F("."));
lcd_display_int(round(fraction * pow(10, size_fraction)), size_fraction, true, false, false); lcd_display_int(round(fraction * pow(10, size_fraction)), size_fraction, true, false, false);

@ -30,33 +30,29 @@
// ATTENTION! For better latency you have to redefine AUDIO_BLOCK_SAMPLES from // ATTENTION! For better latency you have to redefine AUDIO_BLOCK_SAMPLES from
// 128 to 64 in <ARDUINO-IDE-DIR>/cores/teensy3/AudioStream.h // 128 to 64 in <ARDUINO-IDE-DIR>/cores/teensy3/AudioStream.h
#define AUDIO_BLOCK_SAMPLES 64
// If you want to test the system with Linux and withous any keyboard and/or audio equipment, you can do the following: // If you want to test the system with Linux and withous any keyboard and/or audio equipment, you can do the following:
// 1. In Arduino-IDE enable "Tools->USB-Type->Serial + MIDI + Audio" // 1. In Arduino-IDE enable "Tools->USB-Type->Serial + MIDI + Audio"
// 2. Build the firmware with "MIDI_DEVICE_USB" enabled in config.h. // 2. Build the firmware with "MIDI_DEVICE_USB" enabled in config.h.
// 3. Afterconnecting to a Linux system there should be a MIDI an audio device available that is called "MicroMDAEPiano", so you can start the following: // 3. Afterconnecting to a Linux system there should be a MIDI an audio device available that is called "MicroMDexed", so you can start the following:
// $ aplaymidi -p 20:0 <MIDI-File> # e.g. test.mid // $ aplaymidi -p 20:0 <MIDI-File> # e.g. test.mid
// $ arecord -f cd -Dhw:1,0 /tmp/bla.wav // $ arecord -f cd -Dhw:1,0 /tmp/bla.wav
#define VERSION "0.9.8"
#define VERSION "0.9.7"
//************************************************************************************************* //*************************************************************************************************
//* DEVICE SETTINGS //* DEVICE SETTINGS
//************************************************************************************************* //*************************************************************************************************
// MIDI // MIDI
#define MIDI_DEVICE_DIN Serial1 //#define MIDI_DEVICE_DIN Serial1
//#define AUDIO_DEVICE_USB #define MIDI_DEVICE_USB 1
//#define MIDI_DEVICE_USB 1 #define MIDI_DEVICE_USB_HOST 1
//#define MIDI_DEVICE_USB_HOST 1
//#define MIDI_DEVICE_NUMBER 0
// AUDIO // AUDIO
// If nothing is defined Teensy internal DAC is used as audio output device! // If nothing is defined Teensy internal DAC is used as audio output device!
// Left and right channel audio signal is presented on pins A21 and A22. // Left and right channel audio signal is presented on pins A21 and A22.
//#define AUDIO_DEVICE_USB #define AUDIO_DEVICE_USB
//#define TEENSY_DAC //#define TEENSY_DAC
//#define TEENSY_DAC_SYMMETRIC //#define TEENSY_DAC_SYMMETRIC
//#define TEENSY_AUDIO_BOARD //#define TEENSY_AUDIO_BOARD
@ -83,13 +79,12 @@
#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE #define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE
#define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT #define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 3000 #define MOD_FILTER_CUTOFF_HZ 3000
#define USE_REVERB 1 //#define USE_REVERB 1
//************************************************************************************************* //*************************************************************************************************
//* AUDIO SETTINGS //* AUDIO SETTINGS
//************************************************************************************************* //*************************************************************************************************
// https://rechneronline.de/funktionsgraphen/ // https://rechneronline.de/funktionsgraphen/
#define VOLUME_CURVE 0.07
#ifndef TEENSY_AUDIO_BOARD #ifndef TEENSY_AUDIO_BOARD
#if AUDIO_BLOCK_SAMPLES == 64 #if AUDIO_BLOCK_SAMPLES == 64
#define AUDIO_MEM 450 #define AUDIO_MEM 450
@ -99,6 +94,7 @@
#define DELAY_MAX_TIME 600 #define DELAY_MAX_TIME 600
#define REDUCE_LOUDNESS 1 #define REDUCE_LOUDNESS 1
#else #else
#define SGTL5000_LINEOUT_LEVEL 29
#if AUDIO_BLOCK_SAMPLES == 64 #if AUDIO_BLOCK_SAMPLES == 64
#define AUDIO_MEM 900 #define AUDIO_MEM 900
#else #else
@ -117,7 +113,6 @@
#define STANDARD_LCD_I2C #define STANDARD_LCD_I2C
//#define OLED_SPI //#define OLED_SPI
// LCD Display // LCD Display
//I2C_DISPLAY only //I2C_DISPLAY only
#ifdef STANDARD_LCD_I2C #ifdef STANDARD_LCD_I2C
@ -166,20 +161,19 @@
#define TEENSY4 #define TEENSY4
#endif #endif
// Teensy Audio Shield: // Teensy Audio Shield (not used)
//#define SDCARD_CS_PIN 10 //#define SDCARD_CS_PIN 10
//#define SDCARD_MOSI_PIN 7 //#define SDCARD_MOSI_PIN 7
//#define SDCARD_SCK_PIN 14 //#define SDCARD_SCK_PIN 14
#define SGTL5000_LINEOUT_LEVEL 29
#ifndef TEENSY4 #ifndef TEENSY4
// Teensy 3.5 & 3.6 SD card // Teensy 3.5 & 3.6 SD card
#define SDCARD_CS_PIN BUILTIN_SDCARD #define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used #define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13 // not actually used #define SDCARD_SCK_PIN 13
#else #else
#define SDCARD_CS_PIN 10 #define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 11 // not actually used #define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13 // not actually used #define SDCARD_SCK_PIN 13
#endif #endif
// Encoder with button // Encoder with button
@ -200,8 +194,6 @@
#define BUT_DEBOUNCE_MS 20 #define BUT_DEBOUNCE_MS 20
#define LONG_BUTTON_PRESS 500 #define LONG_BUTTON_PRESS 500
// Internal timer // Internal timer
#define AUTOSTORE_MS 5000 #define AUTOSTORE_MS 5000
#define VOICE_SELECTION_MS 2000 #define VOICE_SELECTION_MS 2000

@ -37,7 +37,7 @@ class AudioEffectStereoMono : public AudioStream
AudioEffectStereoMono(void): AudioEffectStereoMono(void):
AudioStream(2, inputQueueArray) AudioStream(2, inputQueueArray)
{ {
_enabled = false; _enabled = true;
} }
virtual void update(void); virtual void update(void);

Loading…
Cancel
Save