summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/midi_scene_change.h1
-rw-r--r--libs/ardour/midi_scene_change.cc13
2 files changed, 13 insertions, 1 deletions
diff --git a/libs/ardour/ardour/midi_scene_change.h b/libs/ardour/ardour/midi_scene_change.h
index 9c8f5ca01f..69f7b05d29 100644
--- a/libs/ardour/ardour/midi_scene_change.h
+++ b/libs/ardour/ardour/midi_scene_change.h
@@ -57,6 +57,7 @@ class MIDISceneChange : public SceneChange
uint32_t color() const;
void set_color (uint32_t);
+ static const uint32_t out_of_bound_color;
PBD::Signal0<void> ColorChanged;
private:
diff --git a/libs/ardour/midi_scene_change.cc b/libs/ardour/midi_scene_change.cc
index db7e826384..db903c21eb 100644
--- a/libs/ardour/midi_scene_change.cc
+++ b/libs/ardour/midi_scene_change.cc
@@ -28,11 +28,13 @@
using namespace PBD;
using namespace ARDOUR;
+const uint32_t MIDISceneChange::out_of_bound_color = 0x00000000; /* note: zero alpha means invisible, which acts as out-of-bound signal */
+
MIDISceneChange::MIDISceneChange (int c, int b, int p)
: _bank (b)
, _program (p)
, _channel (c & 0xf)
- , _color (0x00000000) /* note: zero alpha means invisible, which acts as out-of-bound signal */
+ , _color (out_of_bound_color)
{
if (_bank > 16384) {
_bank = -1;
@@ -47,6 +49,7 @@ MIDISceneChange::MIDISceneChange (const XMLNode& node, int version)
: _bank (-1)
, _program (-1)
, _channel (-1)
+ , _color (out_of_bound_color)
{
set_state (node, version);
}
@@ -111,6 +114,8 @@ MIDISceneChange::get_state ()
node->add_property (X_("bank"), buf);
snprintf (buf, sizeof (buf), "%d", (int) _channel);
node->add_property (X_("channel"), buf);
+ snprintf (buf, sizeof (buf), "%u", _color);
+ node->add_property (X_("color"), buf);
return *node;
}
@@ -139,6 +144,12 @@ MIDISceneChange::set_state (const XMLNode& node, int /* version-ignored */)
}
_channel = atoi (prop->value());
+ if ((prop = node.property (X_("color"))) != 0) {
+ _color = atoi (prop->value());
+ } else {
+ _color = out_of_bound_color;
+ }
+
return 0;
}