44 @link
55 Author https://www.bensmithsound.uk
66 Repository https://github.com/bsmith96/Reaper-Scripts
7- @version 1.3
7+ @version 1.4
88 @changelog
9- + New version of Reaper OSC config bundled
9+ - Removes dependency - bundles functions required within this script
1010 @metapackage
1111 @provides
1212 [main] . > bsmith96_Create marker with name via OSC.lua
13- qosc.lua > bsmith96_qosc.lua
1413 Qlab5.ReaperOSC
1514 @about
1615 # Create marker with name via OSC
4241 * Press play on reaper
4342 * Press "go" on any cue in Qlab
4443 * This should set the custom shortcut for the action to "/qlab/event/workspace/go/name"
45-
46- ### User customisation
47- *
4844]]
4945
5046
@@ -69,22 +65,43 @@ local scriptFolder = scriptDirectory:gsub(scriptName..".lua", "")
6965
7066package.path = scriptFolder .. ' ?.lua'
7167
72- -- Require the osc module
73- local osc = require (' qosc' )
74-
75- -- debug
76- -- local msg = osc.get()
77- -- if msg then
78- -- reaper.ShowMessageBox("OSC address: " .. msg.address .. ", argument: " .. (msg.arg and msg.arg or "(nil)"), "Info", 0)
79- -- else
80- -- reaper.ShowMessageBox("Invalid or no OSC message", "Error", 0)
81- -- end
82-
83-
8468-- =========================================================
8569-- ====================== FUNCTIONS ======================
8670-- =========================================================
8771
72+ local osc = {}
73+
74+ function osc .parse (context )
75+ local msg = {}
76+
77+ -- Extract the message
78+ msg .address = context :match (" ^osc:/([^:[]+)" )
79+
80+ if msg .address == nil then
81+ return nil
82+ end
83+
84+ -- Extract float or string value
85+ local value_type , value = context :match (" :([fs])=([^%]]+)" )
86+
87+ if value_type == " f" then
88+ msg .arg = tonumber (value )
89+ elseif value_type == " s" then
90+ msg .arg = value
91+ end
92+
93+ return msg
94+ end
95+
96+ function osc .get ()
97+ local is_new , name , sec , cmd , rel , res , val , ctx = reaper .get_action_context ()
98+ if ctx == nil or ctx == ' ' then
99+ return nil
100+ end
101+
102+ return osc .parse (ctx )
103+ end
104+
88105-- =========================================================
89106-- ====================== UTILITIES ======================
90107-- =========================================================
0 commit comments