Skip to content

Commit

Permalink
Merge pull request #81 from mxmxmx/135_dev
Browse files Browse the repository at this point in the history
[OC] bump to v1.3.5
  • Loading branch information
mxmxmx authored Jan 25, 2019
2 parents 7c5c45f + b83f38d commit c2f38e5
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 164 deletions.
31 changes: 24 additions & 7 deletions software/o_c_REV/APP_A_SEQ.ino
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ enum SEQ_ChannelSetting {
//
SEQ_CHANNEL_SETTING_SCALE,
SEQ_CHANNEL_SETTING_OCTAVE,
SEQ_CHANNEL_SETTING_ROOT,
SEQ_CHANNEL_SETTING_OCTAVE_AUX,
SEQ_CHANNEL_SETTING_SCALE_MASK,
//
Expand All @@ -156,6 +157,7 @@ enum SEQ_ChannelSetting {
SEQ_CHANNEL_SETTING_TRANSPOSE_CV_SOURCE,
SEQ_CHANNEL_SETTING_PULSEWIDTH_CV_SOURCE,
SEQ_CHANNEL_SETTING_OCTAVE_CV_SOURCE,
SEQ_CHANNEL_SETTING_ROOT_CV_SOURCE,
SEQ_CHANNEL_SETTING_OCTAVE_AUX_CV_SOURCE,
SEQ_CHANNEL_SETTING_SEQ_CV_SOURCE,
SEQ_CHANNEL_SETTING_SCALE_MASK_CV_SOURCE,
Expand Down Expand Up @@ -300,7 +302,7 @@ public:
}

uint8_t get_root(uint8_t DUMMY) const {
return 0x0; // dummy
return values_[SEQ_CHANNEL_SETTING_ROOT];
}

uint8_t get_clock_source() const {
Expand Down Expand Up @@ -445,6 +447,10 @@ public:
return values_[SEQ_CHANNEL_SETTING_OCTAVE_CV_SOURCE];
}

uint8_t get_root_cv_source() const {
return values_[SEQ_CHANNEL_SETTING_ROOT_CV_SOURCE];
}

uint8_t get_octave_aux_cv_source() const {
return values_[SEQ_CHANNEL_SETTING_OCTAVE_AUX_CV_SOURCE];
}
Expand Down Expand Up @@ -692,6 +698,7 @@ public:
apply_value(SEQ_CHANNEL_SETTING_PULSEWIDTH_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_MULT_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_OCTAVE_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_ROOT_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_OCTAVE_AUX_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_SEQ_CV_SOURCE, 0);
apply_value(SEQ_CHANNEL_SETTING_SCALE_MASK_CV_SOURCE, 0);
Expand Down Expand Up @@ -1062,6 +1069,12 @@ public:
CONSTRAIN(_transpose, -12, 12);
}

int8_t _root = get_root(0x0);
if (get_root_cv_source()) {
_root += (OC::ADC::value(static_cast<ADC_CHANNEL>(get_root_cv_source() - 1)) + 127) >> 8;
CONSTRAIN(_root, 0, 11);
}

if (_playmode != PM_ARP) {
// use the current sequence, updated in process_num_seq_channel():
step_pitch_ = get_pitch_at_step(display_num_sequence_, clk_cnt_) + (_octave * 12 << 7);
Expand All @@ -1088,7 +1101,7 @@ public:
gate_state_ = step_state_ = OFF;
}
// update output:
step_pitch_ = quantizer_.Process(step_pitch_, 0, _transpose);
step_pitch_ = quantizer_.Process(step_pitch_, _root << 7, _transpose);

int32_t _attack = get_attack_duration();
int32_t _decay = get_decay_duration();
Expand Down Expand Up @@ -1144,7 +1157,7 @@ public:
else
// this *might* not be quite a copy...
step_pitch_aux_ = step_pitch_ + (_octave_aux * 12 << 7);
step_pitch_aux_ = quantizer_.Process(step_pitch_aux_, 0, _transpose);
step_pitch_aux_ = quantizer_.Process(step_pitch_aux_, _root << 7, _transpose);
}
break;
case ENV_AD:
Expand Down Expand Up @@ -1665,7 +1678,8 @@ public:
else
*settings++ = SEQ_CHANNEL_SETTING_SEQUENCE_PLAYMODE_CV_RANGES;

*settings++ = SEQ_CHANNEL_SETTING_OCTAVE;
*settings++ = SEQ_CHANNEL_SETTING_OCTAVE;
*settings++ = SEQ_CHANNEL_SETTING_ROOT;
// aux output:
*settings++ = SEQ_CHANNEL_SETTING_MODE;

Expand Down Expand Up @@ -1759,7 +1773,8 @@ public:
else
*settings++ = SEQ_CHANNEL_SETTING_DUMMY; // = range

*settings++ = SEQ_CHANNEL_SETTING_OCTAVE_CV_SOURCE;
*settings++ = SEQ_CHANNEL_SETTING_OCTAVE_CV_SOURCE;
*settings++ = SEQ_CHANNEL_SETTING_ROOT_CV_SOURCE;
*settings++ = SEQ_CHANNEL_SETTING_DUMMY; // = mode

switch (get_aux_mode()) {
Expand Down Expand Up @@ -1957,6 +1972,7 @@ SETTINGS_DECLARE(SEQ_Channel, SEQ_CHANNEL_SETTING_LAST) {
//
{ OC::Scales::SCALE_SEMI, 0, OC::Scales::NUM_SCALES - 1, "scale", OC::scale_names_short, settings::STORAGE_TYPE_U8 },
{ 0, -5, 5, "octave", NULL, settings::STORAGE_TYPE_I8 }, // octave
{ 0, 0, 11, "root", OC::Strings::note_names_unpadded, settings::STORAGE_TYPE_U8 },
{ 0, -5, 5, "--> aux +/-", NULL, settings::STORAGE_TYPE_I8 }, // aux octave
{ 65535, 1, 65535, "--> edit", NULL, settings::STORAGE_TYPE_U16 }, // mask
// seq
Expand All @@ -1979,8 +1995,9 @@ SETTINGS_DECLARE(SEQ_Channel, SEQ_CHANNEL_SETTING_LAST) {
{ 0, 0, 4, "mult/div CV ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "transpose ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "--> pw ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "octave -/+ ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "--> aux -/+ ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "octave +/- ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "root +/- ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "--> aux +/- ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "sequence # ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "mask rotate ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
{ 0, 0, 4, "direction ->", OC::Strings::cv_input_names_none, settings::STORAGE_TYPE_U4 },
Expand Down
37 changes: 20 additions & 17 deletions software/o_c_REV/APP_DQ.ino
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,12 @@ public:
// manual change?
scale_reset_ = false;
active_scale_slot_ = get_scale_select();
prev_scale_slot_ = active_scale_slot_;
prev_scale_slot_ = display_scale_slot_ = active_scale_slot_;
}
}
else if (prev_scale_slot_ != get_scale_select()) {
active_scale_slot_ = get_scale_select();
prev_scale_slot_ = active_scale_slot_;
prev_scale_slot_ = display_scale_slot_ = active_scale_slot_;
}

if (scale_advance_) {
Expand All @@ -465,9 +465,6 @@ public:
}

bool update = continuous || triggered;

if (update)
update_scale(force_update_, active_scale_slot_, schedule_mask_rotate_);

int32_t sample = last_sample_;
int32_t temp_sample = 0;
Expand Down Expand Up @@ -507,14 +504,12 @@ public:
// if scale changes, we have to update the root and transpose values, too; mask gets updated in update_scale
root = get_root(display_scale_slot_);
transpose = get_transpose(display_scale_slot_);
schedule_scale_update_ = true;
break;
case DQ_DEST_ROOT:
root += (OC::ADC::value(static_cast<ADC_CHANNEL>(channel_id)) + 127) >> 8;
break;
case DQ_DEST_MASK:
update_scale(true, active_scale_slot_, (OC::ADC::value(static_cast<ADC_CHANNEL>(channel_id)) + 127) >> 8);
schedule_scale_update_ = false;
schedule_mask_rotate_ = (OC::ADC::value(static_cast<ADC_CHANNEL>(channel_id)) + 127) >> 8;
break;
case DQ_DEST_OCTAVE:
octave += (OC::ADC::value(static_cast<ADC_CHANNEL>(channel_id)) + 255) >> 9;
Expand All @@ -533,6 +528,9 @@ public:
CONSTRAIN(root, 0, 11);
CONSTRAIN(transpose, -12, 12);

// update scale?
update_scale(force_update_, display_scale_slot_, schedule_mask_rotate_);

// internal CV source?
if (source > DQ_CHANNEL_SOURCE_CV4)
cv_source = channel_id - 1;
Expand Down Expand Up @@ -598,11 +596,6 @@ public:

// special treatment, continuous update -- only update the modulation values if/when the quantized input changes:
bool _continuous_update = continuous && last_sample_ != sample;

if ((!continuous && schedule_scale_update_) || (_continuous_update && schedule_scale_update_)) {
update_scale(true, display_scale_slot_, schedule_mask_rotate_);
schedule_scale_update_ = false;
}

if (_continuous_update) {

Expand Down Expand Up @@ -656,13 +649,19 @@ public:
break;
case DQ_DEST_MASK:
schedule_mask_rotate_ = (OC::ADC::value(static_cast<ADC_CHANNEL>(channel_id)) + 127) >> 8;
update_scale(force_update_, active_scale_slot_, schedule_mask_rotate_);
schedule_scale_update_ = true;
break;
default:
break;
}
// end switch

// update scale?
if (schedule_scale_update_ && _continuous_update) {
update_scale(false, display_scale_slot_, schedule_mask_rotate_);
schedule_scale_update_ = false;
}

// offset when TR source = continuous ?
int8_t _trigger_offset = 0;
bool _trigger_update = false;
Expand Down Expand Up @@ -1167,8 +1166,10 @@ size_t DQ_restore(const void *storage) {
size_t used = 0;
for (size_t i = 0; i < NUMCHANNELS; ++i) {
used += dq_quantizer_channels[i].Restore(static_cast<const char*>(storage) + used);
int scale = dq_quantizer_channels[i].get_scale_select();
dq_quantizer_channels[i].update_scale_mask(dq_quantizer_channels[i].get_mask(scale), scale);
//int scale = dq_quantizer_channels[i].get_scale_select();
for (size_t j = SLOT1; j < LAST_SLOT; j++) {
dq_quantizer_channels[i].update_scale_mask(dq_quantizer_channels[i].get_mask(j), j);
}
dq_quantizer_channels[i].update_enabled_settings();
}
dq_state.cursor.AdjustEnd(dq_quantizer_channels[0].num_enabled_settings() - 1);
Expand Down Expand Up @@ -1348,6 +1349,7 @@ void DQ_handleEncoderEvent(const UI::Event &event) {
DQ_QuantizerChannel &selected = dq_quantizer_channels[dq_state.selected_channel];

if (dq_state.editing()) {

DQ_ChannelSetting setting = selected.enabled_setting_at(dq_state.cursor_pos());
if (DQ_CHANNEL_SETTING_MASK1 != setting || DQ_CHANNEL_SETTING_MASK2 != setting || DQ_CHANNEL_SETTING_MASK3 != setting || DQ_CHANNEL_SETTING_MASK4 != setting) {

Expand Down Expand Up @@ -1386,10 +1388,11 @@ void DQ_handleEncoderEvent(const UI::Event &event) {
selected.update_enabled_settings();
dq_state.cursor.AdjustEnd(selected.num_enabled_settings() - 1);
break;
case DQ_CHANNEL_SETTING_SCALE_SEQ:
case DQ_CHANNEL_SETTING_SCALE_SEQ:
selected.update_enabled_settings();
dq_state.cursor.AdjustEnd(selected.num_enabled_settings() - 1);
selected.reset_scale();
break;
default:
break;
}
Expand Down
63 changes: 43 additions & 20 deletions software/o_c_REV/APP_H1200.ino
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public:
void Init() {
InitDefaults();
update_enabled_settings();
manual_mode_change_ = false;
}

H1200Setting enabled_setting_at(int index) const {
Expand All @@ -315,6 +316,14 @@ public:
return num_enabled_settings_;
}

void mode_change(bool yn) {
manual_mode_change_ = yn;
}

bool mode_manual_change() const {
return manual_mode_change_;
}

void update_enabled_settings() {

H1200Setting *settings = enabled_settings_;
Expand Down Expand Up @@ -369,6 +378,7 @@ public:

private:
int num_enabled_settings_;
bool manual_mode_change_;
H1200Setting enabled_settings_[H1200_SETTING_LAST];
};

Expand Down Expand Up @@ -499,24 +509,24 @@ public:
euclidean_counter_ = 0;
root_sample_ = false;
root_ = 0;
p_euclidean_length_ = 8 ;
p_euclidean_fill_ = 0 ;
p_euclidean_offset_ = 0 ;
l_euclidean_length_ = 8 ;
l_euclidean_fill_ = 0 ;
l_euclidean_offset_ = 0 ;
r_euclidean_length_ = 8 ;
r_euclidean_fill_ = 0 ;
r_euclidean_offset_ = 0 ;
n_euclidean_length_ = 8 ;
n_euclidean_fill_ = 0 ;
n_euclidean_offset_ = 0 ;
s_euclidean_length_ = 8 ;
s_euclidean_fill_ = 0 ;
s_euclidean_offset_ = 0 ;
h_euclidean_length_ = 8 ;
h_euclidean_fill_ = 0 ;
h_euclidean_offset_ = 0 ;
p_euclidean_length_ = 8;
p_euclidean_fill_ = 0;
p_euclidean_offset_ = 0;
l_euclidean_length_ = 8;
l_euclidean_fill_ = 0;
l_euclidean_offset_ = 0;
r_euclidean_length_ = 8;
r_euclidean_fill_ = 0;
r_euclidean_offset_ = 0;
n_euclidean_length_ = 8;
n_euclidean_fill_ = 0;
n_euclidean_offset_ = 0;
s_euclidean_length_ = 8;
s_euclidean_fill_ = 0;
s_euclidean_offset_ = 0;
h_euclidean_length_ = 8;
h_euclidean_fill_ = 0;
h_euclidean_offset_ = 0;

}

Expand Down Expand Up @@ -674,6 +684,16 @@ void FASTRUN H1200_clock(uint32_t triggers) {
// Reset has priority
if (triggers & TRIGGER_MASK_TR1) {
h1200_state.tonnetz_state.reset(h1200_settings.mode());
h1200_settings.mode_change(false);
}

// Reset on next trigger = manual change min/maj
if (h1200_settings.mode_manual_change()) {

if ((triggers & OC::DIGITAL_INPUT_2_MASK) || (triggers & OC::DIGITAL_INPUT_3_MASK) || (triggers & OC::DIGITAL_INPUT_4_MASK)) {
h1200_settings.mode_change(false);
h1200_state.tonnetz_state.reset(h1200_settings.mode());
}
}

int32_t root_ = h1200_settings.root_offset();
Expand Down Expand Up @@ -1092,6 +1112,9 @@ void H1200_handleEncoderEvent(const UI::Event &event) {
if (h1200_settings.get_trigger_type() != H1200_TRIGGER_TYPE_EUCLIDEAN)
h1200_state.cursor.Scroll(h1200_state.cursor_pos());
break;
case H1200_SETTING_MODE:
h1200_settings.mode_change(true);
break;
default:
break;
}
Expand All @@ -1105,7 +1128,8 @@ void H1200_handleEncoderEvent(const UI::Event &event) {

void H1200_menu() {

const EMode current_mode = h1200_state.tonnetz_state.current_chord().mode();
/* show mode change instantly, because it's somewhat confusing (inconsistent?) otherwise */
const EMode current_mode = h1200_settings.mode(); // const EMode current_mode = h1200_state.tonnetz_state.current_chord().mode();
int outputs[4];
h1200_state.tonnetz_state.get_outputs(outputs);

Expand Down Expand Up @@ -1186,4 +1210,3 @@ void H1200_debug() {
graphics.printf("I: %4d %4d", cv, scaled);
}
#endif // H1200_DEBUG

Loading

0 comments on commit c2f38e5

Please sign in to comment.