-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added inline helper methods to create ports of the correct type - Had to move `jack_port_uuid` to the top because we still can't use methods declared below in 2019 - I'd like to add helper methods that automatically set the metadata but C has no method overloading?! - Improved metadata documentation - Registering a port with the `JACK_DEFAULT_MIDI_TYPE` will automatically change it to `JACK_DEFAULT_MESSAGE_TYPE` for forward compatibility.
- Loading branch information
1 parent
1c3f811
commit cf6523f
Showing
3 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood me.
jack_port_register_audio
is not the way to go, but something that can receive more arguments then the port_register where we define the custom type. this will call port register, and then metadata stuff on top of it.off-topic: lack of method overloading in C is a feature not a bug. all exported symbols have a unique name, this is what makes C-based libraries being able to be exported and used in so many other languages
cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. Should I keep the
_register_audio
helper functions nevertheless?Automatically setting the metadata has two problems I encountered:
metadata.h
intojack.h
for some reasons. (This should work if I include this as proper new methods instead of inline ones though)port_type
.cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to put all the new stuff in a new header file. less confusing that way.
call it
message_event.h
or similar, that way it is much easier for 3rd parties to know what is new - they just check a single header file.the only exception is the macro for the "binary message" string.
we can put the new functions in this header: the event related stuff and also the inline functions (that set event type together with the port registration).
the
midiport.h
header can then importmessage_event.h
(header names not finalized) so it has the data types that message a generic message event.cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's assume I redo this pull request from scratch.:
messageport.h
messageport.h
will typedef back tomidiport.h
. The documentation is copied and adapted frommidiport.h
, as well as the method names.midiport.h
includesmessageport.h
, all struct definitions frommidiport.h
are moved tomessageport.h
. (This way we maintain ABI compability while not having new clients drag old code with themJACK_DEFAULT_MIDI_TYPE
is replaced withJACK_DEFAULT_MESSAGE_TYPE
messageport.h
that help creating ports with the correct metadata. Their use is optional, calling the old methods will provide sensible defaults. Since they are in a new header file and optional use, they can be their own symbols and don't have do be inline.What do you think?
cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, except replacing JACK_DEFAULT_MIDI_TYPE with JACK_DEFAULT_MESSAGE_TYPE.
for legacy reasons we need to keep the JACK_DEFAULT_MIDI_TYPE
I dont think you need to redo the PR, only update the headers now.
I can squash the commits in a single one when the PR is ready
cf6523f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With "replace", I didn't mean replacing the symbol in the API, but if a newer server encounters a port with the type
JACK_DEFAULT_MIDI_TYPE
from an older client, it will silently change this toJACK_DEFAULT_MESSAGE_TYPE
. But honestly I'm not sure if I should do this.