Skip to content

Commit

Permalink
added profile specific data
Browse files Browse the repository at this point in the history
  • Loading branch information
Bremmers authored Nov 18, 2023
1 parent fbe3d0c commit 6738f8b
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions include/clap/ext/draft/midici-profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

//usage examples:
//- the host can tell a MIDI keyboard the plugin conforms to the drawbar organ profile, so the keyboard can set up its faders for that.
//- the plugin can adapt its MIDI controller mapping if a MIDI keyboard actives a profile (via the host).
//- the host can send per-note articulations in note attributes if there's an active profile for this.
//- the host can send per-note articulations in MIDI 2.0 protocol note-on attributes if there's an active profile for this.

//the 5 bytes repesenting a profile go in a uint64_t.
//the Default Control Change Mapping profile would be 0x00000000_0000217e for example.

//TODO : for completeness this should work per-input port. Is that worth it?
//TODO : for even more completeness it could work for outputs too. A MIDI effect plugin might want to know
//TODO : profiles can be different for each MIDI channel, and this should work per-input port.
// we can add that once we've agreed on the basic functionality.
//TODO : for completeness it could work for outputs too. A MIDI effect plugin might want to know
// the host can receive per-note articulations in note attributes for example.

static CLAP_CONSTEXPR const char CLAP_EXT_MIDICI_PROFILES[] = "clap.midici-profiles.draft/0";
Expand All @@ -32,14 +32,32 @@ typedef struct clap_plugin_midici_profiles {
uint64_t *profile
bool *active);

//Actives a profile
//returns true if the profile was activated
//TODO : should this call struct clap_host_midici_profiles.changed or not?
// get number of bytes for profile specific data for the specified Inquiry Target
// if result=0 there's no data available for this Inquiry Target
// [main-thread]
uint32_t(CLAP_ABI *get_data_size)(const clap_plugin_t *plugin,
uint32_t profile_index,
uint8_t inquiry_target);

// get profile specific data for the specified Inquiry Target
// buffer must be large enough to contain the number of bytes returned by get_data_size()
// [main-thread]
bool(CLAP_ABI *get_data)(const clap_plugin_t *plugin,
uint32_t profile_index,
uint8_t inquiry_target,
const uint8_t *buffer);

// Actives a profile, so the plugin knows the host will use this
// returns true if the profile was activated
// Note: do not call clap_host_midici_profiles.changed
// [main-thread]
bool(CLAP_ABI *activate)(const clap_plugin_t *plugin,
uint64_t profile);

//Deactives a profile
//returns true if the profile was deactivated
// Deactives a profile
// returns true if the profile was deactivated
// Note: do not call clap_host_midici_profiles.changed
// [main-thread]
bool(CLAP_ABI *deactivate)(const clap_plugin_t *plugin,
uint64_t profile);
} clap_plugin_midici_profiles_t;
Expand Down

0 comments on commit 6738f8b

Please sign in to comment.