summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_scene_change.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-11-10 21:22:05 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-11-10 23:17:08 -0500
commit0f243d5f7c1201377460d1b46aed4f10e68ef0cf (patch)
tree338f28f418f0cb19ea77cb9a7e32be15c8acc9c4 /libs/ardour/midi_scene_change.cc
parent70960a5a0055019b576e32acc1acf2094f4e4141 (diff)
serialize/deserialize MIDISceneChange color; put out of bounds color into static const
Diffstat (limited to 'libs/ardour/midi_scene_change.cc')
-rw-r--r--libs/ardour/midi_scene_change.cc13
1 files changed, 12 insertions, 1 deletions
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;
}