mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-14 21:38:15 -04:00
audioconvert: support Midi control messages as well
This commit is contained in:
parent
2e86383aba
commit
cd654efa6a
1 changed files with 13 additions and 5 deletions
|
|
@ -1906,16 +1906,23 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int apply_midi(struct impl *this, const struct spa_pod *value)
|
static int apply_midi(struct impl *this, uint32_t type, const struct spa_pod *value)
|
||||||
{
|
{
|
||||||
struct props *p = &this->props;
|
struct props *p = &this->props;
|
||||||
uint8_t ev[8];
|
uint8_t evd[8];
|
||||||
|
const uint8_t *ev;
|
||||||
int ev_size;
|
int ev_size;
|
||||||
const uint32_t *body = SPA_POD_BODY_CONST(value);
|
|
||||||
size_t size = SPA_POD_BODY_SIZE(value);
|
size_t size = SPA_POD_BODY_SIZE(value);
|
||||||
uint64_t state = 0;
|
uint64_t state = 0;
|
||||||
|
|
||||||
ev_size = spa_ump_to_midi(&body, &size, ev, sizeof(ev), &state);
|
if (type == SPA_CONTROL_UMP) {
|
||||||
|
const uint32_t *body = SPA_POD_BODY_CONST(value);
|
||||||
|
ev_size = spa_ump_to_midi(&body, &size, evd, sizeof(evd), &state);
|
||||||
|
ev = evd;
|
||||||
|
} else {
|
||||||
|
ev_size = size;
|
||||||
|
ev = SPA_POD_BODY_CONST(value);
|
||||||
|
}
|
||||||
if (ev_size < 3)
|
if (ev_size < 3)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
@ -3471,7 +3478,8 @@ static int channelmix_process_apply_sequence(struct impl *this,
|
||||||
if (prev) {
|
if (prev) {
|
||||||
switch (prev->type) {
|
switch (prev->type) {
|
||||||
case SPA_CONTROL_UMP:
|
case SPA_CONTROL_UMP:
|
||||||
apply_midi(this, &prev->value);
|
case SPA_CONTROL_Midi:
|
||||||
|
apply_midi(this, prev->type, &prev->value);
|
||||||
break;
|
break;
|
||||||
case SPA_CONTROL_Properties:
|
case SPA_CONTROL_Properties:
|
||||||
apply_props(this, &prev->value);
|
apply_props(this, &prev->value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue