Using the Behringer CMD PL-1 controller with PowerSDR OpenHPSDR mRX PS
The first thing of any complexity that I tried to do with the source code for PowerSDR OpenHPSDR mRX PS (hereafter referred to as Px) was to try getting my PL-1 controller to work properly. Although M0YGG’s code works quite well with the Hercules controllers, and recognizes the PL-1 and can map its buttons quite well, it doesn’t work with the main wheel or the knobs, because of what it’s expecting about their behavior – i.e. that they behave like the similar things on the Hercules. Let me explain:
The knobs on the Behringer CMD PL-1 behave like wheels more than how Px is expecting knobs to behave, i.e. with limits and values, like a slider. That’s why Px lumps knobs and sliders together.
I changed the code to treat certain functions as wheels instead of knobs, and rewrote the handler code for those functions to properly process the code coming from the PL-1. When you turn a knob, it sends a value of 65 for clockwise and 63 for counterclockwise rotation.
To make this change, two code changes are necessary:
1) In CatCmdDb.cs, change the desired command from ControlType.Knob_or_Slider, to ControlType.Wheel
2) In Midi2CatCommands.cs, modify the code handler for the corresponding command to do the right thing. In the case of the PL-1 wheels, this means increment the current value if rotating cw and decrement if ccw.
You have to make these changes for each Px function you want to map to a knob which is really a mini-wheel. The function then becomes unavailable for mapping to a slider or a normal knob (which the PL-1 doesn’t have anyway). The result is that the mappings won’t work exactly for other controllers, particularly the Hercules. Perhaps later I’ll work on segmenting the code so it applies the right function for the controller being used. But right now my aim is to get the Behringer going.
I also changed the behavior of the VFOA and B tuning so that the main large wheel on the PL-1 behaves correctly, and increments/decrements the frequency in whatever step amount is set by the user. Px was already expecting a wheel-type of control device, but the data values being sent from the PL-1 aren’t the same as those from the Hercules – so I had to change that one too. Instead of triggering on 127 or 1, it now triggers on values less than 64 for counterclockwise rotation, and greater than 64 for clockwise. I limit the upper bound to roughly 40 below or above each value so that the code will ignore it when you touch the top surface of the PL-1’s big wheel, which is touch sensitive, and reports 127/0 for touch/untouch. (Maybe I’ll discover a use for this at some point.) At the moment there is no sensitivity to rotational speed.
Mapping
To map the Main wheel to tuning:
- Go thru the normal MIDI setup to map the big wheel, by rotating it in both directions – but be careful: Do not touch the top surface at all since doing so make it send a 127/0 value as you touch and un-touch it, and screws up the max/min values. Carefully rotate the wheel from its edge both up and down a bit. Don’t try to go very fast, just go fast enough for the min/max values to get below, say, 64, and above, say, 67.
- Map the control to “Change Freq Vfo A”
- Save.
- NOTE: whenever you go back into MIDI setup, avoid touching the big knob’s top surface. That will trigger the 127/0 values and mess up your setting, even if you click “Back” when it presents the setup window. You’ll have to delete the mapping and do it again.
To map the small knobs:
- In MIDI setup, rotate the knob you want as usual, making sure to rotate in both directions. The min should be 63 and the max, 65.
- Choose Wheel as the type of control
- Save
Thus far, I made this change for these controls, which now can be mapped to a PL-1 knob “wheel”:
RX1 AF gain – also VFOA AF gain
RX2 AF gain – also VFOB AF gain
RIT (only works when on)
XIT (works whether on or off – need to look at this later, the code seems to be different)
push/clicking the RIT and XIT knobs zeros them
After each running of Px, MIDI mappings are stored by default in …/AppData/Roaming/FlexRadio Systems/PowerSDR mrx PS/midi2cat.xml
In the source code, the CAT command ID numbers are mapped to their descriptions also in CatCmdDb.cs, where the control type is specified as above in step #1.
73, de W2PA