Closed Timebutt closed 2 months ago
In the directory, apart from the Node.js code that facilitates communication, there are files in the 'ma3 files' folder—Lua plugins in .xls format, as well as a show file for MA3 where these plugins are used and can be easily copied or edited.
Plugin v3 local function Read_Fader_Send_OSC_nn(executor_nr) local FaderDataStructure = {} FaderDataStructure.token = "FaderMaster" FaderDataStructure.faderDisabled = false local my_ex_obj_1 = GetExecutor(executor_nr)
if my_ex_obj_1 == nil then
local osc_value = -1
Cmd("SendOSC 2 \"/Fader"..executor_nr..",i,"..osc_value.."\"")
local osc_value = 0
Cmd("SendOSC 2 \"/Key"..executor_nr..",i,"..osc_value.."\"")
else
local fader_current_Value = my_ex_obj_1:GetFader(FaderDataStructure)
local exact = fader_current_Value * 163.68
local osc_value = tonumber(string.format("%.1f", exact))
--local osc_value = math.floor(exact)
Cmd("SendOSC 2 \"/Fader"..executor_nr..",i,"..osc_value.."\"")
local exec_str = "Exec " .. executor_nr
local exec = ObjectList(exec_str)
local seq = exec[1]:GetAssignedObj()
if seq:HasActivePlayback() then
local osc_value = 1
Cmd("SendOSC 2 \"/Key"..executor_nr..",i,"..osc_value.."\"")
else
local osc_value = 0
Cmd("SendOSC 2 \"/Key"..executor_nr..",i,"..osc_value.."\"")
end
end
end
local function main() local executor_table = {201,202,203,204,205,206,207,208,301,302,303,304,305,306,307,308} while true do coroutine.yield(0.5) for i, name in ipairs(executor_table) do Read_Fader_Send_OSC_nn(name) end end end
return main
plugin v4
local executor_table = {201,202,203,204,205,206,207,208,301,302,303,304,305,306,307,308} local osc_config = 2 local history_fader, history_status = {}, {} local osc_template = 'SendOSC %i "/%s%i,i,%i"' local enabled = false local Printf, Echo, GetExecutor, Cmd, ipairs, mfloor = Printf, Echo, GetExecutor, Cmd, ipairs, math.floor
local function send_osc(etype, exec_no, value) -- Printf(osc_template:format(osc_config, etype, exec_no, value)) Cmd(osc_template:format(osc_config, etype, exec_no, value)) end
local function poll(exec_no) local exec = GetExecutor(exec_no) local value = exec and mfloor(exec:GetFader{} * 163.68) or -1 local last_value = history_fader[exec_no] local status = exec and exec.Object and exec.Object:HasActivePlayback() and 1 or 0 local last_status = history_status[exec_no] if value ~= last_value then send_osc('Fader', exec_no, value) history_fader[exec_no] = value end if status ~= last_status then send_osc('Key', exec_no, status) history_status[exec_no] = status end end
local function mainloop() while enabled do for _, exec_no in ipairs(executor_table) do poll(exec_no) end coroutine.yield(0.5) end end
local function maintoggle() if enabled then enabled = false else enabled = true history_fader, history_status = {}, {} mainloop() end end
return maintoggle
Odd, I only find two .xml
files in the plugin
folder (https://github.com/ArtGateOne/ma3bcf2000/tree/main/ma3bcf2000/ma3_files/plugin). I'll add the code you provided in the MR I'm doing ;)
Edit: my bad, I didn't know you can directly edit them in MA3 and see the source code that way as well. I'm new to plugins in MA3 so still finding my way around. Thanks for the heads-up!
What is the difference between the two plugins? The first one, after being launched, sends OSC information about the status of buttons and faders every second, while the second version (modified by Andreas from the MA forum) only sends information when the state of a specific executor or fader changes.
Ok sorry for dropping another question, but I cannot seem to get the feedback to work on my BCF2000. I have started the device in Mackie mode (by holding down the second button from the top row of buttons while powering the device on), and then selecting mode u-1
using the first rotary encoder. Am I supposed to configure anything else? I'm logging everything in the main JS script, and I can see OSC
messages coming in from MA3 with either plugin enabled, it just seems my BCF2000 isn't responding to messages being sent (I logged right above the line where it actually moves the fader and it's definitely doing it).
Any time I move a fader on the BCF2000 up, it comes down shortly after (half a second). From the looks of it, the device is either in the wrong operating mode, not getting the messages or maybe configured incorrectly. Do you know what might be going on?
Edit: looks like my BCF2000 is just bad and has a defective USB interface as some other people seem to have online. In other software like Cubase I also can't get feedback through the USB device (one-way works great though). If I use the device in standalone mode with a different MIDI interface, all seems to work fine :/
As I mentioned earlier, my solution consists of two 'programs.' One of them is the plugin that sends OSC data with information about the state of executors and faders. The second 'program' is, of course, the Node.js code that receives OSC data and converts it into MIDI notes for the BCF2000—and, of course, it does the same in reverse, decoding MIDI notes into OSC messages, which it sends to the MA3 software.
The fact that the fader returns to position 0 means that the device did not receive a feedback message with a different value—this is correct behavior in Mackie mode.
The Node.js code should be running in the background. If the process window closes, it means there's an error, usually due to a different version of Node.js than the one I generated the code with, or the BCF2000 is being used by another program. If the BCF2000 is selected in the MA3 MIDI settings, it needs to be disabled there.
Another reason could be incorrect OSC settings. Check to make sure that the LAN interface is selected (it should be localhost 127.0.0.1) and that the IN and OUT ports are correctly entered, with the appropriate options for sending or receiving messages checked. If the LAN interface field in the OSC settings is empty or set to something else, correct it and then restart MA3 for it to start functioning.
You can also take a look at a similar solution for the APC mini. https://www.youtube.com/watch?v=TXAaK268eP4
pon., 19 sie 2024 o 21:47 Nils Tijtgat @.***> napisał(a):
Ok sorry for dropping another question, but I cannot seem to get the feedback to work on my BCF2000. I have started the device in Mackie mode (by holding down the second button from the top row of buttons while powering the device on), and then selecting mode u-1 using the first rotary encoder. Am I supposed to configure anything else? I'm logging everything in the main JS script, and I can see OSC messages coming in from MA3 with either plugin enabled, it just seems my BCF2000 isn't responding to messages being sent (I logged right above the line where it actually moves the fader and it's definitely doing it).
Any time I move a fader on the BCF2000 up, it comes down shortly after (half a second). From the looks of it, the device is either in the wrong operating mode, not getting the messages or maybe configured incorrectly. Do you know what might be going on?
— Reply to this email directly, view it on GitHub https://github.com/ArtGateOne/ma3bcf2000/issues/1#issuecomment-2297320064, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQOM37T6INBHHYXBQ4HYGLZSJDTHAVCNFSM6AAAAABMXMT752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJXGMZDAMBWGQ . You are receiving this because you commented.Message ID: @.***>
-- Pozdrawiam Krzysztof Korzeniowski
Hey @ArtGateOne, thanks for the explanation. I was already very deep into debugging the entire stack and understand the architecture very well. What was throwing me off, is that the BCF2000 simply does not work over USB on an ARM powered MacBook. Reading MIDI from it works well, but any form of feedback over the USB bus is impossible (as I've meanwhile read online). On my Windows for instance, everything works fine immediately. Frustrating and confusing, but looks like I'll have to upgrade to an xTouch to get proper ARM support. What does work on an ARM Mac is using an external MIDI device and connecting it to the BCF2000 MIDI ports while running it in standalone mode. Hoping this might help someone in the future :/
Is it really possible that it doesn't work on a MacBook? It seems to me that there shouldn't be any issues with this. Does the BCF2000 also not receive MIDI notes in default mode (not Mackie) from any other program?
wt., 20 sie 2024 o 23:15 Nils Tijtgat @.***> napisał(a):
Hey @ArtGateOne https://github.com/ArtGateOne, thanks for the explanation. I was already very deep into debugging the entire stack and understand the architecture very well. What was throwing me off, is that the BCF2000 simply does not work over USB on an ARM powered MacBook. Reading MIDI from it works well, but any form of feedback over the USB bus is impossible (as I've meanwhile read online). On my Windows for instance, everything works fine immediately. Frustrating and confusing, but looks like I'll have to upgrade to an xTouch to get proper ARM support. Hoping this might help someone in the future :/
— Reply to this email directly, view it on GitHub https://github.com/ArtGateOne/ma3bcf2000/issues/1#issuecomment-2299779454, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQOM35LPYWMCHKXTQEFJNTZSOWXRAVCNFSM6AAAAABMXMT752VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZG43TSNBVGQ . You are receiving this because you were mentioned.Message ID: @.***>
-- Pozdrawiam Krzysztof Korzeniowski
I've done extensive debugging using different applications (Ableton, Cubase, ...), sending it MIDI from different sources and nothing seems to work. Online I've read in multiple places that it's the USB driver implementation that is not compatible with ARM based architectures. For reference: the much newer xTouch
received new firmware when M1 Macs entered the market to be able to support that range of CPUs. Not to worry: the USB MIDI interface approach works great so it's fully functional for me now ;)
I'm currently upgrading the script you wrote to a more modern JavaScript implementation (using TypeScript, ESM, ...), along with an upgrade that will not require other users to download and install NodeJS (there are ways to build and distribute tiny binaries). While debugging however, I ran into a few issues with the MA3 plugins that I would like to resolve, but this repository only has the built plugins, not the LUA source code.
Would it be possible to add the LUA source code to this repository so other users can learn from, or modify those plugins when needed?