Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/gui/latency_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ enum {
ID_UseMidiStop,
ID_SendMidiStartOnTrigger,
ID_OutputClockCheck,
ID_SliderMousewheelCheck
ID_SliderMousewheelCheck,
ID_CopyLoopValuesOnCreateCheck
};

BEGIN_EVENT_TABLE(SooperLooperGui::LatencyPanel, wxPanel)
Expand All @@ -57,6 +58,7 @@ BEGIN_EVENT_TABLE(SooperLooperGui::LatencyPanel, wxPanel)
EVT_CHECKBOX (ID_SendMidiStartOnTrigger, SooperLooperGui::LatencyPanel::on_check)
EVT_CHECKBOX(ID_OutputClockCheck, SooperLooperGui::LatencyPanel::on_check)
EVT_CHECKBOX(ID_SliderMousewheelCheck, SooperLooperGui::LatencyPanel::on_check)
EVT_CHECKBOX(ID_CopyLoopValuesOnCreateCheck, SooperLooperGui::LatencyPanel::on_check)
EVT_TIMER(ID_UpdateTimer, SooperLooperGui::LatencyPanel::OnUpdateTimer)

EVT_SIZE (SooperLooperGui::LatencyPanel::onSize)
Expand Down Expand Up @@ -195,6 +197,8 @@ void LatencyPanel::init()
_slider_mousewheel_check = new wxCheckBox(this, ID_SliderMousewheelCheck, wxT("Allow mouse scroll wheel to change sliders"));
topsizer->Add(_slider_mousewheel_check, 0, wxALL, 3);

_copy_loop_values_on_create_check = new wxCheckBox(this, ID_CopyLoopValuesOnCreateCheck, wxT("Copy loop flags from last loop when creating a new one"));
topsizer->Add(_copy_loop_values_on_create_check, 0, wxALL, 3);

_update_timer = new wxTimer(this, ID_UpdateTimer);
_update_timer->Start(5000, true);
Expand Down Expand Up @@ -258,6 +262,7 @@ void LatencyPanel::refresh_state()
}

_slider_mousewheel_check->SetValue(_parent->get_sliders_allow_mousewheel() );
_copy_loop_values_on_create_check->SetValue(_parent->get_copy_loop_values() );


if (_auto_check->GetValue()) {
Expand Down Expand Up @@ -303,6 +308,9 @@ void LatencyPanel::on_check (wxCommandEvent &ev)
else if (ev.GetId() == ID_AutoDisableCheck) {
lcontrol.post_ctrl_change (-2, wxT("auto_disable_latency"), _auto_disable_check->GetValue() ? 1.0f : 0.0f);
}
else if (ev.GetId() == ID_CopyLoopValuesOnCreateCheck) {
_parent->set_copy_loop_values (_copy_loop_values_on_create_check->GetValue());
}



Expand Down
1 change: 1 addition & 0 deletions src/gui/latency_panel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class LatencyPanel
wxCheckBox * _output_clock_check;

wxCheckBox * _slider_mousewheel_check;
wxCheckBox * _copy_loop_values_on_create_check;


MainPanel * _parent;
Expand Down
37 changes: 34 additions & 3 deletions src/gui/main_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ END_EVENT_TABLE()
_add_num_channels = 1;
_add_discrete = true;
_add_secs_channel = 40.0f;
_copy_loop_values = false;
_copy_loop_values_counter = 0;

_default_position.x = 100;
_default_position.y = 100;
Expand Down Expand Up @@ -450,6 +452,23 @@ MainPanel::init_loopers (int count)
looperpan->set_index(_looper_panels.size());
_main_sizer->Add (looperpan, 0, wxEXPAND|wxALL, 0);
_looper_panels.push_back (looperpan);

// copy settings of last loop (but only if we created it and if there is more than one loop)
if (_copy_loop_values && _looper_panels.size() > 1 && _copy_loop_values_counter > 0) {
long curr_loop = _looper_panels.size() - 1;
float val;

const wchar_t *sync_settings[] = {wxT("sync"), wxT("playback_sync"), wxT("use_feedback_play"),
wxT("tempo_stretch"), wxT("discrete_prefader")};
for(int i=0; i<5; i++) {
_loop_control->get_value(curr_loop-1, sync_settings[i], val);
if(val > 0.0f || i == 4) // disable val check for prefader, as it's default is "on"
_loop_control->post_ctrl_change(curr_loop, sync_settings[i], 1.0f);

}
_copy_loop_values_counter--;
}

}
}
else if (count < (int)_looper_panels.size()) {
Expand Down Expand Up @@ -832,15 +851,21 @@ MainPanel::do_add_loop (const string & type)
{

LoopControl::SpawnConfig & sconf = _loop_control->get_spawn_config();
bool loop_created;
long num_loops = sconf.num_loops;

if (type == "mono") {
_loop_control->post_add_loop (1, sconf.mem_secs, sconf.discrete_io);
loop_created = _loop_control->post_add_loop (1, sconf.mem_secs, sconf.discrete_io);
}
else if (type == "stereo") {
_loop_control->post_add_loop (2, sconf.mem_secs, sconf.discrete_io);
loop_created = _loop_control->post_add_loop (2, sconf.mem_secs, sconf.discrete_io);
}
else {
_loop_control->post_add_loop();
loop_created = _loop_control->post_add_loop();
}

if (_copy_loop_values && loop_created && num_loops >= 1) {
_copy_loop_values_counter++;
}
}

Expand Down Expand Up @@ -1354,6 +1379,10 @@ bool MainPanel::load_rc()
set_sliders_allow_mousewheel( (bool) atoi (prop->value().c_str()));
}

if ((prop = rootNode->property ("copy_loop_values_on_create")) != 0) {
set_copy_loop_values( (bool) atoi (prop->value().c_str()));
}



XMLNode * bindingsNode = rootNode->find_named_node ("KeyBindings");
Expand Down Expand Up @@ -1403,6 +1432,8 @@ bool MainPanel::save_rc()
rootNode->add_property ("window_y_pos", buf);
snprintf(buf, sizeof(buf), "%d", (int)_sliders_allow_mousewheel);
rootNode->add_property ("sliders_allow_mousewheel", buf);
snprintf(buf, sizeof(buf), "%d", (int)_copy_loop_values);
rootNode->add_property ("copy_loop_values_on_create", buf);


configdoc.set_root (rootNode);
Expand Down
4 changes: 4 additions & 0 deletions src/gui/main_panel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class MainPanel

void set_force_local(bool flag) { _force_local = flag; }
bool get_force_local() const { return _force_local; }
void set_copy_loop_values(bool flag) { _copy_loop_values = flag; }
bool get_copy_loop_values() { return _copy_loop_values; }

void init_loopers (int count);

Expand Down Expand Up @@ -226,6 +228,8 @@ class MainPanel
wxString _last_used_path;

bool _sliders_allow_mousewheel;
bool _copy_loop_values;
int _copy_loop_values_counter;

private:
// any class wishing to process wxWindows events must use this macro
Expand Down