Merge pull request #1115 from albedozero/system_realtime

Modify select drivers to pass system realtime messages
This commit is contained in:
Tom M 2022-06-11 17:35:34 +02:00 committed by GitHub
commit 41f00ec8cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 21 deletions

View file

@ -553,7 +553,7 @@ static fluid_thread_return_t fluid_alsa_audio_run_s16(void *d)
{ {
FLUID_MEMSET(left, 0, buffer_size * sizeof(*left)); FLUID_MEMSET(left, 0, buffer_size * sizeof(*left));
FLUID_MEMSET(right, 0, buffer_size * sizeof(*right)); FLUID_MEMSET(right, 0, buffer_size * sizeof(*right));
(*dev->callback)(dev->data, buffer_size, 0, NULL, 2, handle); (*dev->callback)(dev->data, buffer_size, 0, NULL, 2, handle);
/* convert floating point data to 16 bit (with dithering) */ /* convert floating point data to 16 bit (with dithering) */
@ -1347,6 +1347,26 @@ fluid_alsa_seq_run(void *d)
} }
break; break;
case SND_SEQ_EVENT_START:
evt.type = MIDI_START;
break;
case SND_SEQ_EVENT_CONTINUE:
evt.type = MIDI_CONTINUE;
break;
case SND_SEQ_EVENT_STOP:
evt.type = MIDI_STOP;
break;
case SND_SEQ_EVENT_CLOCK:
evt.type = MIDI_SYNC;
break;
case SND_SEQ_EVENT_RESET:
evt.type = MIDI_SYSTEM_RESET;
break;
default: default:
continue; /* unhandled event, next loop iteration */ continue; /* unhandled event, next loop iteration */
} }

View file

@ -145,21 +145,28 @@ fluid_winmidi_callback(HMIDIIN hmi, UINT wMsg, DWORD_PTR dwInstance,
break; break;
case MIM_DATA: case MIM_DATA:
event.type = msg_type(msg_param); if(msg_param < 0xF0) /* Voice category message */
event.channel = msg_chan(msg_param) + dev_infos->channel_map;
FLUID_LOG(FLUID_DBG, "\ndevice at index %d sending MIDI message on channel %d, forwarded on channel: %d",
dev_infos->dev_idx, msg_chan(msg_param), event.channel);
if(event.type != PITCH_BEND)
{ {
event.param1 = msg_p1(msg_param); event.type = msg_type(msg_param);
event.param2 = msg_p2(msg_param); event.channel = msg_chan(msg_param) + dev_infos->channel_map;
FLUID_LOG(FLUID_DBG, "\ndevice at index %d sending MIDI message on channel %d, forwarded on channel: %d",
dev_infos->dev_idx, msg_chan(msg_param), event.channel);
if(event.type != PITCH_BEND)
{
event.param1 = msg_p1(msg_param);
event.param2 = msg_p2(msg_param);
}
else /* Pitch bend is a 14 bit value */
{
event.param1 = (msg_p2(msg_param) << 7) | msg_p1(msg_param);
event.param2 = 0;
}
} }
else /* Pitch bend is a 14 bit value */ else /* System message */
{ {
event.param1 = (msg_p2(msg_param) << 7) | msg_p1(msg_param); event.type = msg_param;
event.param2 = 0;
} }
(*dev->driver.handler)(dev->driver.data, &event); (*dev->driver.handler)(dev->driver.data, &event);

View file

@ -2642,14 +2642,9 @@ fluid_midi_parser_parse(fluid_midi_parser_t *parser, unsigned char c)
* of another message. */ * of another message. */
if(c >= 0xF8) if(c >= 0xF8)
{ {
if(c == MIDI_SYSTEM_RESET) parser->event.type = c;
{ parser->status = 0; /* clear the status */
parser->event.type = c; return &parser->event;
parser->status = 0; /* clear the status */
return &parser->event;
}
return NULL;
} }
/* Status byte? - If previous message not yet complete, it is discarded (re-sync). */ /* Status byte? - If previous message not yet complete, it is discarded (re-sync). */