Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

paulhuggett
Copy link
Contributor

Following the suggestion by @dhjdhj in #3, I thought I'd have a stab at the change!

Created a umpCommon struct which contains the fields that are common to umpCVM, umpGeneric, and umpData. There was a suggestion that inheritance could be used in this situation, but I've gone with the "prefer aggregation to inheritance" maxim and added a "common" field instead!

I replaced the default ctors of these types with direct member initialization. This should be a no-op from the POV of the generated code with the exception that I've initialized the umpData data and dataLength fields to nullptr and 0 respectively for safety.

Created a umpCommon struct which contains the fields that are common
to umpCMD, umpGeneric, and umpData. There was a suggestion that
inheritance could be used in this situation, but I've gone with the
"prefer aggregation to inheritance" and added a "common" field instead!
@starfishmod
Copy link
Member

@paulhuggett I can see what you are trying to do with this PR, however I have some concerns with changing the way users have to interact with the library.

For example this changes from:

void handleChannelVoiceMessages(struct umpCVM mess){
    printf("->CVM: Group %d CH %d Note: %d status: %d", mess.umpGroup, mess.channel, mess.status);
} 

To:

void handleChannelVoiceMessages(struct umpCVM mess){
    printf("->CVM: Group %d CH %d Note: %d status: %d", mess.common.umpGroup, mess.channel, mess.common.status);
} 

This library is now being packed up in Microsoft VC PKG and is (potentially) being used in the new MIDI Service Engine and I'd prefer not to break what they are doing.

If you think this is an important change I can hit up the MS guys to see what they think?

@paulhuggett
Copy link
Contributor Author

If you think this is an important change I can hit up the MS guys to see what they think?

I didn't realise that the library API is at least to some extent frozen. From my POV, the change would be a small improvement, but certainly not a hill to die on. I think the simplified initialization is worth keeping, so I'll create a separate PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants