midi: pc_offset option
This commit is contained in:
parent
bc1e6e13d1
commit
3d9dd22a05
3 changed files with 13 additions and 2 deletions
|
|
@ -11,6 +11,7 @@
|
|||
- added `/STATE/[GET|SET|STORE|RECALL]` methods
|
||||
- midi
|
||||
- print port name in debug messages
|
||||
- added `pc_offset` option to act as if program change numbers where between 1 and 128
|
||||
|
||||
## 0.45.7
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ When running the app, the `-m / --midi` switch must be set; it accepts the follo
|
|||
- `list`: prints the available MIDI ports to the console; numbers in the first column may be used for `input`/`output` definition below
|
||||
- `device_name:input,output`: connect to midi ports `input` and `output`; osc messages sent to target `midi:device_name` will be processed as midi events; Multiple devices can be declared
|
||||
- `sysex`: parse incomming system exclusive messages (disabled by default)
|
||||
- `pc_offset`: send program changes with a `-1` offset to match some software/hardware implementations
|
||||
|
||||
*Linux only:*
|
||||
|
||||
|
|
@ -76,10 +77,10 @@ A fader might be configured as follows in order to send a MIDI control message (
|
|||
Program change event.
|
||||
|
||||
- `channel`: integer between 1 and 16
|
||||
- `program`: integer between 0 and 127
|
||||
- `program`: integer between 0 and 127*
|
||||
|
||||
!!! note
|
||||
Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on.
|
||||
\* Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on. Enable the `pc_offset` option to make Open Stage Control behave this way.
|
||||
|
||||
#### `/pitch channel pitch`
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ from utils import *
|
|||
if 'list' in argv:
|
||||
list()
|
||||
|
||||
# option: act as if displayed program is between 1-128 instead of 0-127
|
||||
PROGRAM_CHANGE_OFFSET = 'pc_offset' in argv
|
||||
|
||||
inputs = {}
|
||||
outputs = {}
|
||||
|
||||
|
|
@ -83,6 +86,9 @@ def create_callback(name):
|
|||
if mtype == NOTE_OFF:
|
||||
message[2] = 0
|
||||
|
||||
elif mtype is PROGRAM_CHANGE and PROGRAM_CHANGE_OFFSET:
|
||||
message[-1] = message[-1] + 1
|
||||
|
||||
for data in message[1:]:
|
||||
osc['args'].append({'type': 'i', 'value': data})
|
||||
|
||||
|
|
@ -174,6 +180,9 @@ def send_midi(name, event, *args):
|
|||
elif mtype is PITCH_BEND:
|
||||
args = args[:1] + [args[1] & 0x7f, (args[1] >> 7) & 0x7f] # convert 0-16384 -> 0-127 pair
|
||||
|
||||
elif mtype is PROGRAM_CHANGE and PROGRAM_CHANGE_OFFSET:
|
||||
args[-1] = args[-1] - 1
|
||||
|
||||
m = midi_message(mtype, *args)
|
||||
|
||||
if m is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue