Warning: Undefined array key "p" in /home/clients/a70cbb4a74edf8105da5fd7e142fb9de/web/forum/includes/vb5/template.php(404) : eval()'d code on line 794 Warning: Undefined array key "p" in /home/clients/a70cbb4a74edf8105da5fd7e142fb9de/web/forum/includes/vb5/template.php(404) : eval()'d code on line 794 Warning: Undefined array key "p" in /home/clients/a70cbb4a74edf8105da5fd7e142fb9de/web/forum/includes/vb5/template.php(404) : eval()'d code on line 794 [TouchOSC toggle to enable/unable buttons - OSCulator Forum

Announcement

Collapse
No announcement yet.

[TouchOSC toggle to enable/unable buttons

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [TouchOSC toggle to enable/unable buttons

    Hi
    i'd like to set a toggle button to enable/ unable a set of buttons. So if the toggle is "off" all the chosen buttons don't trigger their commands.
    If the toggle is "on" the first button pressed trigger his command and directly the toggle goes to off and no more of the chosen buttons will trigger anithing until the toggle is again "on".

    in this post i've found a way to do the thing ...
    i already have a toggle who enable/disable my buttons but i don't find how to, when any of the chosen buttons is pressed, set the toggle to off and disabling all the chosen buttons.

    Other thing, is it possible to disable the set of buttons (and set the toggle to "off") when i come back from another page?

    thanks
    Two

  • #2
    Hi Two,

    Thank you for this interesting question, here is a possible solution:

    From a toggle button, we want to enable some messages for other button. When the toggle button is unchecked, those messages must be disabled. Also, when one of the buttons is pressed, it must disable the other ones and turn the toggle button off.

    So, the centerpiece of this problem is the message received from the toggle button. With can use it smartly to enable/disable the slave buttons, but also turn off the toggle button.

    Start by registering the toggle button in OSCulator. Its name is /1/toggle1. Then open the Parameters and go to the OSC tab. Your iPad should be the default target at slot 1. Click the gear button on slot 2 and choose the entry for 'this document'. This will allow to send OSC message to OSCulator itself.

    Now create one OSC Routing. Edit its rewrite address to /1/toggle1 (or whatever name your toggle button has).

    Create another OSC Routing and give it the same rewrite address, but this time set its target to 2 (so it is sent to OSCulator instead of the default target), and replace the <all args> token by 0 (type the number 0 and press the space bar).

    Duplicate the /1/toggle1 message enough times to have 4 events. Assign the first one to the first OSC routing we created. You can leave the 3 other ones empty for now.

    Register the slave buttons in OSCulator and duplicate them. I used the first duplicate to send a MIDI CC event. The other event should be set to the other OSC routing you created. If you test the layout right now, you will notice that pressing any of the slave buttons sets the toggle button back to its unchecked state. Now we want to enable and disable the slave buttons.

    Go back to the /1/toggle1 message and assign the Enable event to the 3 remaining events and set the target values to the messages you want to enable or disable.

    The configuration is now complete, when you press the toggle button, is enables the slave buttons, and when you press a slave button it execute its event (here a MIDI CC), unchecks the toggle button (via the /1/toggle1 message) and disables the slave buttons messages.

    Your other question was about how to trigger an event when a preset is changed: In the Preset menu in the toolbar, you must enable the option "Send preset info when presets are restored". When this option is enabled and a preset is changed, OSCulator will receive the message /osculator/preset with useful arguments. The one that interests you is the "trigger" argument. All you have to do is assign the OSC routing that resets the toggle button to 0 so that everything is reset to its default state.

    The attached file demonstrates the above configurations.


    Best,
    Cam
    Attached Files

    Comment


    • #3
      Hi Camille,
      thanks for your answer, works fine.
      My "other" question was : when on touchosc i come back on the page with my buttons is it possible to disable the set of buttons (and set the toggle to "off")?
      I ask it because i noticed that if i save my Osculator document when my buttons are active, next time i'll open this document the use of my toggle will be inverted.
      I presume i have to duplicate /1 and set local messages to the adresses of each button and my toggle with argument "0".

      One more question : if one button trigger 4 events and i want my toggle to enable unable all this events...
      Do i really have to have 4 enable events on my toggle (enable /1/Push1 [0], /1/enable Push1 [0>0], enable /1/Push1 [0>1], enable /1/Push1 [0>2])?
      It seams that one only event " enable /1/Push1 " do not enable/unable the subevents. Am i wrong?
      Last edited by two; 04-14-2012, 11:44 AM.

      Comment


      • #4
        Hi two,

        My "other" question was : when on touchosc i come back on the page with my buttons is it possible to disable the set of buttons (and set the toggle to "off")?
        I ask it because i noticed that if i save my Osculator document when my buttons are active, next time i'll open this document the use of my toggle will be inverted.
        I presume i have to duplicate /1 and set local messages to the adresses of each button and my toggle with argument "0".
        Yes, this is correct, just assign the second OSC routing that was designed to uncheck the toggle button and disable the slave buttons. I wonrgly assumed in my previous answer that you were using Presets.

        Do i really have to have 4 enable events on my toggle (enable /1/Push1 [0], /1/enable Push1 [0>0], enable /1/Push1 [0>1], enable /1/Push1 [0>2])? It seams that one only event " enable /1/Push1 " do not enable/unable the subevents. Am i wrong?
        The Enable event only acts on one entry of the main list, so you have to have as many Enable events as you have other buttons to enable/disable.


        Best,
        Cam

        Comment

        Working...
        X