PatchChange: fix operator=() implementation which failed to manage event buffer ownership correctly

This commit is contained in:
Paul Davis 2022-02-02 15:03:12 -07:00
parent 6175af002c
commit 31f4d8a2ca

View File

@ -74,6 +74,15 @@ public:
unset ();
}
PatchChange& operator= (PatchChange const & other) {
/* Need to be careful with assignment here, due to buffer
ownership issues etc.
*/
_bank_change_msb.set (other._bank_change_msb.buffer(), 3, other.time());
_bank_change_lsb.set (other._bank_change_lsb.buffer(), 3, other.time());
_program_change.set (other._program_change.buffer(), 2, other.time());
return *this;
}
void unset() {
_bank_change_msb.buffer()[1] = 0xf; /* unset */
_bank_change_lsb.buffer()[1] = 0xf; /* unset */