You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to support the ability to operate multiple MIDI devices simultaneously and unambiguously
I would like the ability to operate on a given MIDI channel and use that channel until the system is told to use a different channel
In the event of recoverable issues in undermidi, the OS MIDI system, or the MIDI devices themselves, I would like to preserve state and not have to redo undermidi/device setup.
In the event of unrecoverable issues where undermidi or the Erlang VM itself has to be completely shutdown and restarted, I would like to resume sessions without having to redo undermidi/device setup.
The first two bullets reduce the number of arguments that need to be passed to MIDI functions for every call. The third bullet can be addressed with maintaining state in ETS. The fourth bullet can be addressed with maintaining state in DETS. These lead to the following capabilities that can be implemented in an undermidi gen_server:
The maintaining of state keyed to MIDI device name
The addition of "current channel" to the device state
The creation of an ETS table upon gen_server startup
Either the use of DETS instead of ETS, or the ability to regularly write ETS to DETS
Tasks:
Name the gen_server (maybe "devices"?)
Define a state data structure isolated per-device
Decide upon the use of ETS, DETS, or both
Create a server API (see below)
Device server functions:
new/1:
takes a string value
errs out if the string provided is not one of those in the result returned from the list-devices function
creates an entry in the state table for the device, if it doesn't exist
creates an Erlang process (probably dynamic OTP child) that is unique for this device (so that the user never needs to pass the device name to any functions when using this PID)
read/0:
dump all state
read/1:
dump state for a specific device
read/2:
get the value for the given key of a specific device
🚫write/1:
replace all state with new state
write/2:
replace all the state of a specific device
🚫write/3:
replace the value associated with the state key of a specific device
Child process functions:
channel/0:
get the current channel (uses read/2
channel/1:
set the current channel (uses write/3)
device/0:
returns the name of the MIDI device used in the creation of this process
Use cases:
The first two bullets reduce the number of arguments that need to be passed to MIDI functions for every call. The third bullet can be addressed with maintaining state in ETS. The fourth bullet can be addressed with maintaining state in DETS. These lead to the following capabilities that can be implemented in an undermidi gen_server:
Tasks:
Device server functions:
new/1
:read/0
:read/1
:read/2
:write/1
:write/2
:write/3
:Child process functions:
channel/0
:read/2
channel/1
:write/3
)device/0
:send/1
:send/3
defined in Create a high-level API that uses midilib'smidibin
for writing directly to MIDI devices #57batch/1
:batch/3
defined in Create a high-level API that uses midilib'smidibin
for writing directly to MIDI devices #57The text was updated successfully, but these errors were encountered: