Fixed very bad and idiot bug for PT8211 usage.

pull/4/head
Holger Wirtz 6 years ago
parent 9cc7d58a63
commit e02a26c40a
  1. 71
      MicroDexed.ino
  2. 6
      config.h
  3. 96
      ~/.arduino15/preferences-teensy.txt

@ -228,10 +228,10 @@ void setup()
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.clear(); lcd.clear();
lcd.show(0, 0, 2, bank+1); lcd.show(0, 0, 2, bank + 1);
lcd.show(0, 2, 1, " "); lcd.show(0, 2, 1, " ");
lcd.show(0, 3, 10, bank_name); lcd.show(0, 3, 10, bank_name);
lcd.show(1, 0, 2, voice+1); lcd.show(1, 0, 2, voice + 1);
lcd.show(1, 2, 1, " "); lcd.show(1, 2, 1, " ");
lcd.show(1, 3, 10, voice_name); lcd.show(1, 3, 10, voice_name);
#endif #endif
@ -256,8 +256,6 @@ void loop()
int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t
const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES);
while (42 == 42) // DON'T PANIC!
{
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC)
if (cpu_mem_millis > SHOW_CPU_LOAD_MSEC) if (cpu_mem_millis > SHOW_CPU_LOAD_MSEC)
{ {
@ -268,32 +266,27 @@ void loop()
handle_input(); handle_input();
audio_buffer = queue1.getBuffer(); if (queue1.available())
if (audio_buffer == NULL)
{
Serial.println(F("E: audio_buffer allocation problems!"));
}
if (!queue1.available())
continue;
elapsedMicros t1;
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer);
if (t1 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun!
xrun++;
if (t1 > render_time_max)
render_time_max = t1;
if (peak1.available())
{ {
if (peak1.read() > 0.99) audio_buffer = queue1.getBuffer();
peak++;
} elapsedMicros t1;
dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer);
if (t1 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun!
xrun++;
if (t1 > render_time_max)
render_time_max = t1;
if (peak1.available())
{
if (peak1.read() > 0.99)
peak++;
}
#ifndef TEENSY_AUDIO_BOARD #ifndef TEENSY_AUDIO_BOARD
for (uint8_t i = 0; i <= AUDIO_BLOCK_SAMPLES; i++) for (uint8_t i = 0; i < AUDIO_BLOCK_SAMPLES; i++)
audio_buffer[i] *= vol; audio_buffer[i] *= vol;
#endif #endif
queue1.playBuffer(); queue1.playBuffer();
} }
} }
void handle_input(void) void handle_input(void)
@ -383,7 +376,7 @@ bool handle_master_key(uint8_t data)
EEPROM.update(EEPROM_OFFSET + EEPROM_VOICE_ADDR, num); EEPROM.update(EEPROM_OFFSET + EEPROM_VOICE_ADDR, num);
update_eeprom_checksum(); update_eeprom_checksum();
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
lcd.show(1, 0, 2, voice+1); lcd.show(1, 0, 2, voice + 1);
lcd.show(1, 2, 1, " "); lcd.show(1, 2, 1, " ");
lcd.show(1, 3, 10, voice_name); lcd.show(1, 3, 10, voice_name);
#endif #endif
@ -416,17 +409,17 @@ bool handle_master_key(uint8_t data)
Serial.println(bank, DEC); Serial.println(bank, DEC);
#endif #endif
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
if(get_bank_name(bank)) if (get_bank_name(bank))
{ {
lcd.show(0, 0, 2, bank+1); lcd.show(0, 0, 2, bank + 1);
lcd.show(0, 2, 1, " "); lcd.show(0, 2, 1, " ");
lcd.show(0, 3, 10, bank_name); lcd.show(0, 3, 10, bank_name);
} }
else else
{ {
lcd.show(0, 0, 2, bank+1); lcd.show(0, 0, 2, bank + 1);
lcd.show(0, 2, 10, " *ERROR*"); lcd.show(0, 2, 10, " *ERROR*");
} }
#endif #endif
return (true); return (true);
} }

@ -31,14 +31,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 I2C_DISPLAY 1 #define I2C_DISPLAY 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 DEFAULT_SYSEXBANK 0
#define DEFAULT_SYSEXSOUND 0 #define DEFAULT_SYSEXSOUND 0
//#define DEXED_ENGINE DEXED_ENGINE_MODERN //#define DEXED_ENGINE DEXED_ENGINE_MODERN
#ifndef TEENSY_AUDIO_BOARD
#define AUDIO_MEM 4
#else
#define AUDIO_MEM 2 #define AUDIO_MEM 2
#endif
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#define MAX_BANKS 99 #define MAX_BANKS 99

@ -1,96 +0,0 @@
board=teensy36
boardsmanager.additional.urls=
browser=mozilla
build.verbose=false
build.warn_data_percentage=75
compiler.cache_core=true
compiler.warning_level=none
console=true
console.auto_clear=true
console.error.file=stderr.txt
console.length=500
console.lines=4
console.output.file=stdout.txt
custom_keys=teensy36_en-us
custom_opt=teensy36_o2std
custom_speed=teensy36_180
custom_usb=teensy36_serial
editor.antialias=true
editor.auto_close_braces=true
editor.caret.blink=true
editor.code_folding=false
editor.divider.size=0
editor.external=false
editor.font=Monospaced,plain,12
editor.indent=true
editor.invalid=false
editor.keys.alternative_cut_copy_paste=true
editor.keys.home_and_end_beginning_end_of_doc=false
editor.keys.shift_backspace_is_delete=true
editor.languages.current=
editor.linenumbers=false
editor.save_on_verify=true
editor.tabs.expand=true
editor.tabs.size=2
editor.update_extension=true
editor.window.height.default=600
editor.window.height.min=290
editor.window.width.default=500
editor.window.width.min=400
export.applet.separate_jar_files=false
export.application.fullscreen=false
export.application.platform=true
export.application.stop=true
export.delete_target_folder=true
gui.scale=auto
last.ide.1.8.7.daterun=1537512866
last.ide.1.8.7.hardwarepath=/home/local/arduino-1.8.7-teensy/hardware
last.sketch.count=1
last.sketch.default.location=710,240,500,600,-1,0
last.sketch.default.path=/tmp/untitled2066889805.tmp/sketch_sep21a/sketch_sep21a.ino
last.sketch0.location=1327,470,500,600,-1,0
last.sketch0.path=/home/wirtz/Arduino-Teensy/MicroDexed/MicroDexed.ino
launcher=xdg-open
platform.auto_file_type_associations=true
preferences.readonly=false
preproc.color_datatype=true
preproc.enhanced_casting=true
preproc.imports.list=java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*
preproc.output_parse_tree=false
preproc.save_build_files=false
preproc.substitute_floats=true
preproc.substitute_unicode=true
preproc.web_colors=true
programmer=arduino:avrispmkii
proxy.manual.hostname=
proxy.manual.password=
proxy.manual.port=
proxy.manual.type=HTTP
proxy.manual.username=
proxy.pac.url=
proxy.type=auto
recent.sketches=/home/wirtz/Arduino-Teensy/MicroDexed/MicroDexed.ino,
run.display=1
run.options=
run.options.memory=false
run.options.memory.initial=64
run.options.memory.maximum=256
run.present.bgcolor=#666666
run.present.exclusive=false
run.present.stop.color=#cccccc
serial.databits=8
serial.debug_rate=9600
serial.line_ending=1
serial.parity=N
serial.port=
serial.stopbits=1
sketchbook.path=/home/wirtz/Arduino-Teensy
software=ARDUINO
target_package=teensy
target_platform=avr
theme.file=
update.check=true
update.id=2765771547162134236
upload.using=bootloader
upload.verbose=false
upload.verify=true
Loading…
Cancel
Save