diff options
author | 2017-07-11 02:31:42 +1000 | |
---|---|---|
committer | 2017-07-11 02:31:42 +1000 | |
commit | c5c3012634f76a15b30637cc687519cb5989667d (patch) | |
tree | ca0b98d7a40cbe4c93eb2c8f6f082ad7c242d42f /src/devices/imagedev/midiin.cpp | |
parent | 7d980227979c30aac9eb527f15c5b893aebea5c6 (diff) |
Cleaned up serial, matrix keyboard and TI-8x link protocol interfaces:
* Switched to delegate timers
- Frees implementations from having to call timer method
- Eliminates risk of ID conflicts with implementations/other interfaces
* Moved save state registration to interface post start
- Plays nicely with device_missing_dependencies exceptions
- Frees implementation from having to call save state registration method
- Improves save state support in devices that neglected to call method
Diffstat (limited to 'src/devices/imagedev/midiin.cpp')
-rw-r--r-- | src/devices/imagedev/midiin.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp index e9301c76504..6086cb48a3e 100644 --- a/src/devices/imagedev/midiin.cpp +++ b/src/devices/imagedev/midiin.cpp @@ -64,27 +64,24 @@ void midiin_device::device_reset() void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - if (id) { - device_serial_interface::device_timer(timer, id, param, ptr); - return; - } - - uint8_t buf[8192*4]; - int bytesRead; - - if (m_midi == nullptr) { - return; - } + if (!id) { + uint8_t buf[8192*4]; + int bytesRead; - while (m_midi->poll()) - { - bytesRead = m_midi->read(buf); + if (m_midi == nullptr) { + return; + } - if (bytesRead > 0) + while (m_midi->poll()) { - for (int i = 0; i < bytesRead; i++) + bytesRead = m_midi->read(buf); + + if (bytesRead > 0) { - xmit_char(buf[i]); + for (int i = 0; i < bytesRead; i++) + { + xmit_char(buf[i]); + } } } } |