Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I add a ControlP5 checkbox/radio button (i.e. a boolean switch) to turn the sound-to-ellipse size function on and off? Here is my code,

How do I add a ControlP5 checkbox/radio button (i.e. a boolean switch) to turn the sound-to-ellipse size function on and off? Here is my code, the button has already been created but clicking it currently does nothing.

//import controlP5 library import controlP5.*;

//New control object ControlP5 cp5;

//import sound library import processing.sound.*;

Amplitude amp; //amplitude control AudioIn in; //audio input float vlm; //volume float scale = 500; //scale of text boolean TurnOff = false;

CallbackListener cb;

void setup() { //canvas size size(800,400); // Create an Input stream which is routed into the Amplitude analyzer amp = new Amplitude(this); //instantiating amp to new Amplitude object in = new AudioIn(this, 0); //instantiating input to new AudioIn object in.start(); amp.input(in); //instantiating the new object cp5 = new ControlP5(this); cp5.addButton("turnOff") .setPosition(150,150) .setValue(1) .setSize(100, 100) ; }

void draw() { background(0); vlm = amp.analyze(); fill(0, 0, 255); ellipse(600, 200, vlm * scale, vlm * scale); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions