Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle Mode for buttons using Learn mode or way to write actions into map #13

Open
lazlooose opened this issue Apr 23, 2020 · 21 comments
Open
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@lazlooose
Copy link

The issue is that using the learn function in Reaper the default button behaviour in the mapping causes two triggers (one for button pushed and one for button released) resulting in a double trigger rather than a single. If the button could be set to a toggle mode (?) so that it only sends one trigger (pushed) then the learn mode would be more useful.

However this way of doing things does not give access to LED on/off on the button, so, alternatively....

it is possible to write in actions with:

ACTION i/action/@ where the output /action 23454 or /action/23454 would trigger action number 23454

But with the map structure we have how can get the above output instead of /button/command/utility_misc_meterselect_automationenable/Assign [f] 1.000000 ?
Ideally both options would be great cause it seems Reaper does not send LED states for all actions and the learn function is easy to use.

@lazlooose lazlooose changed the title Toggle Mode for buttons or way to write actions into map Toggle Mode for buttons using Learn mode or way to write actions into map Apr 23, 2020
@phunkyg
Copy link
Owner

phunkyg commented Apr 23, 2020

This is actually good news as you've arrived in the same place that @Disruptormon got to with this.
Short story: The ACTION reaper.osc mapping sucks and never seems to work.
The 'toggle' functionality exists IIRC to do exactly what you describe, only send the 'On' action to OSC and ignore the 'Off' signal.
I'll have a hunt through and see if I can catch up to where DM and PW got to on this one.

Ultimately the reaper learn function is then eminently useable and probably the best way of doing the userspace mapping. There was talk of including an action mapping file for reaper too on this basis, just to get people started.

@phunkyg
Copy link
Owner

phunkyg commented Apr 23, 2020

So, you can activate toggle on any button by editing the map. Here's an example:

                            0x00: {
                                'Address': 'Mix',
                                'Zone': 'Window',
                                'LED': True,
                                'Toggle': True,
                                'CmdClass': 'C24buttonled'
                            },

including the 'Toggle' attribute and setting it to true should tell that button to behave as a Toggle and only send OSC for 'ON'.

@phunkyg phunkyg self-assigned this Apr 23, 2020
@phunkyg phunkyg added the question Further information is requested label Apr 23, 2020
@lazlooose
Copy link
Author

Cool! that was fast! I will try that out.

curious to know why the action mapping doesn't work. it would seem that that would give us access to LED states if they are available from Reaper.

@lazlooose
Copy link
Author

lazlooose commented Apr 23, 2020

I am wondering if for the action mapping would it be possible to add a similar tag labeled Action that if > 0 then would cause the output to be '/action 12345' (for ACTION i/action in .reaperOSC) or '/action/12345' (for ACTION t/action/@ in .reaperOSC) instead of the usual output

like

                            0x00: {
                                'Address': 'Mix',
                                'Zone': 'Window',
                                'LED': True,
                                'Toggle': True,
                                'CmdClass': 'C24buttonled',
                                'Action': 40132   ## int = any action variable not sure actually if Reaper is expecting an int or a string here
                            },

not sure how to code it but could be a way to continue testing that functionality.

@phunkyg
Copy link
Owner

phunkyg commented Apr 23, 2020

Yep, tried all sorts of variations on the action keyword and reaper seemed to ignore them all.
Getting reaper itself into a simpler test harness might be useful so you could just format osc and send it until we got a valid reponse.

@lazlooose
Copy link
Author

strange based on what I read on the cockos forum a bunch of people have got this working. what kind of test harness are you proposing?

@lazlooose
Copy link
Author

lazlooose commented Apr 24, 2020

I downloaded sendosc ( https://github.com/yoggy/sendosc ) to test out messages I was able to get Reaper to respond to an action command by sending:

./sendosc 127.0.0.1 9125 /action i 40280
from my terminal

usage : sendosc dst_host dst_port path [[type] [param]] ...

This mute/unmutes all selected tracks and it works fine using the unmodified procontrol.ReaperOSC file from the DEV_OtherDevices branch and I left all the settings the same aside from the ip address since it wasn't coming from the pi

Couldn't we get procontrolosc.py to send a similar message?

@lazlooose
Copy link
Author

lazlooose commented Apr 24, 2020

I have tested the toggle function by adding
'Toggle': True,
into procontrolmap.py and it did not make any difference in the behaviour sadly.

it is still sending:

/button/command/Transport/Go To End [f] 1.000000 
/button/command/Transport/Go To End [f] 0.000000

I was trying to use this button to go from one marker to the next but the on off sending s still causing a double trigger.

@phunkyg
Copy link
Owner

phunkyg commented Apr 24, 2020

I downloaded sendosc ( https://github.com/yoggy/sendosc ) to test out messages I was able to get Reaper to respond to an action command by sending:

./sendosc 127.0.0.1 9125 /action i 40280
from my terminal

usage : sendosc dst_host dst_port path [[type] [param]] ...

This mute/unmutes all selected tracks and it works fine using the unmodified procontrol.ReaperOSC file from the DEV_OtherDevices branch and I left all the settings the same aside from the ip address since it wasn't coming from the pi

Couldn't we get procontrolosc.py to send a similar message?

This is interesting, does that utility provide a dump of the raw OSC conversation?
The other possibility is this got fixed in reaper in the last few years.
There is another format in the reaper OSC file where the action number is part of the address, can you try that one?

@phunkyg
Copy link
Owner

phunkyg commented Apr 24, 2020

I have tested the toggle function by adding
'Toggle': True,
into procontrolmap.py and it did not make any difference in the behaviour sadly.

it is still sending:

/button/command/Transport/Go To End [f] 1.000000 
/button/command/Transport/Go To End [f] 0.000000

I was trying to use this button to go from one marker to the next but the on off sending s still causing a double trigger.

Ugh, looks like this is over in the Release branch and somehow got done AFTER this Otherdevices branch was created.

Sorry dude, it looks like I am going to have to merge all this mess before you can get that particular function.

EDIT: had a go at merging up from the Release branch. Unfortunately the edits are in the control24 osc code!
There is an outstanding job to do a proper set of base classes and overrides for procontrol where needed. I was hoping to get away with this for a bit. I'll mull it over. It might be easier just to copy changes between the 2 files for a bit longer.

@lazlooose
Copy link
Author

This is interesting, does that utility provide a dump of the raw OSC conversation?
The other possibility is this got fixed in reaper in the last few years.
There is another format in the reaper OSC file where the action number is part of the address, can you try that one?

this is the only option but you can look at the source code and it appears to send messages the same way as procontrolosc but with the 'address' of /action folwed by an integer (the action ref no)

@lazlooose
Copy link
Author

that sucks. is it simple enough that I could fish it out from the release code? I have been trying to learn python but still early days, working through the syntax and such.

@lazlooose
Copy link
Author

well I had a go at it and got the toggle mode working by comparing the Release control24osc file and the procontrolosc. Interestingly the code that got the toggle working finally was not in the release code but in a pull from DEV_Mapping which was later removed:

abfa443

I wasn't super scientific about it and I made a bunch of other changes based on control24osc in an effort to make them as similar as possible without undoing the scrib strip enhncement so I don't know if it was just that addition that got it working but the toggle mode is working now. I am trying to experiment with the action commands also but have so far not got that working.

@lazlooose
Copy link
Author

Ok actually after a little reading I got the /action commands working! you can Specify {'Action': 23412} at the button's map and reaper will respond appropriately!

I will create a pull request so you can review it as I most certainly messed around with things I probably shouldn't have, but it does work...

@lazlooose
Copy link
Author

lazlooose commented Apr 25, 2020

yeah something I did in there messed up some stuff for the procontrol, the action and toggle stuff works but the transport (play and so on don't respond anymore and if you move the jog wheel procontrolosc.py crashes with:

20-04-25 08:45:58,402 procontrolosc   DEBUG   thread_c24_client       _desk_to_daw    1288    {'CmdClass': 'C24vpot', 'TrackNumber': 28, 'addresses': ['/', 'track', '/', 'c24vpot', '/', '29'], 'ChildB$
2020-04-25 08:45:58,403 procontrolosc   WARNING thread_c24_client       get_track       327     No track exists with index 28
2020-04-25 08:45:58,403 procontrolosc   ERROR   thread_c24_client       _manage_c24_client      1420    C24 client Uncaught exception
Traceback (most recent call last):
  File "/home/pi/ReaControl24/procontrolosc.py", line 1413, in _manage_c24_client
    self._desk_to_daw(datarecv)
  File "/home/pi/ReaControl24/procontrolosc.py", line 1307, in _desk_to_daw
    inst = getattr(track or self.desk, cmd_class.lower())
AttributeError: 'ProCdesk' object has no attribute 'c24vpot'

makes sense though I suppose. I did change some stuff relating to command class if I remember correctly....

@phunkyg
Copy link
Owner

phunkyg commented Apr 25, 2020

That's fine. I did merge the release branch changes upward and I could see the toggle stuff was in there.

This landed it into the c 24 osc file but the 2 are still somewhat different to each other.

I started a (overdue) process of making common base classes for all devices and allowing for override versions for specific devices.

Now that the basic multi device changes seem to be working for you this is the next right step to allow for easy customisation inside the classes.

This will put the 2nd scribble strip bank and such within reach.

I picked up in this project to learn more. python, I was also pretty new to it. It's great you're having a go. Don't worry about doing the wrong thing as git provides the safety net.
Do you have a decent IDE?
I'd recommend pycharm for this as it is the only one I could find capable of debugging. the subprocesses. They make git easier to deal with too.

I'm also still working through the map. Those DSP banks need separating with a match or mask but I couldn't work out the right binary work to do it last I looked. You were dead right about PC starting from 0x08 though.

@lazlooose
Copy link
Author

cool! I am using VS Code right now with the python plug in. but I will take a look at pycharm too.

There is a third set of eight scribble strips in the DSP section. One for each DSP section 1-8. I could easily get you the addresses for that area too but I don't want to throw too much at you.

let me know if there is other stuff I can do to help out.

@phunkyg phunkyg added the bug Something isn't working label Apr 26, 2020
@phunkyg
Copy link
Owner

phunkyg commented Sep 9, 2020

Looking through these issues and such, toggle should be available now and I did put something in for allowing action mappings in the .OSC file. Could you try these things again to check where we are?

@lazlooose
Copy link
Author

hey, @phunkyg sorry I got distracted and then my pi broke, I will be back to testing soon though!

@tubbybassengineer
Copy link

Hey @phunkyg I recently purchased a control 24 and have started using your script. So far it’s working but with the same issues as mentioned above. Only certain buttons will switch to toggle mode when I edit them in the script. Also, the modifier section and the master fader button, does not work. One other bug is when working in large projects the meters and clock stop in place and the output of the is showing waiting for desk ack. After a random amount of time everything will comeback but all of the meter and fader data will catch up. If I touch a fader or control it will kick back in as well. Projects of 30 tracks and lower don’t have this issue. The larger ones (100 or more tracks) really have an issue. I tried the v-control pro stuff and it doesn’t have this issue but it doesn’t implement most of the console functions and is basically a machine control. I believe the issue may be in the either in the banking function or possibly a timing issue in one of the scripts. Reaper sends all track data unless a bank number is selected. If reaper receives a bank number it will only send data for the number of tracks listed in the reaper osc file. So instead of bank right and left, would it be possible to add a variable “Bank_Number” and have the bank buttons add and subtract by one. Also, it might be nice to have the modifiers affect the number pad. Ie... no mod=regions, shift=marker, opt=bank number etc.... I am more than happy to help test and code as I get better with python. I am a full time audio engineer and I love the control 24, I would love to help. Thank you for your work and time.

@lazlooose
Copy link
Author

@tubbybassengineer welcome to the project things have been quiet for a while but hopefully @phunkyg is seeing these and can come back to give us a hand.

Which branch are you using right now?

we had the toggle and action thing working in an earlier brute force method but it should be working better now.

To the best of my understanding most of the changes are on the DEV_OtherDevices Branch though and not the Release one although I'm not 100% sure since I don't use the Release bnranch at all for the procontrol testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants