# Touch automation toggles beginParameterChangeGesture

**URL:** <https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528>\
**Category:** Audio Plugins\
**Created:** [March 27, 2017, 2:20pm UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528 "2017-03-27T14:20:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [March 27, 2017, 2:20pm UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/1 "2017-03-27T14:20:03Z")

</div>

Hello,

A quick question on beginParameterChangeGesture and endparameterChangeGestures. So apparently one should call these methods, to support touch mode automation. This however works only for sliders, since one could implement “beginParameterChangeGesture” in sliderDragStarted and “endparameterChangeGestures” in sliderDragEnded.

Is there some way to implement the same thing for comboboxes/toggles/buttons/etc.? I have been testing cockos based plugins in Repaer and they actually work with touch, where all other plugins seem to break. i.e. the value jumps back to the original upon change from GUI where touch automation is enabled

Thanks for any pointers,  
Armin

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 6:41am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/2 "2017-09-12T06:41:38Z")

</div>

Still scratching my head on this, anyone caring to shed some light on it?

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [September 12, 2017, 7:21am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/3 "2017-09-12T07:21:11Z")

</div>

something like that should work :

```
void buttonClicked (Button* b) override
{
    param.beginChangeGesture();
    param.setValueNotifyingHost (b->getToggleState() ? 1.f : 0.f);
    param.endChangeGesture();
}
```

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 7:24am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/4 "2017-09-12T07:24:03Z")

</div>

Nope already tried it, this does not reflect the same behavior as other cockos plugins in reaper, neither aax plugins in Protools, the toggle(button) jumps quickly back to the original value, making touch automations for toggle useless

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [September 12, 2017, 7:26am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/5 "2017-09-12T07:26:44Z")

</div>

did you set up the button to behave as a toggle?  
`setClickingTogglesState (true);`

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 7:30am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/6 "2017-09-12T07:30:04Z")

</div>

> [@lalala](#):
>
> setClickingTogglesState

just tried, still getting the same thing

PS: the button was defined as a toggle to begin with, so I dont think this is the problem. Have you checked other JUCE plugins? They all exhibit the same behavior

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [September 12, 2017, 7:36am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/7 "2017-09-12T07:36:50Z")

</div>

might be worth providing code snippets.

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 7:40am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/8 "2017-09-12T07:40:30Z")

</div>

Its simple really a toggle button (toggle\_PolCoords) setup, in my update UI I do the following:

```
    if (ourProcessor->polCart != toggle_PolCoords->getToggleState())
    {
        toggle_PolCoords->setToggleState(ourProcessor->polCart, dontSendNotification);
    }

```

in button clicked call back the following:

```
if (buttonThatWasClicked == toggle_PolCoords)
{
    //[UserButtonCode_toggle_PolCoords] 
    bool isPolar = toggle_PolCoords->getToggleState();
    float valueToSend = isPolar ? 1.0f : 0.0f;
    getProcessor().beginParameterChangeGesture(polCartParam);
    getProcessor().setParameterNotifyingHost (polCartParam, valueToSend);
    getProcessor().endParameterChangeGesture(polCartParam);

    //[/UserButtonCode_toggle_PolCoords]
}
```

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [September 12, 2017, 7:43am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/9 "2017-09-12T07:43:12Z")

</div>

Does it toggle without the parameter changes?  
(comment out the 3 lines starting with getProcessor()…)

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 7:46am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/10 "2017-09-12T07:46:01Z")

</div>

yes it toggles, not writing any automation of course, seriously guys, try out a couple of juce based plugins, they all exhibit the same behavior

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 8:04am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/11 "2017-09-12T08:04:45Z")

</div>

Btw using the three lines mentioned earlier works as expected in cubase with VST3

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [September 12, 2017, 8:44am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/12 "2017-09-12T08:44:19Z")

</div>

Ahh sorry for the confusion, I thought of touch in the concept of UI interaction. ☹

Well I’m afraid your best bet is to contact COCKOS…

The behavior you’re experiencing should be fixed on their end I guess.

I’ve tested 3 plug-ins which ALL of them I know aren’t using JUCE framework.  
The first is Blue Cat  
The second is Sound Toys  
The last one is Cockos own.  
All were VST.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/32b328ef6418e326092bbe19a973e35e64ccbf2a.png)

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 8:47am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/13 "2017-09-12T08:47:18Z")

</div>

yeah seems to be a reaper issue, but at the same time, I am experiencing the same issue with aax version in protools. Actually the only version that works as expected is VST3 in cubase. I am pretty sure this has to be regulated on JUCE side, reaper aside of course.

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [September 12, 2017, 9:33am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/14 "2017-09-12T09:33:22Z")

</div>

For AAX , I wasn’t able to reproduce this also.  
Our plug-ins uses JUCE of-course. and I’m seeing the exact behavior that Sound Toys provides in our product…

![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/e/e6a9b2b0797bacf3f53f56a5f461ce05983867a6.png)

Here is the snippet from Muteomatic:

`if (buttonThatWasClicked == stopButton_){ getProcessor().paramStoppedState_->beginChangeGesture(); if (buttonThatWasClicked->getToggleState()){ getProcessor().paramStoppedState_->setValueNotifyingHost(STATE_ON); } else{ getProcessor().paramStoppedState_->setValueNotifyingHost(STATE_OFF); } getProcessor().paramStoppedState_->endChangeGesture(); return; }`

To be honest Muteomatic is build based on JUCE 4.2 / pre multi-I/O even.  
And currently our products based on JUCE 4.3 so you can look on latest dev branch to see if there are regressions but I don’t think so.

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 10:09am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/15 "2017-09-12T10:09:31Z")

</div>

ok it seems like you are using the new parameter system in JUCE, I wonder if this might be causing the issue for us, since we are still on the old system

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 10:11am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/16 "2017-09-12T10:11:26Z")

</div>

looking at the AudioProcessorParameter

```
  void AudioProcessorParameter::beginChangeGesture()
  {
    // This method can't be used until the parameter has been attached to a processor!
    jassert (processor != nullptr && parameterIndex >= 0);

    processor->beginParameterChangeGesture (parameterIndex);
}

void AudioProcessorParameter::endChangeGesture()
{
    // This method can't be used until the parameter has been attached to a processor!
    jassert (processor != nullptr && parameterIndex >= 0);

    processor->endParameterChangeGesture (parameterIndex);
}

```

it seems like they follow the same code, so I dont think that is the issue

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [September 12, 2017, 11:39am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/17 "2017-09-12T11:39:26Z")

</div>

> [@tetrohed](#):
>
> yes it toggles, not writing any automation of course, seriously guys, try out a couple of juce based plugins, they all exhibit the same behavior

I just can’t re-produce this. Your code works absolutely fine for me. Just tested the latest develop branch in ProTools, Logic, Cubase, Reaper, Ableton. No issues at all.

```
void MyFirstPluginProjectAudioProcessorEditor::buttonStateChanged (Button*)
{
    bool newState = onOffButton.getToggleState();
    if (newState != oldState)
    {
        oldState = newState;
        MyFirstPluginProjectAudioProcessor& ap = dynamic_cast<MyFirstPluginProjectAudioProcessor&> (*getAudioProcessor());

        ap.cutoffParameter->beginChangeGesture();
        ap.cutoffParameter->setValueNotifyingHost (newState ? 1.0f : 0.0f);
        ap.cutoffParameter->endChangeGesture();
    }
}

```

---

<div class="post-metadata">

**Author:** ![fr810](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/fr810/32/841_2.png) [@fr810](https://forum.juce.com/u/fr810)\
**Post date:** [September 12, 2017, 11:40am UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/18 "2017-09-12T11:40:30Z")

</div>

… are you maybe by mistake using the `buttonClicked` callback instead of the `buttonStateChanged` callback?

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 12:15pm UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/19 "2017-09-12T12:15:40Z")

</div>

I was using buttonclicked, but just checked your implementation with buttonStateChanged and getting the same behavior, just to be sure we are talking about the same issue, here is a screenshot

 ![48](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/1/1da45b909d26bd75a249bd768d8e87861cedec3b.jpg)

---

<div class="post-metadata">

**Author:** ![arminGJ](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@arminGJ](https://forum.juce.com/u/arminGJ)\
**Post date:** [September 12, 2017, 12:15pm UTC](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528/20 "2017-09-12T12:15:57Z")

</div>

notice that the toggle back is happening automatically, I would expect the automation line to stay at 1 until I toggle back through UI

[Next page](https://forum.juce.com/t/touch-automation-toggles-beginparameterchangegesture/21528.md?page=2)
