Skip to content

Commit

Permalink
chore: Allow copying Messages
Browse files Browse the repository at this point in the history
This is ground work for the `map` Thru function
in PR #232.
  • Loading branch information
franky47 committed Aug 6, 2021
1 parent 7ca289d commit f356c99
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/midi_Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ struct Message
memset(sysexArray, 0, sSysExMaxSize * sizeof(DataByte));
}

inline Message(const Message& inOther)
: channel(inOther.channel)
, type(inOther.type)
, data1(inOther.data1)
, data2(inOther.data2)
, valid(inOther.valid)
, length(inOther.length)
{
if (type == midi::SystemExclusive)
{
memcpy(sysexArray, inOther.sysexArray, sSysExMaxSize * sizeof(DataByte));
}
}

/*! The maximum size for the System Exclusive array.
*/
static const unsigned sSysExMaxSize = SysExMaxSize;
Expand Down Expand Up @@ -94,7 +108,7 @@ struct Message
/*! Total Length of the message.
*/
unsigned length;

inline unsigned getSysExSize() const
{
const unsigned size = unsigned(data2) << 8 | data1;
Expand Down

0 comments on commit f356c99

Please sign in to comment.