Fix for audio memeory usage.

Fix for Mixed case strings in voice and bank names: no they are all uppercase.
pull/41/head
Holger Wirtz 4 years ago
parent bae8dbe1c9
commit 91a86c7fe8
  1. 3
      UI.hpp
  2. 4
      config.h
  3. 67
      dexed.cpp
  4. 11
      dexed_sd.cpp
  5. 4
      dexed_sd.h

@ -3970,9 +3970,10 @@ void UI_func_voice_select(uint8_t param)
lcd.show(0, 0, 2, configuration.performance.bank[selected_instance_id]); lcd.show(0, 0, 2, configuration.performance.bank[selected_instance_id]);
lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1); lcd.show(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
string_toupper(bank_name);
lcd.show(0, 3, 8, bank_name); lcd.show(0, 3, 8, bank_name);
string_toupper(voice_name);
lcd.show(1, 3, 10, voice_name); lcd.show(1, 3, 10, voice_name);
//lcd.show(0, 3, 10, bank_name);
switch (menu_voice_select) switch (menu_voice_select)
{ {

@ -129,9 +129,9 @@
//************************************************************************************************* //*************************************************************************************************
#define SAMPLE_RATE 44100 #define SAMPLE_RATE 44100
#if AUDIO_BLOCK_SAMPLES == 64 #if AUDIO_BLOCK_SAMPLES == 64
#define AUDIO_MEM 64 #define AUDIO_MEM 256
#else #else
#define AUDIO_MEM 32 #define AUDIO_MEM 128
#endif #endif
#ifdef TEENSY_AUDIO_BOARD #ifdef TEENSY_AUDIO_BOARD

@ -317,14 +317,16 @@ void Dexed::keyup(int16_t pitch) {
if ( voices[note].midi_note == pitch && voices[note].keydown ) { if ( voices[note].midi_note == pitch && voices[note].keydown ) {
voices[note].keydown = false; voices[note].keydown = false;
voices[note].key_pressed_timer = 0; voices[note].key_pressed_timer = 0;
#ifdef DEBUG /*
Serial.print(F("Stop voice: ")); #ifdef DEBUG
Serial.print(note, DEC); Serial.print(F("Stop voice: "));
Serial.print(F(" pitch: ")); Serial.print(note, DEC);
Serial.println(pitch, DEC); Serial.print(F(" pitch: "));
Serial.print(F(" id: ")); Serial.println(pitch, DEC);
Serial.println(id, DEC); Serial.print(F(" id: "));
#endif Serial.println(id, DEC);
#endif
*/
break; break;
} }
} }
@ -502,29 +504,29 @@ uint8_t Dexed::getNumNotesPlaying(void)
memset(&voiceStatus, 0, sizeof(VoiceStatus)); memset(&voiceStatus, 0, sizeof(VoiceStatus));
voices[i].dx7_note->peekVoiceStatus(voiceStatus); voices[i].dx7_note->peekVoiceStatus(voiceStatus);
/*
#ifdef DEBUG #ifdef DEBUG
Serial.println(i); Serial.println(i);
Serial.print("ALG: "); Serial.print("ALG: ");
Serial.println(data[134]+1); Serial.println(data[134]+1);
#endif #endif
*/
for (uint8_t op = 0; op < 6; op++) for (uint8_t op = 0; op < 6; op++)
{ {
if ((op_carrier & (1 << op))) if ((op_carrier & (1 << op)))
{ {
// this voice is a carrier! // this voice is a carrier!
op_carrier_num++; op_carrier_num++;
/*
#ifdef DEBUG #ifdef DEBUG
Serial.print("OP: "); Serial.print("OP: ");
Serial.print(op); Serial.print(op);
Serial.print(" AMP_STEP: "); Serial.print(" AMP_STEP: ");
Serial.print(voiceStatus.ampStep[op],DEC); Serial.print(voiceStatus.ampStep[op],DEC);
Serial.print(" AMP: "); Serial.print(" AMP: ");
Serial.println(voiceStatus.amp[op],DEC); Serial.println(voiceStatus.amp[op],DEC);
#endif #endif
*/
if (voiceStatus.amp[op] < VOICE_SILENCE_LEVEL && voiceStatus.ampStep[op] >= 3) if (voiceStatus.amp[op] < VOICE_SILENCE_LEVEL && voiceStatus.ampStep[op] >= 3)
{ {
// this voice produces no audio output // this voice produces no audio output
@ -542,13 +544,14 @@ uint8_t Dexed::getNumNotesPlaying(void)
Serial.println(op_amp, DEC); Serial.println(op_amp, DEC);
*/ */
#ifdef DEBUG /*
Serial.print("OP_AMP: "); #ifdef DEBUG
Serial.print(op_amp); Serial.print("OP_AMP: ");
Serial.print(" OP_CARRIER_NUM: "); Serial.print(op_amp);
Serial.println(op_carrier_num); Serial.print(" OP_CARRIER_NUM: ");
#endif Serial.println(op_carrier_num);
#endif
*/
if (op_amp == op_carrier_num) if (op_amp == op_carrier_num)
{ {
// all carrier-operators are silent -> disable the voice // all carrier-operators are silent -> disable the voice

@ -833,7 +833,7 @@ uint8_t calc_checksum(uint8_t* data, uint16_t len)
return (bulk_checksum_calc & 0x7f); return (bulk_checksum_calc & 0x7f);
} }
void strip_extension(char* s, char* target, uint8_t len) void strip_extension(const char* s, char* target, uint8_t len)
{ {
char tmp[FILENAME_LEN]; char tmp[FILENAME_LEN];
char* token; char* token;
@ -987,3 +987,12 @@ bool get_voice_by_bank_name(uint8_t b, const char* bank_name, uint8_t v, char* v
return (false); return (false);
} }
void string_toupper(char* s)
{
while (*s)
{
*s = toupper((unsigned char) * s);
s++;
}
}

@ -67,9 +67,11 @@ bool save_sd_performance(uint8_t p);
bool get_sd_data(File sysex, uint8_t format, uint8_t* conf); bool get_sd_data(File sysex, uint8_t format, uint8_t* conf);
bool write_sd_data(File sysex, uint8_t format, uint8_t* data, uint16_t len); bool write_sd_data(File sysex, uint8_t format, uint8_t* data, uint16_t len);
uint8_t calc_checksum(uint8_t* data, uint16_t len); uint8_t calc_checksum(uint8_t* data, uint16_t len);
void strip_extension(char* s, char* target); void strip_extension(const char* s, char* target);
bool get_bank_name(uint8_t b, char* name, uint8_t len); bool get_bank_name(uint8_t b, char* name, uint8_t len);
bool get_voice_name(uint8_t b, uint8_t v, char* name, uint8_t len); bool get_voice_name(uint8_t b, uint8_t v, char* name, uint8_t len);
bool get_voice_by_bank_name(uint8_t b, const char* bank_name, uint8_t v, char* voice_name, uint8_t len); bool get_voice_by_bank_name(uint8_t b, const char* bank_name, uint8_t v, char* voice_name, uint8_t len);
void string_toupper(char* s);
#endif #endif

Loading…
Cancel
Save