diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 1b5cbd062..47c709c69 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "volume-ops.h" #include "fmt-ops.h" @@ -302,7 +303,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full) items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_IGNORE_LATENCY, "true"); } else if (PORT_IS_CONTROL(this, port->direction, port->id)) { items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "control"); - items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi"); + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP"); } if (this->group_name[0] != '\0') items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, this->group_name); @@ -1259,17 +1260,19 @@ static int apply_props(struct impl *this, const struct spa_pod *param) static int apply_midi(struct impl *this, const struct spa_pod *value) { - const uint8_t *val = SPA_POD_BODY(value); - uint32_t size = SPA_POD_BODY_SIZE(value); struct props *p = &this->props; + uint8_t data[8]; + int size; + size = spa_ump_to_midi(SPA_POD_BODY(value), SPA_POD_BODY_SIZE(value), + data, sizeof(data)); if (size < 3) return -EINVAL; - if ((val[0] & 0xf0) != 0xb0 || val[1] != 7) + if ((data[0] & 0xf0) != 0xb0 || data[1] != 7) return 0; - p->volume = val[2] / 127.0f; + p->volume = data[2] / 127.0f; set_volume(this); return 1; } @@ -2071,7 +2074,9 @@ static int port_enum_formats(void *object, *param = spa_pod_builder_add_object(builder, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)); + SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control), + SPA_FORMAT_CONTROL_types, SPA_POD_CHOICE_FLAGS_Int( + (1u<io_position ? @@ -2177,7 +2182,9 @@ impl_node_port_enum_params(void *object, int seq, param = spa_pod_builder_add_object(&b, SPA_TYPE_OBJECT_Format, id, SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control)); + SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control), + SPA_FORMAT_CONTROL_types, SPA_POD_Int( + (1u<format.info.raw); break; @@ -2808,7 +2815,7 @@ static int channelmix_process_apply_sequence(struct impl *this, if (prev) { switch (prev->type) { - case SPA_CONTROL_Midi: + case SPA_CONTROL_UMP: apply_midi(this, &prev->value); break; case SPA_CONTROL_Properties: