Skip to content

Commit 2ae9d9e

Browse files
franky47hyperbolist
authored andcommitted
chore: Allow copying Messages
This is ground work for the `map` Thru function in PR #232.
1 parent 08f6f53 commit 2ae9d9e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/midi_Message.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ struct Message
5454
memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
5555
}
5656

57+
inline Message(const Message& inOther)
58+
: channel(inOther.channel)
59+
, type(inOther.type)
60+
, data1(inOther.data1)
61+
, data2(inOther.data2)
62+
, valid(inOther.valid)
63+
, length(inOther.length)
64+
{
65+
if (type == midi::SystemExclusive)
66+
{
67+
memcpy(sysexArray, inOther.sysexArray, sSysExMaxSize * sizeof(DataByte));
68+
}
69+
}
70+
5771
/*! The maximum size for the System Exclusive array.
5872
*/
5973
static const unsigned sSysExMaxSize = SysExMaxSize;
@@ -94,7 +108,7 @@ struct Message
94108
/*! Total Length of the message.
95109
*/
96110
unsigned length;
97-
111+
98112
inline unsigned getSysExSize() const
99113
{
100114
const unsigned size = unsigned(data2) << 8 | data1;

0 commit comments

Comments
 (0)