Reference+
Name
pause()
Class
AudioSample
Description
Stop the playback of the sample, but cue it to the current position. The next call to play() will continue playing where it left off.
Examples
import processing.sound.*; AudioSample sample; void setup() { size(640, 360); background(255); // Create an array and manually write a single sine wave oscillation into it. int resolution = 1000; float[] sinewave = new float[resolution]; for (int i = 0; i < resolution; i++) { sinewave[i] = sin(TWO_PI*i/resolution); } // Create the audiosample based on the data, set framerate to play 200 oscillations/second sample = new AudioSample(this, sinewave, 200 * resolution); sample.play(); } void draw() { } void mousePressed() { if (sample.isPlaying()) { sample.pause(); } else { sample.play(); } }
Syntax
audiosample.pause()
Return
void
Related
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.