Book Image

OpenFrameworks Essentials

Book Image

OpenFrameworks Essentials

Overview of this book

Table of Contents (19 chapters)
openFrameworks Essentials
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Controlling automation


At this point, we have implemented automation for several sliders. Often, it is desirable to have an opportunity to disable automation. So let's add a checkbox that toggles automation on and off:

  1. Declare a new checkbox in the ofApp class:

    ofxToggle automate;
  2. Set up the checkbox in setup() by inserting the following command after the mixerGroup.add( extrude.setup... command:

    mixerGroup.add( automate.setup( "automate", true ) );
  3. Insert the following line right before all the code we added in this chapter to update() (except the ofSoundUpdate() command, which we placed at the beginning of the function):

    if ( automate ) {
    

    And insert the following line right after that code:

    }

    Tip

    You need to re-indent that code by adding Tab before each line to have proper indentation.

Now, automation will work only if the automate checkbox is checked. In the same way, you can create separate checkboxes to toggle the automation of each parameter we created.

Also, you can create sliders for the control...