Console1: add shift operations for plugins
This commit is contained in:
parent
e22a0eb1db
commit
827f61ad58
@ -44,11 +44,13 @@ class ControllerButton : public Controller
|
||||
ControllerID id,
|
||||
boost::function<void (uint32_t)> action,
|
||||
boost::function<void (uint32_t)> shift_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_action = 0)
|
||||
boost::function<void (uint32_t)> plugin_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_shift_action = 0 )
|
||||
: Controller (console1, id)
|
||||
, action (action)
|
||||
, shift_action (shift_action)
|
||||
, plugin_action (plugin_action)
|
||||
, plugin_shift_action (plugin_shift_action)
|
||||
{
|
||||
console1->buttons.insert (std::make_pair (id, this));
|
||||
}
|
||||
@ -56,6 +58,7 @@ class ControllerButton : public Controller
|
||||
ControllerType get_type () { return CONTROLLER_BUTTON; }
|
||||
|
||||
void set_plugin_action (boost::function<void (uint32_t)> action) { plugin_action = action; }
|
||||
void set_plugin_shift_action (boost::function<void (uint32_t)> action) { plugin_shift_action = action; }
|
||||
|
||||
virtual void set_led_state (bool onoff)
|
||||
{
|
||||
@ -81,6 +84,7 @@ class ControllerButton : public Controller
|
||||
boost::function<void (uint32_t)> action;
|
||||
boost::function<void (uint32_t)> shift_action;
|
||||
boost::function<void (uint32_t)> plugin_action;
|
||||
boost::function<void (uint32_t)> plugin_shift_action;
|
||||
};
|
||||
|
||||
class MultiStateButton : public Controller
|
||||
@ -90,10 +94,15 @@ class MultiStateButton : public Controller
|
||||
ControllerID id,
|
||||
std::vector<uint32_t> state_values,
|
||||
boost::function<void (uint32_t)> action,
|
||||
boost::function<void (uint32_t)> shift_action = 0)
|
||||
boost::function<void (uint32_t)> shift_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_shift_action = 0
|
||||
)
|
||||
: Controller (console1, id)
|
||||
, action (action)
|
||||
, shift_action (shift_action)
|
||||
, plugin_action (action)
|
||||
, plugin_shift_action (shift_action)
|
||||
, state_values (state_values)
|
||||
{
|
||||
console1->multi_buttons.insert (std::make_pair (id, this));
|
||||
@ -113,10 +122,15 @@ class MultiStateButton : public Controller
|
||||
console1->write (buf, 3);
|
||||
}
|
||||
|
||||
void set_plugin_action (boost::function<void (uint32_t)> action) { plugin_action = action; }
|
||||
void set_plugin_shift_action (boost::function<void (uint32_t)> action) { plugin_shift_action = action; }
|
||||
|
||||
uint32_t state_count () { return state_values.size (); }
|
||||
|
||||
boost::function<void (uint32_t)> action;
|
||||
boost::function<void (uint32_t)> shift_action;
|
||||
boost::function<void (uint32_t)> plugin_action;
|
||||
boost::function<void (uint32_t)> plugin_shift_action;
|
||||
|
||||
private:
|
||||
std::vector<uint32_t> state_values;
|
||||
@ -158,11 +172,13 @@ class Encoder : public Controller
|
||||
ControllerID id,
|
||||
boost::function<void (uint32_t)> action,
|
||||
boost::function<void (uint32_t)> shift_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_action = 0)
|
||||
boost::function<void (uint32_t)> plugin_action = 0,
|
||||
boost::function<void (uint32_t)> plugin_shift_action = 0)
|
||||
: Controller (console1, id)
|
||||
, action (action)
|
||||
, shift_action (shift_action)
|
||||
, plugin_action (plugin_action)
|
||||
, plugin_shift_action (plugin_action)
|
||||
{
|
||||
console1->encoders.insert (std::make_pair (id, this));
|
||||
}
|
||||
@ -170,6 +186,7 @@ class Encoder : public Controller
|
||||
ControllerType get_type () { return ENCODER; }
|
||||
|
||||
void set_plugin_action (boost::function<void (uint32_t)> action) { plugin_action = action; }
|
||||
void set_plugin_shift_action (boost::function<void (uint32_t)> action) { plugin_shift_action = action; }
|
||||
|
||||
virtual void set_value (uint32_t value)
|
||||
{
|
||||
@ -183,6 +200,7 @@ class Encoder : public Controller
|
||||
boost::function<void (uint32_t)> action;
|
||||
boost::function<void (uint32_t val)> shift_action;
|
||||
boost::function<void (uint32_t val)> plugin_action;
|
||||
boost::function<void (uint32_t val)> plugin_shift_action;
|
||||
|
||||
PBD::Signal1<void, uint32_t>* plugin_signal;
|
||||
};
|
||||
|
@ -117,8 +117,6 @@ Console1::load_mapping (XMLNode* mapping_xml)
|
||||
|
||||
(*i)->get_property ("type", param_type);
|
||||
|
||||
|
||||
|
||||
const XMLNodeList& plist = (*i)->children ();
|
||||
|
||||
XMLNodeConstIterator j;
|
||||
@ -245,15 +243,22 @@ Console1::remove_plugin_operations ()
|
||||
|
||||
for (auto& e : encoders) {
|
||||
e.second->set_plugin_action (0);
|
||||
e.second->set_plugin_shift_action (0);
|
||||
e.second->set_value (0);
|
||||
}
|
||||
for (auto& c : buttons) {
|
||||
if (c.first == ControllerID::TRACK_GROUP)
|
||||
for (auto& b : buttons) {
|
||||
if (b.first == ControllerID::TRACK_GROUP)
|
||||
continue;
|
||||
if (c.first >= ControllerID::FOCUS1 && c.first <= ControllerID::FOCUS20)
|
||||
if (b.first >= ControllerID::FOCUS1 && b.first <= ControllerID::FOCUS20)
|
||||
continue;
|
||||
c.second->set_plugin_action (0);
|
||||
c.second->set_led_state (false);
|
||||
b.second->set_plugin_action (0);
|
||||
b.second->set_plugin_shift_action (0);
|
||||
b.second->set_led_state (false);
|
||||
}
|
||||
for (auto& m : multi_buttons) {
|
||||
m.second->set_plugin_action (0);
|
||||
m.second->set_plugin_shift_action (0);
|
||||
m.second->set_led_state (false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,8 +343,10 @@ Console1::spill_plugins (const int32_t plugin_index)
|
||||
PluginMappingMap::iterator pmmit = pluginMappingMap.find (plugin->unique_id ());
|
||||
mapping_found = (pmmit != pluginMappingMap.end ());
|
||||
|
||||
if (!mapping_found && create_mapping_stubs ) {
|
||||
create_mapping (proc, plugin);
|
||||
if (!mapping_found) {
|
||||
if (create_mapping_stubs) {
|
||||
create_mapping (proc, plugin);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -376,7 +383,7 @@ Console1::spill_plugins (const int32_t plugin_index)
|
||||
bool swtch = false;
|
||||
if (parameterDescriptor.integer_step && parameterDescriptor.upper == 1) {
|
||||
swtch = true;
|
||||
} else if (ppm.is_switch ){
|
||||
} else if (ppm.is_switch) {
|
||||
swtch = true;
|
||||
}
|
||||
if (!swtch) {
|
||||
@ -386,15 +393,17 @@ Console1::spill_plugins (const int32_t plugin_index)
|
||||
[=] (bool b, PBD::Controllable::GroupControlDisposition d) -> void {
|
||||
double v = parameterDescriptor.to_interface (c->get_value (), true);
|
||||
e->set_value (v * 127);
|
||||
DEBUG_TRACE (DEBUG::Console1,
|
||||
string_compose ("<-Encoder Plugin parameter %1: %2 - %3\n", n_controls, v*127, v));
|
||||
DEBUG_TRACE (
|
||||
DEBUG::Console1,
|
||||
string_compose ("<-Encoder Plugin parameter %1: %2 - %3\n", n_controls, v * 127, v));
|
||||
};
|
||||
e->set_plugin_action ([=] (uint32_t val) {
|
||||
double v = val / 127.f;
|
||||
c->set_value (parameterDescriptor.from_interface (v, true),
|
||||
PBD::Controllable::GroupControlDisposition::UseGroup);
|
||||
DEBUG_TRACE (DEBUG::Console1,
|
||||
string_compose ("->Encoder Plugin parameter %1: %2 - %3\n", n_controls, val, v));
|
||||
DEBUG_TRACE (
|
||||
DEBUG::Console1,
|
||||
string_compose ("->Encoder Plugin parameter %1: %2 - %3\n", n_controls, val, v));
|
||||
});
|
||||
c->Changed.connect (
|
||||
plugin_connections, MISSING_INVALIDATOR, boost::bind (plugin_mapping, _1, _2), this);
|
||||
@ -410,7 +419,9 @@ Console1::spill_plugins (const int32_t plugin_index)
|
||||
[=] (bool b, PBD::Controllable::GroupControlDisposition d) -> void {
|
||||
cb->set_led_state (c->get_value ());
|
||||
DEBUG_TRACE (DEBUG::Console1,
|
||||
string_compose ("<-ControllerButton Plugin parameter %1: %2 \n", n_controls, c->get_value()));
|
||||
string_compose ("<-ControllerButton Plugin parameter %1: %2 \n",
|
||||
n_controls,
|
||||
c->get_value ()));
|
||||
};
|
||||
cb->set_plugin_action ([=] (uint32_t val) {
|
||||
double v = val / 127.f;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "ardour/monitor_control.h"
|
||||
#include "ardour/phase_control.h"
|
||||
#include "ardour/readonly_control.h"
|
||||
#include "ardour/selection.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/stripable.h"
|
||||
#include "ardour/track.h"
|
||||
@ -263,7 +264,7 @@ Console1::notify_session_loaded ()
|
||||
DEBUG_TRACE (DEBUG::Console1, "************** Session Loaded() ********************\n");
|
||||
create_strip_inventory ();
|
||||
connect_internal_signals ();
|
||||
if (session) {
|
||||
/*if (session) {
|
||||
DEBUG_TRACE (DEBUG::Console1, "session available\n");
|
||||
uint32_t i = 0;
|
||||
while (!first_selected_stripable () && i < 10) {
|
||||
@ -271,9 +272,11 @@ Console1::notify_session_loaded ()
|
||||
std::this_thread::sleep_for (std::chrono::milliseconds (1000));
|
||||
++i;
|
||||
}
|
||||
if (i < 11)
|
||||
if (i < 10)
|
||||
stripable_selection_changed ();
|
||||
}
|
||||
else
|
||||
DEBUG_TRACE (DEBUG::Console1, "no selected stripable found\n");
|
||||
}*/
|
||||
}
|
||||
|
||||
void
|
||||
@ -540,7 +543,13 @@ void
|
||||
Console1::stripable_selection_changed ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Console1, "stripable_selection_changed \n");
|
||||
set_current_stripable (first_selected_stripable ());
|
||||
std::shared_ptr<Stripable> r = ControlProtocol::first_selected_stripable ();
|
||||
if ( r )
|
||||
set_current_stripable (r);
|
||||
|
||||
// select_rid_by_index (0);
|
||||
// set_current_stripable (ControlProtocol::first_selected_stripable ());
|
||||
// set_current_stripable (first_selected_stripable ());
|
||||
}
|
||||
|
||||
void
|
||||
@ -551,8 +560,10 @@ Console1::drop_current_stripable ()
|
||||
if (_current_stripable == session->monitor_out ()) {
|
||||
set_current_stripable (session->master_out ());
|
||||
} else {
|
||||
set_current_stripable (std::shared_ptr<Stripable> ());
|
||||
set_current_stripable (_current_stripable);
|
||||
}
|
||||
} else {
|
||||
set_current_stripable (std::shared_ptr<Stripable> ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1181,9 +1192,16 @@ Console1::get_index_by_inventory_order (order_t order)
|
||||
void
|
||||
Console1::select_rid_by_index (uint32_t index)
|
||||
{
|
||||
int rid = 0;
|
||||
#ifdef MIXBUS
|
||||
set_rid_selection (index + 1);
|
||||
rid = index + 1;
|
||||
// set_rid_selection (index + 1);
|
||||
#else
|
||||
set_rid_selection (index + 2);
|
||||
rid = index + 2;
|
||||
// set_rid_selection (index + 2);
|
||||
#endif
|
||||
std::shared_ptr<Stripable> s = session->get_remote_nth_stripable (rid, PresentationInfo::MixerStripables);
|
||||
if (s) {
|
||||
session->selection ().select_stripable_and_maybe_group (s, true, false, 0);
|
||||
}
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ class Console1 : public MIDISurface
|
||||
void drop_current_stripable ();
|
||||
/*void use_master ();
|
||||
void use_monitor ();*/
|
||||
void stripable_selection_changed ();
|
||||
void stripable_selection_changed () override;
|
||||
/*PBD::ScopedConnection selection_connection;*/
|
||||
PBD::ScopedConnectionList stripable_connections;
|
||||
PBD::ScopedConnectionList console1_connections;
|
||||
|
Loading…
Reference in New Issue
Block a user