fix a bunch of memory leaks
[ardour.git] / libs / ardour / midi_scene_change.cc
index 81a74911a97cbbf2267889cf73ff352311a46882..dae8acfc2164780c88a3bdd6b96a75d86654ec97 100644 (file)
@@ -28,9 +28,8 @@
 using namespace PBD;
 using namespace ARDOUR;
 
-MIDISceneChange::MIDISceneChange (framepos_t time, int c, int b, int p)
-       : SceneChange (time)
-       , _bank (b)
+MIDISceneChange::MIDISceneChange (int c, int b, int p)
+       : _bank (b)
        , _program (p)
        , _channel (c & 0xf)
 {
@@ -44,8 +43,7 @@ MIDISceneChange::MIDISceneChange (framepos_t time, int c, int b, int p)
 }
 
 MIDISceneChange::MIDISceneChange (const XMLNode& node, int version)
-       : SceneChange (0)
-       , _bank (-1)
+       : _bank (-1)
        , _program (-1)
        , _channel (-1)
 {
@@ -65,7 +63,7 @@ MIDISceneChange::get_bank_msb_message (uint8_t* buf, size_t size) const
 
        buf[0] = 0xB0 | (_channel & 0xf);
        buf[1] = 0x0;
-       buf[2] = (_bank & 0xf700) >> 8;
+       buf[2] = (_bank >> 7) & 0x7f;
 
        return 3;
 }
@@ -79,7 +77,7 @@ MIDISceneChange::get_bank_lsb_message (uint8_t* buf, size_t size) const
 
        buf[0] = 0xB0 | (_channel & 0xf);
        buf[1] = 0x20;
-       buf[2] = (_bank & 0xf7);        
+       buf[2] = _bank & 0x7f;  
 
        return 3;
 }
@@ -92,7 +90,7 @@ MIDISceneChange::get_program_message (uint8_t* buf, size_t size) const
        }
 
        buf[0] = 0xC0 | (_channel & 0xf);
-       buf[1] = _program & 0xf7;
+       buf[1] = _program & 0x7f;
 
        return 2;
 }