|
|
|
10-12-2019, 12:08 PM
|
#1
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Docs: How2StuffMIDIMessage-function and a request to extension-developers
A user had a request for Ultraschall, which involved sending MIDI-messages.
And one of the things I looked at to solve the request, was the function StuffMIDIMessage.
So, long story short: I documented, how StuffMIDIMessages works, so you can actually use it to its fullest.
One of the interesting things is, that Reaper doesn't differentiate between MIDI and keyboad-shortcuts, means,
you can adress them both, as long as you choose the right message.
That means, you can send MIDI-messages, like notes, cc, pc, pitchbend, including velocity to different areas.
And even more, you can send MIDI-messages to be treated as "Actions started by MIDI-shortcut" to Reaper, too.
Another funfact:
you can send midi AND computer-keyboard-shortcuts to the Add Shortcuts/Find Shortcuts-dialogs of the Actionslist.
For more information, read the full documentation over here:
https://github.com/Ultraschall/ultra...ssage-docs.txt
To get all possible MIDIMessages, have a look into this ini-file, where I tried to include all of them:
https://raw.githubusercontent.com/Ul...ch_Windows.ini
They are stored like:
modifier_keynotevalue_velocity=shortcut in plaintext
as some are not printable characters, there's also a second one:
modifier_keynotevalue_velocity_StringAsHex=shortcu t as hexadecimalstring(convert it back into ascii-values to get the original text)
They should be fairly complete.
Velocities are just stored with 1, with the exception for modifier 255 and key_note_value 232, who store the MediaKbd-shortcuts(read the docs for more info about that).
And now my request:
As StuffMIDIMessage allows sending keyboard and MIDI-shortcut to the Add Shortcuts-Dialog, I would love to request, that someone of you exposes Reaper's own functions: CountActionShortcuts, DeleteActionShortcut, DoActionShortcutDialog, GetActionShortcutDesc
With them, I could code functions, who could add shortcuts via scripts.
And not only that: it would be possible to code stuff like keyboard-layout-presets.
So, let's say, you have three screensets, one for Recording, one for Mixing, one for Video, changing between them could also change the keyboard-layout to the shortcuts more needed for the specific usecase.
Would be fiddly to code, but possible, assuming, the aforementioned functions were exposed somehow.
Last edited by Meo-Ada Mespotine; 10-12-2019 at 12:19 PM.
|
|
|
10-14-2019, 03:13 AM
|
#2
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
Thanks again Mespotine! I had to fiddle with this for the first time and i couldnt have succeeded without your detailed documentation.
You rock
|
|
|
10-16-2019, 03:03 AM
|
#3
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Good detective work there!
The only way to get a KbdSectionInfo pointer appears to be by using SectionFromUniqueID. I don't know how this works (is it a new unique ID or is there a list somewhere?) so if you or somebody else knows I could could wrap the functions up for you.
edit: in fact, I could just wrap that one up too and forget about not having a clue what it does!
|
|
|
10-16-2019, 03:27 AM
|
#4
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Quote:
Originally Posted by mespotine
A user had a request for Ultraschall, which involved sending MIDI-messages.
And one of the things I looked at to solve the request, was the function StuffMIDIMessage.
So, long story short: I documented, how StuffMIDIMessages works, so you can actually use it to its fullest.
One of the interesting things is, that Reaper doesn't differentiate between MIDI and keyboad-shortcuts, means,
you can adress them both, as long as you choose the right message.
That means, you can send MIDI-messages, like notes, cc, pc, pitchbend, including velocity to different areas.
And even more, you can send MIDI-messages to be treated as "Actions started by MIDI-shortcut" to Reaper, too.
Another funfact:
you can send midi AND computer-keyboard-shortcuts to the Add Shortcuts/Find Shortcuts-dialogs of the Actionslist.
For more information, read the full documentation over here:
https://github.com/Ultraschall/ultra...ssage-docs.txt
To get all possible MIDIMessages, have a look into this ini-file, where I tried to include all of them:
https://raw.githubusercontent.com/Ul...ch_Windows.ini
They are stored like:
modifier_keynotevalue_velocity=shortcut in plaintext
as some are not printable characters, there's also a second one:
modifier_keynotevalue_velocity_StringAsHex=shortcu t as hexadecimalstring(convert it back into ascii-values to get the original text)
They should be fairly complete.
Velocities are just stored with 1, with the exception for modifier 255 and key_note_value 232, who store the MediaKbd-shortcuts(read the docs for more info about that).
And now my request:
As StuffMIDIMessage allows sending keyboard and MIDI-shortcut to the Add Shortcuts-Dialog, I would love to request, that someone of you exposes Reaper's own functions: CountActionShortcuts, DeleteActionShortcut, DoActionShortcutDialog, GetActionShortcutDesc
With them, I could code functions, who could add shortcuts via scripts.
And not only that: it would be possible to code stuff like keyboard-layout-presets.
So, let's say, you have three screensets, one for Recording, one for Mixing, one for Video, changing between them could also change the keyboard-layout to the shortcuts more needed for the specific usecase.
Would be fiddly to code, but possible, assuming, the aforementioned functions were exposed somehow.
|
Would a command line program sendmidi.exe help, as those exist as well?
|
|
|
10-16-2019, 03:39 AM
|
#5
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Quote:
Originally Posted by mespotine
With them, I could code functions, who could add shortcuts via scripts.
And not only that: it would be possible to code stuff like keyboard-layout-presets.
So, let's say, you have three screensets, one for Recording, one for Mixing, one for Video, changing between them could also change the keyboard-layout to the shortcuts more needed for the specific usecase.
Would be fiddly to code, but possible, assuming, the aforementioned functions were exposed somehow.
|
I guess this would be also compatible with this concept, saving everything as external .txt files, see https://forum.cockos.com/showthread.php?t=226038
|
|
|
10-16-2019, 12:38 PM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Wouldn't help, as sending Midi messages isn't the problem in Reaper.
Opening the Add Shortcut To Action-Dialog is my main problem. All other attempts using SWS or JS-extension failed.
|
|
|
10-17-2019, 12:13 AM
|
#7
|
Human being with feelings
Join Date: Aug 2011
Posts: 522
|
So..this stuffMIDImessage cant send Sysex right?
|
|
|
10-17-2019, 01:40 PM
|
#8
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Here's an extension with those functions in it, plus SectionFromUniqueID to get the pointer. You need to pass a size of the string buffer to the last parameter of GetActionShortcutDesc, so maybe 25 or whatever it takes.
reaper.US_*
I should say big props to cfillion for his metaprogramming magik API wrapping code. It works really well and is super easy to use!
|
|
|
10-21-2019, 09:23 AM
|
#9
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Ooohhh...nice Thank you very much.
Would it be possible sharing the code as well and would it be ok, if we add your code to our own plugin(which will at some point become part of my Ultraschall-API as well)?
Oh, and where did you find cfillions code? I would love to add that as useful resource into the Reaper-Internals-thread.
|
|
|
10-21-2019, 09:24 AM
|
#10
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by reapero
So..this stuffMIDImessage cant send Sysex right?
|
Don't know. I'm not that familiar with MIDI in general, but Notes, CC, PC and Pitch works without a problem. Beyond that, I have no idea.
|
|
|
10-23-2019, 02:20 PM
|
#11
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
No worries, it's a CMake project and I'm having a bit of trouble getting it working on Linux. I'll post it when I've worked that out!
|
|
|
10-26-2019, 09:37 AM
|
#12
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
It turned out it was just a mismatch between the reaper_plugin_functions files with the older Linux installation, here's a link to the project...
https://mega.nz/#!ipMjXCSY!MWF5Cs7Io...so1MgxKBCT9YVY
You can Open Folder in VS2019, select the CMakeLists.txt file as the Startup Item and build directly from there (or just use CMake normally).
For Linux builds using VS2019:
- install openssh, build-essential, cmake 3.11 on remote Linux
- run "sudo service ssh start" after logging on to Linux
- in VS, add the remote Linux machine up in Tools->Cross Platform
Now just select Linux-x64-Release (or Debug) from dropdown in VS to build.
|
|
|
10-28-2019, 09:47 AM
|
#13
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Awesome! Thanks, you're a hero Snooks
Does this also work on Mac?
|
|
|
10-28-2019, 02:45 PM
|
#14
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
No worries, the code will work on macOS but the build file needs set up for it. I don't have "Apple branded hardware" so can't set it up and test it without breaking the law or paying money so you'll need to count me out on that one.
|
|
|
10-29-2019, 07:00 AM
|
#15
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
No problem, we'll try to make it work on Mac.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 08:04 PM.
|