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. 3
      MicroDexed.ino
  2. 50
      UI.hpp
  3. 34
      config.h
  4. 2
      effect_stereo_mono.h

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

@ -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);
@ -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)
@ -1706,6 +1716,31 @@ 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;
@ -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,6 +1809,14 @@ 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("["));
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_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