Package nodebox.client

Source Code of nodebox.client.MinimInputApplet

package nodebox.client;

import ddf.minim.AudioInput;
import ddf.minim.Minim;
import ddf.minim.analysis.BeatDetect;
import processing.core.PApplet;

public class MinimInputApplet extends PApplet {
    private Minim minim;
    private AudioInput input;
    private BeatDetect beat;

    public void setup() {
        minim = new Minim(this);
        input = minim.getLineIn();
        beat = new BeatDetect(input.bufferSize(), input.sampleRate());
        input.setVolume(0);
        input.setGain(-64);
    }

    public AudioInput getInput() {
        if (input == null) return null;
        return input;
    }

    public BeatDetect getBeatDetect() {
        return beat;
    }

    public void draw() {
        beat.detect(input.mix);
    }

    @Override
    public void stop() {
        if (input != null)
            input.close();
        input = null;
        if (minim != null)
            minim.stop();
    }
}
TOP

Related Classes of nodebox.client.MinimInputApplet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.