<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with pause() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=pause%28%29</link>
      <pubDate>Sun, 08 Aug 2021 21:15:41 +0000</pubDate>
         <description>Tagged with pause() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedpause%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>unmanageable CPU cost when a video is loaded using video library</title>
      <link>https://forum.processing.org/two/discussion/28036/unmanageable-cpu-cost-when-a-video-is-loaded-using-video-library</link>
      <pubDate>Sat, 02 Jun 2018 08:38:57 +0000</pubDate>
      <dc:creator>pietroLama</dc:creator>
      <guid isPermaLink="false">28036@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to do a simple think: when a button is pressed i load a video using the processing video library, each button is associated with a different video, for example button 1 with video 1, button 2 with video 2, and so on. The code works but every time I call a video, also the same i have already load, rewriting the gloabal variable the consume of CPU grows, reaching the 40% after the thrid loading, after 7 video the consume of CPU is near the 100%. An extraction of the code:</p>

<pre><code>import processing.video.*;
Movie movie;
void setup() {
    size(1280, 720, P3D);
    background(0);
}
void draw() {
    //image(movie, 0, 0, width, height);

    if (but1_1==1) {
       println("video 1");
       movie = new Movie(this, "1.mp4"));
       movie.loop();
       movie.volume(0);
  }
  if (but1_2==1) {
       println("video 2");
       movie = new Movie(this, "2.mp4"));
       movie.loop();
       movie.volume(0);
  }
  if (but1_3==1) {
       println("video 3");
       movie = new Movie(this, "3.mp4"));
       movie.loop();
       movie.volume(0);
  }
}
</code></pre>

<p>As you can see, it should not be any reason in based on which the CPU consume grows: the instantiated object movie is always rewritten every time a new video (or the same) is loaded. Any suggestions?</p>
]]></description>
   </item>
   <item>
      <title>Creating a Piano (need help with keyReleased)</title>
      <link>https://forum.processing.org/two/discussion/27919/creating-a-piano-need-help-with-keyreleased</link>
      <pubDate>Fri, 04 May 2018 23:25:14 +0000</pubDate>
      <dc:creator>rpinkall</dc:creator>
      <guid isPermaLink="false">27919@/two/discussions</guid>
      <description><![CDATA[<p>I am creating a music machine and when I press the 'a' key the function begins to hold the note.
When I release the 'a' key, the sound file stops, as i want it to.</p>

<p>But when I go to press the 'a' key again, no sound comes out at all.  I feel like the key1.pause(); function stops it correctly but wont load the same sound file when pressing the 'a' key again.</p>

<p>When I use the key1.rewind(); under the keyReleased function, it plays the sound upon releasing the key 'a' in a rewind manner.</p>

<p>This is my final project for Programming for Visual Artists and really could use some assistance please!</p>

<pre><code>            import ddf.minim.analysis.*;
            import ddf.minim.*;

            Minim minim;

            AudioPlayer key1;

            void setup() {

            size(1440, 770);

            minim = new Minim(this);
            key1 = minim.loadFile("key1.mp3", 512);
            }

            void draw() {
            }

            void keyPressed() {
              if (key=='a')
                key1.play();
            }
            void keyReleased() {
              key1.pause();

            }
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to 'store' previous keyPressed data in the same sketch</title>
      <link>https://forum.processing.org/two/discussion/27750/how-to-store-previous-keypressed-data-in-the-same-sketch</link>
      <pubDate>Thu, 12 Apr 2018 17:18:16 +0000</pubDate>
      <dc:creator>mariamalz</dc:creator>
      <guid isPermaLink="false">27750@/two/discussions</guid>
      <description><![CDATA[<p><img src="https://forum.processing.org/two/uploads/imageupload/866/TDK20E721F1F.png" alt="Screen Shot 2018-04-12 at 7.18.27 PM" title="Screen Shot 2018-04-12 at 7.18.27 PM" /></p>

<p>I can get one colored bar to expand as I hold down the key. I have another an issue of getting another colored bar to continue where the other one left off? Essentially it continues right after the previous rectangle depending on where it stops. Here's a picture of what I want to achieve (assuming each colored rectangle is a different length).</p>

<p>Here is my code:</p>

<pre><code>int rectWidth=0;
int rectHeight=250;

int x = -rectWidth;  

void setup(){
  size(800,800);
  background(0);
  noStroke();
  smooth();

}

void draw(){

 rect(0, 0, rectWidth, rectHeight);

 if(keyPressed){
   rectWidth++;


  if((key == 'a')) {
   fill(#8fcd9c); }

 if((key == 'b')) {
    fill(#96c6ea); }

 if((key == 'c')) {
    fill(#ef3942); }

 if((key == 'd')) {
    fill(#fdf04d); }

 if((key == 'e')) {
    fill(#c6e9f6); }

 if((key == 'f')) {
    fill(#ef5a7a); }

 if((key == 'g')) {
    fill(#f8971d); } 
 }
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to play random sound file when clicking an item within a scrollable list (controlP5 library)?</title>
      <link>https://forum.processing.org/two/discussion/27834/how-to-play-random-sound-file-when-clicking-an-item-within-a-scrollable-list-controlp5-library</link>
      <pubDate>Mon, 23 Apr 2018 23:28:42 +0000</pubDate>
      <dc:creator>Neowso</dc:creator>
      <guid isPermaLink="false">27834@/two/discussions</guid>
      <description><![CDATA[<p>I'm using the 'scrollableList' from the controlP5 library. I wish to simply play a random sound file each time I click an element on the scrollable list, without pausing.</p>

<p>I have tried a few things. I am having limited success with some code from <a href="/two/profile/akenaton">@akenaton</a> that I found in this thread:
<a rel="nofollow" href="https://forum.processing.org/two/discussion/8949/how-do-i-play-a-random-audio-sample">https://forum.processing.org/two/discussion/8949/how-do-i-play-a-random-audio-sample</a></p>

<p>I merged that code with the scrollable list. So far, I'm only managing to pause the audio on clicking the menu. I am probably missing something obvious.</p>

<p>As ever, any tips much appreciated :)</p>

<pre><code>import ddf.minim.*;
import controlP5.*;
import java.util.*;
AudioPlayer player;
Minim minim;
ControlP5 cp5;

boolean playeurInit = false;// que leplayer n'est pas lancé
boolean stop = true;

String[] table = {"train1.wav", "train2.wav"};

int randomWav; 
String wav; 

void setup() {
  size(400, 400);

  minim = new Minim(this);
  int randomWav = int(random(table.length));
  String son = table[randomWav];
  //println(son);
  player = minim.loadFile(son);
  player.pause();   

  cp5 = new ControlP5(this);
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
  cp5.addScrollableList("dropdown").setPosition(10, 10).setSize(200, 100).setBarHeight(20).setItemHeight(20).addItems(l);   
}


void draw() {
  background(240);
  if (!stop) {
    if (player.isPlaying() == false) {
          randomWav = int(random(table.length));
          println(randomWav);
          wav = table[randomWav];
          player = minim.loadFile(wav);
          player.play();
          player.loop();//you can change that!
          playeurInit = true;
     }
  }
}


void dropdown(int n) {
  if(stop == true)
  {
    stop = false;
  }else{
    stop = true;
    player.play();
    if (player.isPlaying() == true ) 
    {
      player.pause();
      //player.play();
    }
  }

  CColor c = new CColor();
  c.setBackground(color(255,0,0));
  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
}


void stop(){
  player.close();
  minim.stop();
  super.stop();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Creating a timer</title>
      <link>https://forum.processing.org/two/discussion/27816/creating-a-timer</link>
      <pubDate>Sat, 21 Apr 2018 17:25:02 +0000</pubDate>
      <dc:creator>Scott06</dc:creator>
      <guid isPermaLink="false">27816@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I am in need of some assistance.
I'd like to write code that will execute when you click the mouse, and I want the action to run for a maximum of four seconds. If the mouse is still pressed for longer than four seconds, the action will stop. However, I want the action to stop immediately once the mouse is released if the mouse is released after say for example two or three seconds. Also, I'd want this to be repeatable, so that you can do the action as many times as you want. Thank you.</p>
]]></description>
   </item>
   <item>
      <title>Playing audio files from a playlist with Minin</title>
      <link>https://forum.processing.org/two/discussion/26805/playing-audio-files-from-a-playlist-with-minin</link>
      <pubDate>Tue, 13 Mar 2018 12:02:52 +0000</pubDate>
      <dc:creator>JBradley</dc:creator>
      <guid isPermaLink="false">26805@/two/discussions</guid>
      <description><![CDATA[<p>I have an application where audio ques are selected from a playlist (array). Minin has an example of just playing a single file. I am confused on how to declare and setup these file arrays. Which variable has the arry? Can you point me to an example?
Thanks</p>
]]></description>
   </item>
   <item>
      <title>How to "fix" NullPointerExeption? (minim Couldn't load the file)</title>
      <link>https://forum.processing.org/two/discussion/26680/how-to-fix-nullpointerexeption-minim-couldn-t-load-the-file</link>
      <pubDate>Tue, 06 Mar 2018 21:12:45 +0000</pubDate>
      <dc:creator>Dyo69</dc:creator>
      <guid isPermaLink="false">26680@/two/discussions</guid>
      <description><![CDATA[<p>Hi ,
I start Processing and I made a code to play a piano note, i run the code , but when i press the key to play the song , i have an error : NullPointer Exeption and 
=== Minim Error ===
=== Couldn't load the file G.mp3</p>

<p>This is my code : 
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;</p>

<p>import ddf.minim.*;</p>

<p>Minim minim; // création d'un objet de la classe Minim</p>

<p>AudioPlayer G;</p>

<p>void setup() {</p>

<p>minim = new Minim(this); // 'this' fait référence à l'application en cours</p>

<p>G = minim.loadFile("G.mp3");</p>

<p>}</p>

<p>void draw() {</p>

<p>background(128);</p>

<p>if (key == 'u') G.play(); // key est la dernière touche activée du clavier</p>

<p>if (key == 'p') G.pause();</p>

<p>}</p>

<p>void stop() {</p>

<p>G.close();</p>

<p>minim.stop();</p>

<p>super.stop();</p>

<p>}</p>

<p>I'm french , I hope you to help me asap! :)</p>
]]></description>
   </item>
   <item>
      <title>After .pause(), .play() does NOT resume from the paused position but from an earlier point</title>
      <link>https://forum.processing.org/two/discussion/25582/after-pause-play-does-not-resume-from-the-paused-position-but-from-an-earlier-point</link>
      <pubDate>Fri, 15 Dec 2017 16:48:14 +0000</pubDate>
      <dc:creator>BS_007</dc:creator>
      <guid isPermaLink="false">25582@/two/discussions</guid>
      <description><![CDATA[<p>Concerns: <a href="https://p5js.org/reference/#/p5.SoundFile/pause" target="_blank" rel="nofollow">https://p5js.org/reference/#/p5.SoundFile/pause</a><br />
OS: Windows 7<br />
Browser: Firefox Quantum 57.02 (64 bits)<br />
p5.js v0.5.16</p>

<pre><code>let bPlay = true;
let sndFile;

function preload() 
{
  sndFile = loadSound('Sound/D960_3.mp3');
}

function setup() 
{
  sndFile.play();
}

function mousePressed()
{
  if (bPlay) { sndFile.pause(); bPlay=false; }
  else       { sndFile.play();  bPlay=true;  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Help figuring out error when using Video library</title>
      <link>https://forum.processing.org/two/discussion/25428/help-figuring-out-error-when-using-video-library</link>
      <pubDate>Wed, 06 Dec 2017 22:35:41 +0000</pubDate>
      <dc:creator>NewTimer</dc:creator>
      <guid isPermaLink="false">25428@/two/discussions</guid>
      <description><![CDATA[<p>This is my code that is currently used to cycle through 3 different videos by pressing Q:</p>

<pre><code>import processing.video.*;
static final int movieCount = 3;
final Movie[] myMovie = new Movie[movieCount];
int index;
int maxMovieIndex = movieCount-1;

void setup() {
  size(1920, 1080);
  myMovie[0] = new Movie(this, "scene_0.mp4");
  myMovie[1] = new Movie(this, "scene_1.mp4");
  myMovie[2] = new Movie(this, "scene_2.mp4");
  myMovie[0].loop();
}

void draw() {
  set(0, 0, myMovie[index]);
  image(myMovie[index], 0, 0);

  println("index: " + index);
}

void keyPressed()
{
 if (key == 'q')
 {
   myMovie[index].pause();
   if (index != maxMovieIndex)
   {
    index++; 
   }
   else
   {
    index = 0; 
   }
   myMovie[index].loop();
 }
}

void movieEvent(Movie m) {
  m.read();
}
</code></pre>

<p>It runs, but if I exit after doing a switch, I get an error in the console upon exit:</p>

<blockquote class="Quote">
  <p>(java.exe:6620): GStreamer-CRITICAL **: 
  Trying to dispose element Movie Player, but it is in PAUSED instead of the NULL state.
  You need to explicitly set elements to the NULL state before
  dropping the final reference, to allow them to clean up.
  This problem may also be caused by a refcounting bug in the
  application or some element.</p>
  
  <p>(java.exe:6620): GStreamer-CRITICAL **: 
  Trying to dispose element inputselector0, but it is in PAUSED instead of the NULL state.
  You need to explicitly set elements to the NULL state before
  dropping the final reference, to allow them to clean up.
  This problem may also be caused by a refcounting bug in the
  application or some element.</p>
</blockquote>

<p>What does this mean, and how do I fix it? I guess it has to do with how the Movie object is used, but I haven't seen examples in the documentation on why/how to safely exit.</p>
]]></description>
   </item>
   <item>
      <title>P5JS cueing video media elements</title>
      <link>https://forum.processing.org/two/discussion/21323/p5js-cueing-video-media-elements</link>
      <pubDate>Fri, 10 Mar 2017 20:41:38 +0000</pubDate>
      <dc:creator>aldobranti</dc:creator>
      <guid isPermaLink="false">21323@/two/discussions</guid>
      <description><![CDATA[<p>I cannot remove cues on video media elements and they stay around and mess up the ongoing behaviour of the code</p>

<p>Here's some code</p>

<p>/*
 * <a href="/two/profile/name">@name</a> Video
 * <a href="/two/profile/frame">@frame</a> 710,250
 * <a href="/two/profile/description">@description</a></p>

<p>&lt;</p>

<p>p&gt;Load a video with multiple formats and toggle between playing
 * and paused with a button press. 
 *</p>

<p><em><span class="small"> To run this example locally, you will need at least
 * one video file, and the
 * <a rel="nofollow" href="http://p5js.org/reference/#/libraries/p5.dom">p5.dom library</a>.</span></em></p>

<p>*/
var playing = false;
var fingers;
var button;
var a_cue;</p>

<p>function setup() {
  // specify multiple formats for different browsers
  fingers = createVideo(['assets/fingers.mov',
                         'assets/fingers.webm']);
  button = createButton('play');
  button.mousePressed(toggleVid); // attach button listener
    a_cue = fingers.addCue( 2, cued, fingers);
}</p>

<p>function cued( a) {
    console.info(' cued a.time:'+a.time());
  a.removeCue( a_cue);
    a.clearCues();
}
// plays or pauses the video depending on current state
function toggleVid() {
  if (playing) {
    fingers.pause();
    button.html('play');
  } else {
    fingers.loop();
    button.html('pause');
  }
  playing = !playing;
}</p>

<p>I would expect the call to the cued() callback to remove the cue and to prevent further calls into the c/b</p>

<p>Ultimately what I'm trying to do is to coordinate the parallel playback of two video streams and to use cuing to control the crossovers between</p>
]]></description>
   </item>
   <item>
      <title>Infinite loop?</title>
      <link>https://forum.processing.org/two/discussion/25057/infinite-loop</link>
      <pubDate>Fri, 17 Nov 2017 01:49:22 +0000</pubDate>
      <dc:creator>LaxOfBayDay</dc:creator>
      <guid isPermaLink="false">25057@/two/discussions</guid>
      <description><![CDATA[<p>I'm working on an audio sample machine using minim. I want one player to pause another and I've gotten the timer to stop but does anyone know why this snippet causes a loop my app can't get out of?.</p>

<pre><code>while(Ads[i].isPlaying()){
        if (Ads[i].position()==Ads[i].length()) {
        Ads[i].pause();
        }
       savedTime=millis();
     }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Video error on reverse on video library</title>
      <link>https://forum.processing.org/two/discussion/14733/video-error-on-reverse-on-video-library</link>
      <pubDate>Tue, 02 Feb 2016 23:01:07 +0000</pubDate>
      <dc:creator>Per</dc:creator>
      <guid isPermaLink="false">14733@/two/discussions</guid>
      <description><![CDATA[<p>Hi!</p>

<p>Im made this sketch but as soon as I hit reverse on the videolibrary with help of negative movie.speed it causes a error. Any solution?:</p>

<blockquote class="Quote">
  <p>(Processing core video:475): GStreamer-WARNING **: wrong STREAM_LOCK count 0</p>
  
  <p>(Processing core video:475): GStreamer-CRITICAL **: gst_segment_set_seek: assertion `start &lt;= stop' failed</p>
</blockquote>

<pre><code>import processing.video.*;

Movie movie; // Step 1. Declare Movie object

void setup() {
  size(560, 480);
  // Step 2. Initialize Movie object
  movie = new Movie(this, "test1.mov");
  movie.loop();
  movie.jump(5);
  movie.pause();
}
// Step 4. Read new frames from movie
void movieEvent(Movie movie) {
  movie.read();
}
void draw() {
  image(movie, 650, 0);
}

void keyReleased() {
  if (key == 'a') movie.play(); // play
  if (key == 's') movie.pause(); // pause
  if (key == 'd') movie.stop(); // stop
  if (key == 'f') movie.jump(5); // jump
  movie.speed(1.0);
}

void keyPressed() {
  if (key == 'g') movie.speed(5.0); // forward
  if (key == 'h') movie.speed(-5.0); // reverse
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to sincronize the audio in a way that fade out the image?</title>
      <link>https://forum.processing.org/two/discussion/23399/how-to-sincronize-the-audio-in-a-way-that-fade-out-the-image</link>
      <pubDate>Tue, 11 Jul 2017 00:26:50 +0000</pubDate>
      <dc:creator>valent_000</dc:creator>
      <guid isPermaLink="false">23399@/two/discussions</guid>
      <description><![CDATA[<p>hi everyone! Im new using processing, and i find myself stuck with this doubt, im looking for something that helps me to sincronize the audio and the image and fade out the image, all of that part is in the keyPressed part, i hope i make myself clear</p>

<pre><code>import ddf.minim.*;

PImage img1, img2;
int trans ;
int vol = 1;
float transparency = 255;
AudioPlayer latido;
AudioPlayer pip;
Minim minim;


void setup() {

  size(500, 500);
  background(0);
  trans = 255;
  vol = 1;
  pipi = 3;
  img1 = loadImage("cora.jpg");
  minim = new Minim(this);
  pip = minim.loadFile("pip.mp3");
  latido = minim.loadFile("latido.mp3");
  // the audio "latido" in loop
  latido.loop();
}

void draw() {
  //i combine the audio with the transparency of the image
  int vol = int(latido.mix.level()*500);
  println(vol);
  int trans = int(map(vol,-100,200,80,200));
  tint(trans,100);
  image(img1, -30, -300); 

  if (transparency &gt; 0) { transparency -= 10; }
  tint(0, transparency);
  image(img1, -30, -300);
}
_
**        void keyPressed(){
          //when you press any key the audio "latido" stop, and another audio(pip) starts and the image fade out with tthe last audio(here is my doubt)

          latido.pause();

          pip.setGain(-15);
          pip.play();
          pip.loop();

        }**_
</code></pre>
]]></description>
   </item>
   <item>
      <title>Trying to improve video performance</title>
      <link>https://forum.processing.org/two/discussion/22250/trying-to-improve-video-performance</link>
      <pubDate>Thu, 27 Apr 2017 17:17:22 +0000</pubDate>
      <dc:creator>laurabrooks</dc:creator>
      <guid isPermaLink="false">22250@/two/discussions</guid>
      <description><![CDATA[<p>I am creating an interactive 360 video sketch (with the help of <a rel="nofollow" href="https://github.com/muimota/p5video360">this shader</a> ) where a user will be able to speed and slow the clip (to make it look like they are moving through the scene) and look side to side by moving the mouse in the y and x directions, respectively. My goal is to display this sketch across three monitors so I would like to use high resolution video, however the sketch's performance worsens as the video quality increases and playback is often shaky. The shader seems to have very high performance but pausing and playing at different speeds sometimes makes the video jump or shake. I'm looking for solutions to make the video more smooth and be able to display it on a large area. I have allotted 1 gigabyte of memory to Processing through Preferences and I don't know if allotting more would solve my problem? Perhaps I just need a more powerful computer ( currently on 64-bit Windows, 4GB RAM)? I have looked into pre-loaded the whole video but haven't found anything promising.</p>

<p>Below is my code, any help is appreciated!</p>

<pre><code>import processing.video.*;

float joystick_yaw, joystick_speed;
Movie movie;
PShader shader;
float yaw, pitch, fov;
boolean isPaused = false;

void setup() {
  size(1280, 720, P2D);
  // pitch and yaw set to start video in desired view
  yaw   = 225;
  pitch = 5;
  fov   = 80;
  shader = loadShader("data/video360.glsl");
  shader.set("resolution", float(width/2), float(height/2));
  shader.set("yaw", yaw);
  shader.set("pitch", pitch);
  shader.set("fov", fov);
  movie = new Movie(this, "stitch_high.mp4");
  movie.play();
  movie.volume(0);
  while (movie.height == 0) {
    println("waiting " + second()); 
    delay(10);
  }

  imageMode(CORNERS);
}

void draw() {
  // display video  
  shader(shader);
  image(movie, 0, 0, width, height);

  // display yaw
  joystick_yaw = map(mouseX, 0, 1200, yaw-(fov/3), yaw+(fov/3)); 
  shader.set("yaw", joystick_yaw);

  //choose speed of video
  joystick_speed = map(mouseY, 0, height, 2, -2); 

  if (joystick_speed &gt; 0.2 &amp;&amp; isPaused ) {
    movie.speed(joystick_speed);
    movie.play();
    movie.speed(joystick_speed);
    isPaused = false;
  } else if (joystick_speed &lt; -0.2 &amp;&amp; isPaused) {
    movie.speed(joystick_speed);
    movie.play();
    movie.speed(joystick_speed);
    isPaused = false;
  } else if (joystick_speed &gt;= -0.2 &amp;&amp; joystick_speed &lt;= 0.2) {
    if (!isPaused) {
      movie.pause();
      isPaused = true;
    }
  }
}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
  m.read();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to use GImageButton1 to turn my audio file on/off with loops?</title>
      <link>https://forum.processing.org/two/discussion/22016/how-to-use-gimagebutton1-to-turn-my-audio-file-on-off-with-loops</link>
      <pubDate>Sat, 15 Apr 2017 17:24:30 +0000</pubDate>
      <dc:creator>sullyoz</dc:creator>
      <guid isPermaLink="false">22016@/two/discussions</guid>
      <description><![CDATA[<p>This is my GUI BUTTON: I want to use it to play/pause my audio file:</p>

<pre><code>public void imgButton1_click1(GImageButton source, GEvent event) { //_CODE_:imgButton1:842456:
  println("imgButton1 - GImageButton &gt;&gt; GEvent." + event + " @ " + millis());
  imgButton1 = source;
  if (playing == true) 
    {
    myplayer.play();
    }
  else 
    {
    myplayer.pause();
  }
} //_CODE_:imgButton1:842456:

This is where it is in my code:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

//declarations
Minim minim; // audio 
AudioPlayer myplayer; // audio output device
boolean playing = false;

void setup() 
{
  createGUI();
  minim = new Minim(this); // instantiate the audio class
  myplayer = minim.loadFile("subbeat.wav");

  myplayer.play();
  myplayer.pause();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Help needed getting Processing to open video files.</title>
      <link>https://forum.processing.org/two/discussion/21748/help-needed-getting-processing-to-open-video-files</link>
      <pubDate>Sat, 01 Apr 2017 17:27:37 +0000</pubDate>
      <dc:creator>harrisonh555</dc:creator>
      <guid isPermaLink="false">21748@/two/discussions</guid>
      <description><![CDATA[<p>hello,</p>

<p>I am wanting to replace the following code. I have a capacitive touch sensor attached to processing that opens up a random image every time the sensor is held, when the sensor is let go this image disappear.</p>

<p>I want to essentially replace the image files with 26 short video clips at 25 frame rate. Im not sure how to change this code to make that happen.</p>

<p>Any help would be great!</p>

<pre><code>import processing.serial.*;

int threshold = 30; 
PImage [] picArray = new PImage [26]; 
Serial myPort;

boolean holdImage=false;
int imgIndex;

void setup() {
  size (500, 500);

  for (int i=0; i&lt;picArray.length; i++)
    picArray[i]=loadImage(i + ".png");

  myPort = new Serial(this, Serial.list()[1], 9600);
  myPort.bufferUntil('\n');
}


void draw() {

  background (255, 255, 255); 
  if (holdImage==true) { 
    image(picArray[imgIndex], 0,0);
  }
}


void serialEvent(Serial myPort) {

  String inString = myPort.readStringUntil('\n');

  if (inString != null) {

    inString = trim (inString);
    float[] touches = float (split(inString, ","));

    if (touches.length &gt;=1) {
      int touch1Value = touches[0] &gt;= threshold ? 1: 0;

      if (touch1Value == 1) {
        if (holdImage == false) {
          imgIndex=int(random(picArray.length));
          holdImage=true;
        }
      } else
        holdImage=false;  //RELEASE holder so to detect next usr press event
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Using Minim to create 3 playlists to play based on input from arduino</title>
      <link>https://forum.processing.org/two/discussion/21452/using-minim-to-create-3-playlists-to-play-based-on-input-from-arduino</link>
      <pubDate>Fri, 17 Mar 2017 14:26:38 +0000</pubDate>
      <dc:creator>dackdel</dc:creator>
      <guid isPermaLink="false">21452@/two/discussions</guid>
      <description><![CDATA[<pre><code>import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
import processing.serial.*;

Serial myPort;
int val;
Minim minim;

void setup() {
      size(512, 200, P3D);
      minim = new Minim(this);

      chrisPlaylist = new AudioPlayer [2];
      yeemunPlaylist = new AudioPlayer [3];
      foodPlaylist = new AudioPlayer [3];
      musicPlaylist = new AudioPlayer [3];

      String portName = Serial.list()[0];
      myPort = new Serial(this, portName, 9600);

      chrisPlaylist[0] = minim.loadFile("C15.aiff"); 
      chrisPlaylist[1] = minim.loadFile("C15a.aiff");

      yeemunPlaylist[0] = minim.loadFile("Y7.aiff"); 
      yeemunPlaylist[1] = minim.loadFile("Y30.aiff"); 
      yeemunPlaylist[2] = minim.loadFile("MY15a.aiff");

      foodPlaylist[0] = minim.loadFile("F7.aiff");
      foodPlaylist[1] = minim.loadFile("F15.aiff");
      foodPlaylist[2] = minim.loadFile("F30.aiff");

      musicPlaylist[0] = minim.loadFile("M7.aiff");
      musicPlaylist[1] = minim.loadFile("M15.aiff");
      musicPlaylist[2] = minim.loadFile("M30.aiff");

}

void draw() {
  background(0);
  stroke(255);  

  if ( myPort.available() &gt; 0) 
  {  
    val = myPort.readStringUntil('\n');        
    if (val != null) {
      String[] values = split(trim(val), ',');
      if (values.length == 4) {
          println(values[1]+"#"+values[2]+"#"+values[3]+"#");

        if (values[1].equals("Yee Mun")) {
          if ((values[2].equals("Nothing"))&amp;&amp;(values[3].equals("Nothing"))) {
            println("yeemunPlaylist");
            yeemunPlaylist.play();
          } else yeemunPlaylist.pause();

        if (values[1].equals("Chris")) {
          if ((values[2].equals("Nothing"))&amp;&amp;(values[3].equals("Nothing"))) {
            println("chrisPlaylist");
            chrisPlaylist.play();
          } else chrisPlaylist.pause();

        if (values[1].equals("Food")) {
          if ((values[2].equals("Nothing"))&amp;&amp;(values[3].equals("Nothing"))) {
            println("foodPlaylist");
            foodPlaylist.play();
          } else foodPlaylist.pause();

        if (values[1].equals("Music")) {
          if ((values[2].equals("Nothing"))&amp;&amp;(values[3].equals("Nothing"))) {
            println("musicPlaylist");
            musicPlaylist.play();
          } else musicPlaylist.pause();

  }

 void stop(){
      minim.stop();
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Video 1.0.1 - Read a frame from a paused video?</title>
      <link>https://forum.processing.org/two/discussion/20383/video-1-0-1-read-a-frame-from-a-paused-video</link>
      <pubDate>Fri, 20 Jan 2017 20:37:56 +0000</pubDate>
      <dc:creator>Krystman</dc:creator>
      <guid isPermaLink="false">20383@/two/discussions</guid>
      <description><![CDATA[<p>I'm using Processing to make a small app. I want to display and edit text overlays on top of a video file - similar to subtitles. For that, I want to be able to jump a paused video to a specific timecode and display the video frame at that time. Unfortunately, this doesn't seem to work.</p>

<p>So if I make something like this:</p>

<p><code>movie.pause();
movie.jump(30);
movie.read();</code></p>

<p>The video will NOT show the frame at second 30, but whatever frame was on the screen before the jump. If I jump around in the video the same frame keeps being displayed until I hit play.</p>

<p>Is there a workaround for this?</p>
]]></description>
   </item>
   <item>
      <title>Why doesn't work MUTE with boolean in my code?</title>
      <link>https://forum.processing.org/two/discussion/20467/why-doesn-t-work-mute-with-boolean-in-my-code</link>
      <pubDate>Wed, 25 Jan 2017 17:00:09 +0000</pubDate>
      <dc:creator>Sly97</dc:creator>
      <guid isPermaLink="false">20467@/two/discussions</guid>
      <description><![CDATA[<p>Hey!
I'm having trouble to using .mute(); with boolean. As you can see in the code, I want to make processing to mute all my sounds when i hit 'k', and unmute them when I hit 'k' again. It's very important for me to make this program. When i do it with .pause() and .play(), it works, but it's not good for me, because i want to run these sounds in loop. I hope that u guys can help me. Here's my code: (on the start of the draw, wehere my problem is)   (Btw.: sorry for my bad english)
Thx</p>

<pre><code>import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;

Minim m;
AudioInput in;
AudioPlayer hera;
AudioPlayer time;
AudioPlayer hotlinebling;
AudioPlayer kemosabe;


boolean onOff = false;
boolean pOn = false;

void setup() {
  size(640, 360);
  background(255);

  m = new Minim(this);
  hera = m.loadFile("1.mp3");
  hera.loop();

  time = m.loadFile("2.mp3");
  time.loop();

  hotlinebling = m.loadFile("hbt.mp3");
  hotlinebling.loop();


  kemosabe = m.loadFile("4.mp3");
  kemosabe.loop();

  in = m.getLineIn(Minim.MONO, 2048);
}      

void draw() {

  if (onOff == false) {
    kemosabe.mute();
    time.mute();
    hera.nmute();
    hotlinebling.mute();

    //Mikrofon 
    if (keyPressed) {
      if (key == 'p' &amp;&amp; !pOn) {
        if (random(0, 6) &lt; 3) {
          in.enableMonitoring();
        } else {
          in.disableMonitoring();
        }
        println(in.isMonitoring());
        pOn = true;
      }
    } else {
      pOn = false;
      in.disableMonitoring();
    }
  } else {
    kemosabe.unmute();
    hera.unmute();
    hotlinebling.unmute();
    time.unmute();
  }

  //Hera koka hallatszik 
  if (keyPressed ) {
    if (key=='0') 
      time.mute();
  } else {
    time.unmute();
  }

  if (keyPressed ) {
    if (key=='0') 
      kemosabe.mute();
  } else {
    kemosabe.unmute();
  }

  if (keyPressed ) {
    if (key=='0') 
      hotlinebling.mute();
  } else {
    hotlinebling.unmute();
  }

  //I've had hallatszik 
  if (keyPressed ) {
    if (key=='2') 
      hera.mute();
  } else {
    hera.unmute();
  }

  if (keyPressed ) {
    if (key=='2') 
      kemosabe.mute();
  } else {
    kemosabe.unmute();
  }

  if (keyPressed ) {
    if (key=='2') 
      hotlinebling.mute();
  } else {
    hotlinebling.unmute();
  }

  //Hotline bling
  if (keyPressed ) {
    if (key=='5') 
      hera.mute();
  } else {
    hera.unmute();
  }

  if (keyPressed ) {
    if (key=='5') 
      kemosabe.mute();
  } else {
    kemosabe.unmute();
  }

  if (keyPressed ) {
    if (key=='5') 
      time.mute();
  } else {
    time.unmute();
  }

  //Kemosabe hallatszik 
  if (keyPressed ) {
    if (key=='8') 
      hera.mute();
  } else {
    hera.unmute();
  }

  if (keyPressed ) {
    if (key=='8') 
      time.mute();
  } else {
    time.unmute();
  }

  if (keyPressed ) {
    if (key=='8') 
      hotlinebling.mute();
  } else {
    hotlinebling.unmute();
  }
}

void keyPressed() {
  if (key == 'm') {
   onOff = !onOff;
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Music Play/Pause Button</title>
      <link>https://forum.processing.org/two/discussion/20183/music-play-pause-button</link>
      <pubDate>Tue, 10 Jan 2017 22:21:21 +0000</pubDate>
      <dc:creator>tawn</dc:creator>
      <guid isPermaLink="false">20183@/two/discussions</guid>
      <description><![CDATA[<p>Hey i want a Play/Pause button in my Visualizer can you help me??</p>

<pre><code>import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

PImage hintergrund;

Minim minim;
AudioPlayer Player;
FFT fft;
int w;
int farbe;


void setup()
{
  size(500,300,P3D);
  minim = new Minim(this);
  Player = minim.loadFile("bla.mp3"); // Spielt die Mp3 datei ab
  Player.loop(); // Wiederholt den aktuellen Song
  fft = new FFT(Player.bufferSize(), Player.sampleRate());
  fft.logAverages(60, 7);
  stroke(255);
  w = width/fft.avgSize();
  strokeWeight(w);
  strokeCap(SQUARE);
  farbe = 0;

}

void draw()
{
  hintergrund = loadImage("hintergrund.jpg");
  image(hintergrund,0,0);

  fft.forward(Player.mix);

  colorMode(HSB);
  stroke(farbe, 255, 255);
  colorMode(RGB);

  for(int i = 0; i &lt; fft.avgSize(); i++){
    line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);

}

  farbe += 5;
  if( farbe &gt; 255)
  {
    farbe = 0;
  }
}
</code></pre>

<p>This is atm my Code
also i would donate a few euro if you can help me :)</p>
]]></description>
   </item>
   <item>
      <title>How to get one audio track to stop playing when another starts playing (Minim)</title>
      <link>https://forum.processing.org/two/discussion/19857/how-to-get-one-audio-track-to-stop-playing-when-another-starts-playing-minim</link>
      <pubDate>Tue, 20 Dec 2016 22:09:19 +0000</pubDate>
      <dc:creator>amumu</dc:creator>
      <guid isPermaLink="false">19857@/two/discussions</guid>
      <description><![CDATA[<p>I have two soundtracks- one named rain and another named heartbeat. The goal is to trigger these audio files when a key is pressed. My problem is that I need to ensure that when one is playing the other stops, and for some reason processing isn't recognizing the .stop() or .pause() functions.</p>

<p>I'm only a beginner with code, so if anyone can let me know what I'm doing wrong/how I can fix this, I'd appreciate it a lot!</p>

<pre><code>    import ddf.minim.spi.*;
    import ddf.minim.signals.*;
    import ddf.minim.*;
    import ddf.minim.analysis.*;
    import ddf.minim.ugens.*;
    import ddf.minim.effects.*;

    Minim minim;
    AudioPlayer heartbeat;
    AudioPlayer rain; 

    void setup()
    {
      size(400, 600);
      minim = new Minim(this);
      heartbeat = minim.loadFile("heartbeat.mp3");
      rain = minim.loadFile("rainforest.mp3");
    }

    void draw() {
      background(0);
      stroke(255);
    }

    void keyPressed() {
      if (key == 'h') {
        heartbeat.rewind();
        heartbeat.play();
        if (key == 'p') {
            heartbeat.pause(); }
      }
       if (key == 'r' &amp;&amp; !rain.isPlaying()) {
        rain.rewind();
        rain.play();
        if (key == 's') {
            rain.pause(); }
      }
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Reading several files using multiple audioplayers, minim library</title>
      <link>https://forum.processing.org/two/discussion/19236/reading-several-files-using-multiple-audioplayers-minim-library</link>
      <pubDate>Wed, 23 Nov 2016 10:59:14 +0000</pubDate>
      <dc:creator>lolonulu</dc:creator>
      <guid isPermaLink="false">19236@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I am trying to read several files using multiple audioplayers with minim library.</p>

<p>There are 4 .wav files corresponding to a zone, when one plays the others stop.</p>

<p>I am stuck with the index and would very much appreciate some help.</p>

<p>Thanks a lot in advance !</p>

<p>best,
laurent</p>

<pre><code>import ddf.minim.*;

Minim minim;
String [] fileNames = {"MOUSE", "WORDS", "FLOW", "VORTEX"};
int numSounds = fileNames.length-1;
int Border = 50;
/**AudioPlayer sounds1;
 AudioPlayer sounds2;
 AudioPlayer sounds3;
 AudioPlayer sounds4;*/
AudioPlayer [] sounds = new AudioPlayer[numSounds];
int idx;

void setup () {
  size(1080, 1080, P2D);
  minim = new Minim (this);
  /*sounds1 = minim.loadFile("MOUSE.wav");
   sounds2 = minim.loadFile("WORDS.wav");
   sounds3 = minim.loadFile("FLOW.wav");
   sounds4 = minim.loadFile("VORTEX.wav");*/

    for (byte idx = 0; idx != numSounds;
sounds[idx] = minim.loadFile (fileNames [idx++] +".wav"));

}
void draw() {
  background (255);
  fill(255, 0, 0);
  rect(25, 25, 50, 50);

  fill(0, 0, 255);
  rect(125, 25, 50, 50);
}

void mouseMoved() {
  if (mouseX &gt; Border &amp;&amp; mouseX &lt; 350) {
    sounds [(int)(idx)].play(); 

    println("sound0:"+sounds);
  } else if (mouseX &lt; 750) {

  } else {
  } 
  if (mouseX &lt; Border &amp;&amp; mouseX &gt; height-Border) {
  }

}
    void stop() {
      for ( byte idx = 0; idx != numSounds; sounds[idx++].close() );
      minim.stop();
      super.stop();
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Help add array</title>
      <link>https://forum.processing.org/two/discussion/17713/help-add-array</link>
      <pubDate>Mon, 01 Aug 2016 04:57:36 +0000</pubDate>
      <dc:creator>triple0</dc:creator>
      <guid isPermaLink="false">17713@/two/discussions</guid>
      <description><![CDATA[<p>Can someone help me incorporate a video array of up to 6 videos into this code provided? Including a void mousePressed function to click through to the next video. The way this code is written is so the video doesn't play naturally from start to finish~ so it can't be a timer function that simply plays all the videos after one another. The end result should be a basic video slideshow loop ONLY when clicked to view the next video.</p>

<pre><code>import processing.video.*;

Movie mov;
int newFrame = 0;

void setup() {
  size(640, 360);
  background(0);
  // Load and set the video to play. Setting the video 
  // in play mode is needed so at least one frame is read
  // and we can get duration, size and other information from
  // the video stream. 
  mov = new Movie(this, "transit.mov");  

  // Pausing the video at the first frame. 
  mov.play();
  mov.jump(0);
  mov.pause();
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  background(0);
  image(mov, 0, 0, width, height);
  fill(255);
  text(getFrame() + " / " + (getLength() - 1), 10, 30);
  int f=ceil (map(mouseX,0,width,1,getLength()));
  setFrame(f);
}

//void keyPressed() {
//  if (key == CODED) {
//    if (keyCode == LEFT) {
//      if (0 &lt; newFrame) newFrame--; 
//    } else if (keyCode == RIGHT) {
//      if (newFrame &lt; getLength() - 1) newFrame++;
//    }
//  } 
//  setFrame(newFrame);  
//}

int getFrame() {    
  return ceil(mov.time() * 30) - 1;
}

void setFrame(int n) {
  mov.play();

  // The duration of a single frame:
  float frameDuration = 1.0 / mov.frameRate;

  // We move to the middle of the frame by adding 0.5:
  float where = (n + 0.5) * frameDuration; 

  // Taking into account border effects:
  float diff = mov.duration() - where;
  if (diff &lt; 0) {
    where += diff - 0.25 * frameDuration;
  }

  mov.jump(where);
  mov.pause();  
}  

int getLength() {
  return int(mov.duration() * mov.frameRate);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Can I pauze a movie frame by frame?</title>
      <link>https://forum.processing.org/two/discussion/17628/can-i-pauze-a-movie-frame-by-frame</link>
      <pubDate>Sat, 23 Jul 2016 15:06:13 +0000</pubDate>
      <dc:creator>Maarten</dc:creator>
      <guid isPermaLink="false">17628@/two/discussions</guid>
      <description><![CDATA[<p>I am new to this forum but I really hope you can help me out on this one.</p>

<p>I'm trying to blend multiple movies into one. For blending multiple images I already got my code to work quite nicely I think (example below). Now I want to do the same for every frame in multiple movies. <a rel="nofollow" href="https://www.youtube.com/watch?v=VSUk9RUPwtM">I experimented with this somewhat </a> and I can get the movie frames to blend on click. Now I want to blend every frame. So my code is this:</p>

<pre><code>import processing.video.*;

Movie movie1;
Movie movie2;

void setup (){
  size(1280,720);

  movie1 = new Movie(this, "MVI_8256.MOV");
  movie2 = new Movie(this, "MVI_8257.MOV"); 

  movie1.play();
  movie2.play();
}

void movieEvent (Movie m){
  m.pause();
  if (movie1.available() &amp;&amp; movie2.available()){
    movie1.read();
    movie2.read();
    blend(); 
    movie1.play();
    movie2.play();
  }
}

void blend(){
  //code to blend
}

void draw (){
  image(movie1, 0, 0, 640, 360);
  image(movie2, 0, 640, 640, 360);
}
</code></pre>

<p>To me it looks as though the logic should work but i get a <em>JNA: could not detach thread</em> error. It seems that I can't pause a movie inside the movieEvent().</p>

<p>Hopefully one of you can help me out with some good advice!</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/195/7FS0765N5ELA.jpg" alt="result3" title="result3" /></p>
]]></description>
   </item>
   <item>
      <title>p5.js sound does not work in Chrome and Safari but works in Firefox</title>
      <link>https://forum.processing.org/two/discussion/17435/p5-js-sound-does-not-work-in-chrome-and-safari-but-works-in-firefox</link>
      <pubDate>Wed, 06 Jul 2016 16:00:00 +0000</pubDate>
      <dc:creator>theotrst</dc:creator>
      <guid isPermaLink="false">17435@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I am a new member here, and I probably miss a detail...but I prepared an audio survey and I've tested it offline
in P5js and Firefox works properly, while it doesnt work in Chrome, Safari...
I already tested P5.js online examples and I recently updated the libraries (p5.sound.js)</p>

<p>BTW, I have this code for a "PLAY/PAUSE" button</p>

<p><em>function togglePlaying() {
 if (!song.isPlaying()) {
   song.play();
  button.html("pause");
  } else {
    song.pause();
    button.html("play");
  }
}</em></p>

<p>any suggestion... ?
many thanx
T</p>
]]></description>
   </item>
   <item>
      <title>Problem with toggling between multiple videos on processing 2.2.1</title>
      <link>https://forum.processing.org/two/discussion/7852/problem-with-toggling-between-multiple-videos-on-processing-2-2-1</link>
      <pubDate>Wed, 29 Oct 2014 08:11:12 +0000</pubDate>
      <dc:creator>silvergravel</dc:creator>
      <guid isPermaLink="false">7852@/two/discussions</guid>
      <description><![CDATA[<p>hi,<br />
so im quite a noob, just clearing that.<br />
im working on a project which involves switching between multiple videos on processing when i press a key. im trying to do some initial testing right now, and trying to get processing to switch between two videos on keypress. the video switches alright, but i cant see it in the applet window! the previous video ( in the paused state continues to stay on top ) . how do i fix this?? please help. find the code below -</p>

<pre><code>    import processing.video.*;

    Movie theMov;
    Movie theMov2;



    void setup() { 
      size(1440, 900);
      theMov = new Movie(this, "sin_city.mp4");
      theMov2 = new Movie(this, "blue_velvet.mp4");

      theMov.stop();  
      theMov2.stop();
    }

    void draw() { 
      background (0);
      image(theMov, 0, 0);
      image(theMov2, 0, 0); 
    } 

    void movieEvent(Movie m) { 
      m.read(); 
    } 

    void keyPressed(){
      if (key == 'p'){

            theMov2.pause();
            background(0);
            theMov.play();

              } else if (key == 'o'){

                       theMov.pause();
                       background(0);
                       theMov2.play();

                     }


}
</code></pre>
]]></description>
   </item>
   <item>
      <title>play sound when mouse pressed and paused when released</title>
      <link>https://forum.processing.org/two/discussion/16909/play-sound-when-mouse-pressed-and-paused-when-released</link>
      <pubDate>Mon, 30 May 2016 23:21:59 +0000</pubDate>
      <dc:creator>jgeier</dc:creator>
      <guid isPermaLink="false">16909@/two/discussions</guid>
      <description><![CDATA[<p>Hey guys, I'm trying to code a guitar hero like game for my school project. My goal is to have a guitar with different colors on the neck and depending on which color I press with the mouse a different note play. I'm not sure how to use a sound based on the X,Y position of the mouse and then have the sound play when the mouse is pressed and stop playing when the mouse is released. Any help would be appreciated!</p>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>Arduino + LDR Sensor + Processing</title>
      <link>https://forum.processing.org/two/discussion/16615/arduino-ldr-sensor-processing</link>
      <pubDate>Sun, 15 May 2016 15:41:01 +0000</pubDate>
      <dc:creator>Vasco</dc:creator>
      <guid isPermaLink="false">16615@/two/discussions</guid>
      <description><![CDATA[<p>At the time i dont have the arduino or the light sensors, i will only work on that tomorrow =/. But at processing i'm trying some stuff. The idea is to have a video always in loop, but every time i take the light of a sensor (either if i put my finger on the sensor or a cloth) it show's another video, but when that sensor got light again it goes to the loop video.</p>

<p>This is what i got so far, still missing the keyPressed as a substitute of the sensors. The problem is the videos are all runing ate the same the time, and i've no idea how to do the keyPressing to call the other videos. Its the first time i'm using this library, and i really need help on this.</p>

<pre>
import processing.video.*;

String[] movieList = {"movie/x.mov", "movie/y.mov", "movie/w.mov", "movie/z.mov"};
Movie[] filmes = new Movie[movieList.length];

void setup() {
  size(1280, 720);
  //fullScreen();
  background (0);
  frameRate(60);

  for (int i = 0; i &lt; movieList.length; i++)
  {
    filmes[i] = new Movie(this, movieList[i]);
    filmes[i].loop();
  }
}

void draw() 
{
  for (int i = 0; i &lt; movieList.length; i++)
  {
    image(filmes[i], 0, 0);
  }
}

void movieEvent(Movie m) 
{
  m.read();
}

</pre>
]]></description>
   </item>
   <item>
      <title>Minim pause() does not work</title>
      <link>https://forum.processing.org/two/discussion/16413/minim-pause-does-not-work</link>
      <pubDate>Tue, 03 May 2016 20:37:44 +0000</pubDate>
      <dc:creator>pet0103</dc:creator>
      <guid isPermaLink="false">16413@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I am working on a tangible music player with Arduino and for this I am using the minim library. However, the player.pause() function does not work in my code. It only stops the song for a few milliseconds and then continues to play the song.</p>

<p>The code for the pause function is as the following:</p>

<pre lang="javascript">
    boolean state = false;
    
    if (keyPressed) {
        if (key == 'p' &amp;&amp; !state) {
          state = true;
          player[currentSong].pause();
        }
        else if (key == 'p' &amp;&amp; state) {
        state = false;
        player[currentSong].play();
      }
</pre>

<p>Is there something else that I have to add in order to let it pause until I press the P key again?</p>
]]></description>
   </item>
   <item>
      <title>Not sure how to go about it. (play video on key press)</title>
      <link>https://forum.processing.org/two/discussion/16242/not-sure-how-to-go-about-it-play-video-on-key-press</link>
      <pubDate>Mon, 25 Apr 2016 13:34:52 +0000</pubDate>
      <dc:creator>Sborgia</dc:creator>
      <guid isPermaLink="false">16242@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I'm trying to figure out how I would go about creating a code that will trigger a video when I hit a certain key on the keyboard. the key doesn't have to be specific, I have found various other example codes that trigger other things when you hit a key but not ones that integrate a video. Any help would be greatly appreciated! Thank you.</p>
]]></description>
   </item>
   </channel>
</rss>