Instead of attempting to package exactly one MIDI message in each call to
MidiReceiver.onPost(), we now pass messages as a raw stream of bytes.
This means we may now receive multiple MIDI messages in MidiReceiver.onPost().
We make this change to avoid the complexity of taking the single message approach
with SysEx and realtime messages. This shifts some of the burden of parsing
MIDI messages to the client application. But the parsing is best handled in the
application anyway, rather than having the framework impose its own policy
on how the messages are parsed.
Change-Id: Idb6c200037f827cc618bc7d9455a7aa864b494a7
Clear array entry when MidiOutputPort closed and EndOfStream
is detected.
Change-Id: I47e38ac3a46039d950c66381eac55e2dd10bf9fb
Signed-off-by: Phil Burk <philburk@google.com>
- fix off by one error that caused failure handling one byte messages
- poll thread now terminates properly in UsbMidiDevice
- fix cleanup logic in MidiDeviceServer
Change-Id: I0c13a98b6542cfb271b51678e81d1822c8da2985
MIDI ports are now implemented as file descriptors directly between the sender
and receiver, so the MidiService is no longer in the message path.
To facilitate the above, each port has its own file descriptor, rather than multiplexing
all ports on a device through a single socket.
Added a new class MidiDeviceServer, which is used by implementors of MIDI devices.
This replaces the MidiVirtualDevice class (which only was included in changes that were reviewed but never submitted).
The USB MIDI implementation has moved from the MIDI service to the USB service.
The USB MIDI implementation uses MidiDeviceServer as its interface, so we now have a common
interface for all MIDI device implementations.
Change-Id: I8effd1583f344beb6c940c3a24dbf20b477a6436
Add MidiInputPort and MidiOutputPort classes (with MidiPort base class)
A MidiDevice can now have multiple input and output ports.
Multiple ports are currently supported only for virtual devices, USB support coming later.
Change-Id: Ib55076aa1374aa46ae4ae76ad93bd717df6d7e21
Still to do:
Add MidiInputPort and MidiOutputPort classes
Schedule sending MIDI events in the future
Security/permissions
Reconsider interface for virtual devices
Look into performance optimizations
Change-Id: I9b7d63b196996a04be0a830efa913043da1328a8