Changing CC messages


#1

I noticed there is no way to change CC messages without creating a new message. I made the return pointer to the raw data of getRawData() not const so I could change it directly, but this is a bad hack and I don't know if there are any weird side effects, so maybe these two methods could be added to the MidiMessage class:

void MidiMessage::setControllerNumber(const int newControllerNumber) noexcept
{
    if(isController())
        data[1] = (uint8) (newControllerNumber & 127);
}


void MidiMessage::setControllerValue(const int newControllerValue) noexcept
{ 
    if(isController()) 
        data[2] = (uint8) (newControllerValue & 127); // maybe add a better validity check here...
}

#2

The class is designed to be mostly immutable, there'd be no advantage in adding a method like that. Just create a new message and assign it, the overhead is negligible.