Wait ... there was a trick for keeping off Sonar to send this Local-Off command.
On
https://www.cakewalk.com/Documentation?product=SONAR%20X2&language=3&help=Playback.35.htmlit says ...
"Local control
You should normally disable the Local Control setting on your master keyboard to prevent notes from being doubled when you play your keyboard. If you disable Local Control, your keyboard sends notes that you play to SONAR, which echoes them to the synthesizer, which plays them only once. When SONAR starts, you can have it send a special MIDI message that attempts to disable Local Control automatically. Most modern synthesizers respond to this message. If yours does not, you will need to disable Local Control every time you turn it on for use with SONAR.
To automatically disable all local control whenever you launch SONAR
1. In the directory where SONAR is installed, double-click on the TTSseq.ini file to open it.
2. In the [Options] section, add the line: SendLocalOff=1
3. Save the file and close it.
4. When you launch SONAR, it automatically sends a Local Off message to your keyboard."
Well ... I use it the other way around and set 2. to "SendLocalOff=0". Check it out and maybe it works for you too.