mirror of
https://github.com/ZDoom/ZMusic.git
synced 2025-02-21 02:41:03 +00:00
Improve ALSA MIDI backend
1. No longer excludes builtin MIDI passthrough ports. 2. "GZDoom" references changed to "ZMusic Program". 3. No longer bugs out when MIDI playback is paused.
This commit is contained in:
parent
2b291705f2
commit
fee3bc352e
2 changed files with 7 additions and 17 deletions
|
@ -50,7 +50,6 @@ namespace {
|
|||
|
||||
enum class EventType {
|
||||
Null,
|
||||
Delay,
|
||||
Action
|
||||
};
|
||||
|
||||
|
@ -160,7 +159,7 @@ int AlsaMIDIDevice::Open()
|
|||
snd_seq_port_info_set_port(pinfo, IntendedPortId);
|
||||
snd_seq_port_info_set_port_specified(pinfo, 1);
|
||||
|
||||
snd_seq_port_info_set_name(pinfo, "GZDoom Music");
|
||||
snd_seq_port_info_set_name(pinfo, "ZMusic Program Music");
|
||||
|
||||
snd_seq_port_info_set_capability(pinfo, 0);
|
||||
snd_seq_port_info_set_type(pinfo, SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION);
|
||||
|
@ -172,7 +171,7 @@ int AlsaMIDIDevice::Open()
|
|||
|
||||
if (QueueId < 0)
|
||||
{
|
||||
QueueId = snd_seq_alloc_named_queue(sequencer.handle, "GZDoom Queue");
|
||||
QueueId = snd_seq_alloc_named_queue(sequencer.handle, "ZMusic Program Queue");
|
||||
}
|
||||
|
||||
if (!Connected) {
|
||||
|
@ -315,8 +314,10 @@ EventType AlsaMIDIDevice::PullEvent(EventState & state) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// We didn't really recognize the event, treat it as a delay
|
||||
return EventType::Delay;
|
||||
// We didn't really recognize the event, treat it as a NOP
|
||||
state.data.type = SND_SEQ_EVENT_NONE;
|
||||
snd_seq_ev_set_fixed(&state.data);
|
||||
return EventType::Action;
|
||||
}
|
||||
|
||||
void AlsaMIDIDevice::SetExit(bool exit) {
|
||||
|
@ -374,13 +375,6 @@ void AlsaMIDIDevice::PumpEvents() {
|
|||
continue;
|
||||
}
|
||||
|
||||
// chomp delays as they come...
|
||||
if(type == EventType::Delay) {
|
||||
buffer_ticks += event.ticks;
|
||||
Position += event.size_of;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Figure out if we should sleep (the event is too far in the future for us to care), and for how long
|
||||
int next_event_tick = buffer_ticks + event.ticks;
|
||||
int queue_tick = snd_seq_queue_status_get_tick_time(status);
|
||||
|
|
|
@ -67,7 +67,7 @@ bool AlsaSequencer::Open() {
|
|||
if(error) {
|
||||
return false;
|
||||
}
|
||||
error = snd_seq_set_client_name(handle, "GZDoom");
|
||||
error = snd_seq_set_client_name(handle, "ZMusic Program");
|
||||
if(error) {
|
||||
snd_seq_close(handle);
|
||||
handle = nullptr;
|
||||
|
@ -131,11 +131,7 @@ int AlsaSequencer::EnumerateDevices() {
|
|||
while (snd_seq_query_next_client(handle, cinfo) >= 0) {
|
||||
snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
|
||||
|
||||
// Ignore 'ALSA oddities' that we don't want to use
|
||||
int clientID = snd_seq_client_info_get_client(cinfo);
|
||||
if(clientID < 16) {
|
||||
continue;
|
||||
}
|
||||
|
||||
snd_seq_port_info_set_port(pinfo, -1);
|
||||
// enumerate ports
|
||||
|
|
Loading…
Reference in a new issue