Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bremmers authored May 5, 2024
1 parent e209ae8 commit a5bbca6
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions include/clap/ext/draft/midici-profiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
// port profiles: channel is 255, num_channels is 0

// enumerating profiles
// clap_plugin_midici_profiles.count()/get() return a list of profile_t structs. Both enabled and available profiles are listed.
// clap_plugin_midici_profiles.count()/get() return a list of clap_profile_t structs. Both enabled and available profiles are listed.
// All enabled profiles are listed. Multiple entries will appear if a channel or group profile is enabled on multiple channels or groups.
// If a profile isn't enabled at least one CLAP_MIDICI_PROFILE_DISABLED entry appears in the list, so the host can detect the profile is supported.
// If a profile isn't enabled at least one CLAP_MIDICI_PROFILES_DISABLED entry appears in the list, so the host can detect the profile is supported.
// In case of a channel or group profile the host can try to enable it on any channel or group, and the plugin can reject this if it isn't possible.
// In detail:
// enabled single channel profiles: one entry per enabled channel. At least one CLAP_MIDICI_PROFILE_DISABLED entry if the profile isn't enabled for any channel.
// enabled multi channel profiles: one entry per enabled block of channels. At least one CLAP_MIDICI_PROFILE_DISABLED entry if the profile isn't enabled for any channel.
// enabled group profiles: one entry per enabled group. At least one CLAP_MIDICI_PROFILE_DISABLED entry if the profile isn't enabled for any group.
// enabled single channel profiles: one entry per enabled channel. At least one CLAP_MIDICI_PROFILES_DISABLED entry if the profile isn't enabled for any channel.
// enabled multi channel profiles: one entry per enabled block of channels. At least one CLAP_MIDICI_PROFILES_DISABLED entry if the profile isn't enabled for any channel.
// enabled group profiles: one entry per enabled group. At least one CLAP_MIDICI_PROFILES_DISABLED entry if the profile isn't enabled for any group.
// port profiles: one entry.

// Plugins can typically use a simple fixed list. For example: in case of a single-channel profile and 16 channels, clap_plugin_midici_profiles.count() can always return 16.
Expand All @@ -35,8 +35,8 @@
// 2. enable/disable profiles as needed.
// 3. get profile details using clap_plugin_midici_profiles.get_details().

// Plugins can use CLAP_MIDICI_PROFILE_ALWAYSON for profiles which can't be enabled/disabled by the host.
// Note that a plugin can remove a CLAP_MIDICI_PROFILE_ALWAYSON profile and call clap_host_midici_profiles.changed().
// Plugins can use CLAP_MIDICI_PROFILES_ALWAYSON for profiles which can't be enabled/disabled by the host.
// Note that a plugin can remove a CLAP_MIDICI_PROFILES_ALWAYSON profile and call clap_host_midici_profiles.changed().

// Some features of this extension can only be used with note ports using the CLAP_NOTE_DIALECT_MIDI2 dialect (groups in particular).

Expand All @@ -47,57 +47,57 @@ extern "C" {
#endif

enum {
CLAP_MIDICI_PROFILE_DISABLED = 0,
CLAP_MIDICI_PROFILE_ENABLED = 1,
CLAP_MIDICI_PROFILE_ALWAYSON = 2
CLAP_MIDICI_PROFILES_DISABLED = 0,
CLAP_MIDICI_PROFILES_ENABLED = 1,
CLAP_MIDICI_PROFILES_ALWAYSON = 2
};

enum {
CLAP_MIDICI_PROFILE_INQUIRY_TARGET_DATA = 255
CLAP_MIDICI_PROFILES_INQUIRY_TARGET_DATA = 255
};

typedef struct profile_id {
typedef struct clap_profile_id {
uint8_t id;
uint8_t bank;
uint8_t number;
uint8_t version;
uint8_t level;
} profile_id_t;
} clap_profile_id_t;

typedef struct profile {
profile_id_t id;
uint8_t channel; // see "destination addressing" paragraph at top of file.
uint16_t num_channels; // see "destination addressing" paragraph at top of file.
uint8_t enabled; // CLAP_MIDICI_PROFILE_*
} profile_t;
typedef struct clap_profile {
clap_profile_id_t profile_id;
uint8_t channel; // see "destination addressing" paragraph at top of file.
uint16_t num_channels; // see "destination addressing" paragraph at top of file.
uint8_t enabled; // CLAP_MIDICI_PROFILES_*
} clap_profile_t;

typedef struct clap_plugin_midici_profiles {
// Returns the number of profile_t entries available.
// Returns the number of clap_profile_t entries available.
// The "enumerating profiles" paragraph above describes what's supposed to be in the list.
// [main-thread]
uint32_t(CLAP_ABI *count)(const clap_plugin_t *plugin,
uint16_t port_index);

// Get a profile_t by index.
// Get a clap_profile_t by index.
// [main-thread]
bool(CLAP_ABI *get)(const clap_plugin_t *plugin,
uint16_t port_index,
uint32_t profile_index,
const struct profile *profile);
clap_profile_t *profile);

// Get profile details from profile at channel/num_channels for the specified inquiry_target.
// Returns true if data is written to stream correctly.
// Returns false if there's no data available for this inquiry_target.
// channel and num-channels: see "destination addressing" paragraph at top of file.
// inquiry_target is 0..127. CLAP_MIDICI_PROFILE_INQUIRY_TARGET_DATA can be used to get Profile Specific Data from the plugin.
// inquiry_target is 0..127. CLAP_MIDICI_PROFILES_INQUIRY_TARGET_DATA can be used to get Profile Specific Data from the plugin.
// Multiple Profile Specific Data Messages can be written to stream. Each one starts with 0xF0, followed by the actual Profile Specific Data, and ends with 0xF7.
// Example: MPE Channel Response Type Notification would be F0 01 F7
// The profile targeted by channel/num_channels should generally be enabled before calling this function.
// In some cases profile detals like available channels are needed before enabling a profile. Plugins should make sure this is handled correctly.
// [main-thread]
bool(CLAP_ABI *get_details)(const clap_plugin_t *plugin,
uint16_t port_index,
const struct profile_id profile,
const clap_profile_id_t profile,
uint8_t channel,
uint16_t num_channels,
uint8_t inquiry_target,
Expand All @@ -111,7 +111,7 @@ typedef struct clap_plugin_midici_profiles {
// [main-thread]
bool(CLAP_ABI *set_data)(const clap_plugin_t *plugin,
uint16_t port_index,
const profile_id_t profile,
const clap_profile_id_t profile,
uint8_t channel,
uint16_t num_channels,
const uint8_t *buffer,
Expand All @@ -126,7 +126,7 @@ typedef struct clap_plugin_midici_profiles {
// [main-thread]
bool(CLAP_ABI *enable)(const clap_plugin_t *plugin,
uint16_t port_index,
const profile_id_t profile,
const clap_profile_id_t profile,
uint8_t channel,
uint16_t num_channels);

Expand All @@ -137,7 +137,7 @@ typedef struct clap_plugin_midici_profiles {
// [main-thread]
bool(CLAP_ABI *disable)(const clap_plugin_t *plugin,
uint16_t port_index,
const profile_id_t profile,
const clap_profile_id_t profile,
uint8_t channel,
uint16_t num_channels);
} clap_plugin_midici_profiles_t;
Expand All @@ -148,13 +148,13 @@ typedef struct clap_host_midici_profiles {
void(CLAP_ABI *changed)(const clap_host_t *host);

// Plugins calls this if host needs to read Profile Specific Data Messages again.
// Host calls get_details(.., port_index, profile, channel, num_channels, CLAP_MIDICI_PROFILE_INQUIRY_TARGET_DATA, ..).
// Host calls get_details(.., port_index, profile, channel, num_channels, CLAP_MIDICI_PROFILES_INQUIRY_TARGET_DATA, ..).
// [main-thread]
void(CLAP_ABI *datachanged)(const clap_host_t *host,
uint16_t port_index,
const profile_id_t profile,
const clap_profile_id_t profile,
uint8_t channel,
uint16_t num_channels);
uint16_t num_channels);
} clap_host_midici_profiles_t;

#ifdef __cplusplus
Expand Down

0 comments on commit a5bbca6

Please sign in to comment.