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 3 years ago
parent bae8dbe1c9
commit 91a86c7fe8
  1. 3
      UI.hpp
  2. 4
      config.h
  3. 69
      dexed.cpp
  4. 13
      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(1, 0, 2, configuration.performance.voice[selected_instance_id] + 1);
string_toupper(bank_name);
lcd.show(0, 3, 8, bank_name);
string_toupper(voice_name);
lcd.show(1, 3, 10, voice_name);
//lcd.show(0, 3, 10, bank_name);
switch (menu_voice_select)
{

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

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

@ -50,7 +50,7 @@ bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id)
get_bank_name(b, bank_name, sizeof(bank_name));
sprintf(filename, "/%d/%s.syx", b, bank_name);
sysex = SD.open(filename);
if (!sysex)
{
@ -833,7 +833,7 @@ uint8_t calc_checksum(uint8_t* data, uint16_t len)
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* 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);
}
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 write_sd_data(File sysex, uint8_t format, 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_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);
void string_toupper(char* s);
#endif

Loading…
Cancel
Save