cpyarger / obs-midi

Use MIDI devices to trigger events in OBS and vice versa
https://obs-midi.org
GNU General Public License v2.0
168 stars 20 forks source link

OBS MIDI ignores midi "value" with Program Change #136

Open tomvanduuren opened 3 years ago

tomvanduuren commented 3 years ago

Incompatibility with the Roland V-1HD midi controller.

The Roland V-1HD midi video controller can switch HDMI inputs. A HDMI input switch also outputs a MIDI change. The MIDI change is a value change with the same note/control. So only the value changes: (Input 1 = Value 0, Input 2 = Value 1, Input 3 = Value 2, Input 4 = Value 3)

Platform

Operating system and version: Windows 10 Home - 20H2 OBS Studio version: OBS - 26.1.1.

Expected Behavior

Trigger on change of midi "value" with "program change" using the same note/control. Example: MIDI channel 1: Program Change - Note/control 127 - Value 1 Program Change - Note/control 127 - Value 2 Program Change - Note/control 127 - Value 3

Current Behavior

No trigger change on value change with the same note/control being used. ("use value in trigger**" is enabled)

Steps to Reproduce

  1. Add mapping - Change scene -> Midi settings: Program Change - Note/control 127 - Value 1
  2. Add mapping - Change scene -> Midi settings: Program Change - Note/control 127 - Value 2

Additional information

none

cpyarger commented 2 years ago

This may be an oversight, as I don't have any device that uses program change by default I will be looking into it.

robrob2142 commented 2 years ago

You should just change the "value" with the "note/cc", as programm changes do not have a value, but are only used for switching stuff. Value should therefore be grayed out.

robrob2142 commented 2 years ago

My suspision was true, you implemented Programm Changes wrongly. They are 2 Byte: first byte defining Programm Change Type<< 4 | Channel, and second being the PC number.

Inside MidiMessage I changed behaviour with programm change messages: MidiMessage::get_midi_value() to return 0xFF to avoid crashing and MidiMessage::get_midi_note_or_control() to read from the second byte[1]. It now works flawlessly.

You should update that to be able to use programm changes effectively. I might just commit that, as it's such a minute change.

cpyarger commented 2 years ago

submit a pull request then 😸

Synthetic-Future commented 2 years ago

Ran into a similar issue with my MPK, still looking for a solution.

When I send a program change OBS MIDI will learn it as a "program change " with note/control "127" and "value" -whatever program change I send-. So it records the velocity as the program change number and the program change number as the value. This would be okay except that OBS MIDI doesn't listen for values.

Is there some way to get OBS MIDI to list the actual program change value as note/control and the velocity as value (so switch those 2 values around). I am no coder so I don't really know how to solve this issue myself and OBS MIDI doesn't allow for manual entry sadly.