mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
triggerbox: add Properties::channel_map (and sent it); save/restore channel map state (untested)
This commit is contained in:
parent
bce4eb36ad
commit
3c2fdab1ce
2 changed files with 47 additions and 2 deletions
|
|
@ -815,6 +815,7 @@ namespace Properties {
|
|||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> stretchable;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> cue_isolated;
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> patch_change; /* type not important */
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> channel_map; /* type not important */
|
||||
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> tempo_meter; /* only used to transmit changes, not storage */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ namespace ARDOUR {
|
|||
PBD::PropertyDescriptor<Trigger::StretchMode> stretch_mode;
|
||||
PBD::PropertyDescriptor<bool> tempo_meter; /* only to transmit updates, not storage */
|
||||
PBD::PropertyDescriptor<bool> patch_change; /* only to transmit updates, not storage */
|
||||
PBD::PropertyDescriptor<bool> channel_map; /* only to transmit updates, not storage */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1720,10 +1721,15 @@ MIDITrigger::set_channel_map (int channel, int target)
|
|||
if (channel < 0 || channel >= 16) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target < 0 || target >= 16) {
|
||||
return;
|
||||
}
|
||||
_channel_map[channel] = target;
|
||||
|
||||
if (_channel_map[channel] != target) {
|
||||
_channel_map[channel] = target;
|
||||
PropertyChanged (Properties::channel_map);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1732,7 +1738,11 @@ MIDITrigger::unset_channel_map (int channel)
|
|||
if (channel < 0 || channel >= 16) {
|
||||
return;
|
||||
}
|
||||
_channel_map[channel] = -1;
|
||||
|
||||
if (_channel_map[channel] >= 0) {
|
||||
_channel_map[channel] = -1;
|
||||
PropertyChanged (Properties::channel_map);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -1938,6 +1948,21 @@ MIDITrigger::get_state (void)
|
|||
node.add_child_nocopy (*patches_node);
|
||||
}
|
||||
|
||||
std::string cmstr;
|
||||
|
||||
for (int chn = 0; chn < 16; ++chn) {
|
||||
char buf[4];
|
||||
|
||||
if (chn > 0) {
|
||||
cmstr += ',';
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", _channel_map[chn]);
|
||||
cmstr += buf;
|
||||
}
|
||||
|
||||
node.set_property (X_("channel-map"), cmstr);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
@ -1971,6 +1996,23 @@ MIDITrigger::set_state (const XMLNode& node, int version)
|
|||
}
|
||||
}
|
||||
|
||||
std::string cmstr;
|
||||
|
||||
if (node.get_property (X_("channel-map"), cmstr)) {
|
||||
std::stringstream ss (cmstr);
|
||||
char comma;
|
||||
for (int chn = 0; chn < 16; ++chn) {
|
||||
ss >> _channel_map[chn];
|
||||
if (!ss) {
|
||||
break;
|
||||
}
|
||||
ss >> comma;
|
||||
if (!ss) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2284,6 +2326,8 @@ Trigger::make_property_quarks ()
|
|||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for stretch_mode = %1\n", Properties::stretch_mode.property_id));
|
||||
Properties::patch_change.property_id = g_quark_from_static_string (X_("patch_change"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for patch_change = %1\n", Properties::patch_change.property_id));
|
||||
Properties::channel_map.property_id = g_quark_from_static_string (X_("channel_map"));
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for channel_map = %1\n", Properties::channel_map.property_id));
|
||||
}
|
||||
|
||||
Temporal::BBT_Offset TriggerBox::_assumed_trigger_duration (4, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue