Skip to content

Commit

Permalink
Merge branch 'send-return-before-loop' of https://github.com/thomas-k…
Browse files Browse the repository at this point in the history
…ielbus/DLD into thomas-kielbus-send-return-before-loop
  • Loading branch information
danngreen committed May 22, 2017
2 parents 598b8da + 25b9155 commit 0c27166
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 11 deletions.
21 changes: 19 additions & 2 deletions flash_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ extern int16_t i_smoothed_cvadc[NUM_POT_ADCS];
#define FLASH_ADDR_QUANTIZE_MODE_CHANGES (FLASH_ADDR_RUNAWAYDC_BLOCK + SZ_RDCB) /* 89 .. */
#define SZ_QCM 1

#define FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_0 (FLASH_ADDR_QUANTIZE_MODE_CHANGES + SZ_QCM) /* 90 .. */
#define SZ_SRBL0 1

#define FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_1 (FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_0 + SZ_SRBL0) /* 91 .. */
#define SZ_SRBL1 1


#define FLASH_SYMBOL_bankfilled 0x01
#define FLASH_SYMBOL_startupoffset 0xAA
Expand Down Expand Up @@ -154,6 +160,9 @@ uint8_t flash_global_mode_LOG_DELAY_FEED;
uint8_t flash_global_mode_RUNAWAYDC_BLOCK;
uint8_t flash_global_mode_QUANTIZE_MODE_CHANGES;

uint8_t flash_mode_SEND_RETURN_BEFORE_LOOP_0;
uint8_t flash_mode_SEND_RETURN_BEFORE_LOOP_1;


void set_firmware_version(void)
{
Expand Down Expand Up @@ -263,6 +272,9 @@ uint32_t load_flash_params(void)
global_param[FAST_FADE_INCREMENT] = set_fade_increment(flash_global_param_FAST_FADE_SAMPLES);
global_param[SLOW_FADE_INCREMENT] = set_fade_increment(flash_global_param_SLOW_FADE_SAMPLES);

mode[0][SEND_RETURN_BEFORE_LOOP] = (flash_mode_SEND_RETURN_BEFORE_LOOP_0==1) ? 1:0;
mode[1][SEND_RETURN_BEFORE_LOOP] = (flash_mode_SEND_RETURN_BEFORE_LOOP_1==1) ? 1:0;

return (flash_firmware_version);

} else
Expand Down Expand Up @@ -360,6 +372,8 @@ void store_params_into_sram(void)
flash_mode_LEVELCV_IS_MIX_0 = mode[0][LEVELCV_IS_MIX];
flash_mode_LEVELCV_IS_MIX_1 = mode[1][LEVELCV_IS_MIX];

flash_mode_SEND_RETURN_BEFORE_LOOP_0 = mode[0][SEND_RETURN_BEFORE_LOOP];
flash_mode_SEND_RETURN_BEFORE_LOOP_1 = mode[1][SEND_RETURN_BEFORE_LOOP];
}


Expand Down Expand Up @@ -412,6 +426,8 @@ void write_all_params_to_FLASH(void)
flash_open_program_byte(flash_global_mode_RUNAWAYDC_BLOCK, FLASH_ADDR_RUNAWAYDC_BLOCK);
flash_open_program_byte(flash_global_mode_QUANTIZE_MODE_CHANGES, FLASH_ADDR_QUANTIZE_MODE_CHANGES);

flash_open_program_byte(flash_mode_SEND_RETURN_BEFORE_LOOP_0, FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_0);
flash_open_program_byte(flash_mode_SEND_RETURN_BEFORE_LOOP_1, FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_1);

flash_end_open_program();
}
Expand Down Expand Up @@ -478,6 +494,7 @@ void read_all_params_from_FLASH(void)
flash_global_mode_REV_GATETRIG = flash_read_byte(FLASH_ADDR_REV_GATETRIG) ? 1 : 0; //default trig
flash_global_mode_INF_GATETRIG = flash_read_byte(FLASH_ADDR_INF_GATETRIG) ? 1 : 0; //default trig

}

flash_mode_SEND_RETURN_BEFORE_LOOP_0 = (flash_read_byte(FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_0)==1) ? 1 : 0; //default OFF
flash_mode_SEND_RETURN_BEFORE_LOOP_1 = (flash_read_byte(FLASH_ADDR_SEND_RETURN_BEFORE_LOOP_1)==1) ? 1 : 0; //default OFF

}
22 changes: 16 additions & 6 deletions looping_delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ void process_audio_block_codec(int16_t *src, int16_t *dst, int16_t sz, uint8_t c
float regen;
float mainin_atten;
int32_t auxin;
int32_t auxout;

uint16_t i,t;
uint16_t topbyte, bottombyte;
Expand Down Expand Up @@ -828,8 +829,18 @@ void process_audio_block_codec(int16_t *src, int16_t *dst, int16_t sz, uint8_t c
// Attenuate the clean signal by the LEVEL parameter
mainin_atten = ((float)mainin) * param[channel][LEVEL];

// Add the loop contents to the input signal, as well as the auxin signal
wr = (int32_t)(regen + mainin_atten + (float)auxin);
if (mode[channel][SEND_RETURN_BEFORE_LOOP]) {
// Assign the auxin signal to the write head
wr = auxin;
// Add the loop contents to the input signal, and assign to the auxout signal
auxout = (int32_t)(regen + mainin_atten);
} else {
// Add the loop contents to the input signal, as well as the auxin signal, and assign to the write head
wr = (int32_t)(regen + mainin_atten + (float)auxin);
// Assign the non-attenuated loop contents to the auxout signal
auxout = rd;
}


//High-pass filter on wr
if (global_mode[RUNAWAYDC_BLOCK])
Expand Down Expand Up @@ -892,7 +903,7 @@ void process_audio_block_codec(int16_t *src, int16_t *dst, int16_t sz, uint8_t c
*dst++ = 0;

//Send out
*dst++ = rd + CODEC_DAC_CALIBRATION_DCOFFSET[2+channel];
*dst++ = auxout + CODEC_DAC_CALIBRATION_DCOFFSET[2+channel];
*dst++ = 0;
}
else
Expand All @@ -902,8 +913,8 @@ void process_audio_block_codec(int16_t *src, int16_t *dst, int16_t sz, uint8_t c
*dst++ = (int16_t)(mix & 0x0000FF00);

//Send out
*dst++ = (int16_t)(rd>>16) + (int16_t)CODEC_DAC_CALIBRATION_DCOFFSET[2+channel];
*dst++ = (int16_t)(rd & 0x0000FF00);
*dst++ = (int16_t)(auxout>>16) + (int16_t)CODEC_DAC_CALIBRATION_DCOFFSET[2+channel];
*dst++ = (int16_t)(auxout & 0x0000FF00);
}
#endif
#endif
Expand Down Expand Up @@ -969,4 +980,3 @@ void process_audio_block_codec(int16_t *src, int16_t *dst, int16_t sz, uint8_t c
increment_write_fade(channel);

}

1 change: 1 addition & 0 deletions params.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ enum ChannelModes{
LEVELCV_IS_MIX,
PING_LOCKED,
CONTINUOUS_REVERSE,
SEND_RETURN_BEFORE_LOOP,
NUM_CHAN_MODES
};

Expand Down
50 changes: 47 additions & 3 deletions system_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void set_default_system_settings(void)
mode[1][LOOP_CLOCK_GATETRIG] = TRIG_MODE;
mode[0][MAIN_CLOCK_GATETRIG] = TRIG_MODE;

mode[0][LEVELCV_IS_MIX] = 0;
mode[1][LEVELCV_IS_MIX] = 0;
mode[0][SEND_RETURN_BEFORE_LOOP] = 0;
mode[1][SEND_RETURN_BEFORE_LOOP] = 0;


global_mode[AUTO_UNQ] = 0;
Expand Down Expand Up @@ -422,8 +422,35 @@ void update_system_settings(void)
}
}

//
// Switches: Center | Up
// Set Send/Return Before Loop
//

if (switch1==SWITCH_CENTER && switch2==SWITCH_UP)
{
disable_mode_changes=1;

if (flag_rev_change[0])
{
if (mode[0][SEND_RETURN_BEFORE_LOOP])
mode[0][SEND_RETURN_BEFORE_LOOP] = 0;
else
mode[0][SEND_RETURN_BEFORE_LOOP] = 1;

flag_rev_change[0]=0;
}

if (flag_rev_change[1])
{
if (mode[1][SEND_RETURN_BEFORE_LOOP])
mode[1][SEND_RETURN_BEFORE_LOOP] = 0;
else
mode[1][SEND_RETURN_BEFORE_LOOP] = 1;

flag_rev_change[1]=0;
}
}
}

void update_system_settings_button_leds(void)
Expand Down Expand Up @@ -553,6 +580,24 @@ void update_system_settings_button_leds(void)
LED_REV2_OFF;

}
else if (global_mode[SYSTEM_SETTINGS] && switch1==SWITCH_CENTER && switch2==SWITCH_UP)
{
// Display Send/Return Before Loop settings

if (mode[0][SEND_RETURN_BEFORE_LOOP])
LED_REV1_ON;
else
LED_REV1_OFF;

if (mode[1][SEND_RETURN_BEFORE_LOOP])
LED_REV2_ON;
else
LED_REV2_OFF;

// INF LEDs are not used in this menu
LED_INF1_OFF;
LED_INF2_OFF;
}
else if (global_mode[SYSTEM_SETTINGS])
{
LED_REV1_OFF;
Expand Down Expand Up @@ -696,4 +741,3 @@ void update_system_settings_leds(void)
}

}

0 comments on commit 0c27166

Please sign in to comment.