diff --git a/CMakeLists.txt b/CMakeLists.txt index cf0c60e..6cd71c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,12 +174,12 @@ add_definitions(${_BOO_SYS_DEFINES}) include_directories(include glslang soxr/src) add_library(boo + lib/inputdev/DeviceBase.cpp include/boo/inputdev/DeviceBase.hpp lib/inputdev/CafeProPad.cpp include/boo/inputdev/CafeProPad.hpp lib/inputdev/RevolutionPad.cpp include/boo/inputdev/RevolutionPad.hpp lib/inputdev/DolphinSmashAdapter.cpp include/boo/inputdev/DolphinSmashAdapter.hpp lib/inputdev/DualshockPad.cpp include/boo/inputdev/DualshockPad.hpp lib/inputdev/GenericPad.cpp include/boo/inputdev/GenericPad.hpp - lib/inputdev/DeviceBase.cpp include/boo/inputdev/DeviceBase.hpp lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp lib/inputdev/IHIDDevice.hpp lib/audiodev/AudioMatrix.hpp diff --git a/lib/audiodev/ALSA.cpp b/lib/audiodev/ALSA.cpp index d8ec2ff..596567f 100644 --- a/lib/audiodev/ALSA.cpp +++ b/lib/audiodev/ALSA.cpp @@ -351,8 +351,8 @@ struct ALSAAudioVoiceEngine : BaseAudioVoiceEngine snd_rawmidi_info_t *info; snd_rawmidi_info_alloca(&info); snd_rawmidi_info_set_device(info, device); - ret.push_back(std::make_pair(snd_rawmidi_info_get_id(info), - snd_rawmidi_info_get_name(info))); + sprintf(name + strlen(name), ",%d", device); + ret.push_back(std::make_pair(name, snd_rawmidi_info_get_name(info))); } } while (device >= 0); @@ -501,12 +501,8 @@ struct ALSAAudioVoiceEngine : BaseAudioVoiceEngine std::unique_ptr newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) { - int status; - char path[128]; - snprintf(path, 128, "hw:%s", name); - snd_rawmidi_t* midi; - status = snd_rawmidi_open(&midi, nullptr, path, 0); + int status = snd_rawmidi_open(&midi, nullptr, name, 0); if (status) return {}; return std::make_unique(midi, true, std::move(receiver)); @@ -514,12 +510,8 @@ struct ALSAAudioVoiceEngine : BaseAudioVoiceEngine std::unique_ptr newRealMIDIOut(const char* name) { - int status; - char path[128]; - snprintf(path, 128, "hw:%s", name); - snd_rawmidi_t* midi; - status = snd_rawmidi_open(nullptr, &midi, path, 0); + int status = snd_rawmidi_open(nullptr, &midi, name, 0); if (status) return {}; return std::make_unique(midi, true); @@ -527,13 +519,9 @@ struct ALSAAudioVoiceEngine : BaseAudioVoiceEngine std::unique_ptr newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) { - int status; - char path[128]; - snprintf(path, 128, "hw:%s", name); - snd_rawmidi_t* midiIn; snd_rawmidi_t* midiOut; - status = snd_rawmidi_open(&midiIn, &midiOut, path, 0); + int status = snd_rawmidi_open(&midiIn, &midiOut, name, 0); if (status) return {}; return std::make_unique(midiIn, midiOut, true, std::move(receiver)); diff --git a/lib/audiodev/MIDIDecoder.cpp b/lib/audiodev/MIDIDecoder.cpp index 5f026c1..8bb3ec2 100644 --- a/lib/audiodev/MIDIDecoder.cpp +++ b/lib/audiodev/MIDIDecoder.cpp @@ -47,6 +47,8 @@ MIDIDecoder::receiveBytes(std::vector::const_iterator begin, uint8_t b; if (a & 0x80) m_status = a; + else + it--; uint8_t chan = m_status & 0xf; switch (Status(m_status & 0xf0))