<?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 loop() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=loop%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:44:22 +0000</pubDate>
         <description>Tagged with loop() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedloop%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>How do I make each sound file play separately on different screens? p5</title>
      <link>https://forum.processing.org/two/discussion/27563/how-do-i-make-each-sound-file-play-separately-on-different-screens-p5</link>
      <pubDate>Sat, 31 Mar 2018 01:09:28 +0000</pubDate>
      <dc:creator>rimai</dc:creator>
      <guid isPermaLink="false">27563@/two/discussions</guid>
      <description><![CDATA[<p>I have 8 seperate sound files for 8 different screens (Want to play the first one for screen 1, the second one for screen 2 etc), however it's playing them all at once in every screen?</p>

<p>Currently I have this in a function called chooseSong();  (for all 8 sound files):</p>

<pre><code>if(screen === 1){
song1.loop();
song1.play();
} else {song1.stop();
       }

if(screen === 2){
song2.loop();
song2.play();
} else {song2.stop();
       }
</code></pre>

<p>What am I doing wrong lol, I'm just a beginner with p5 so I have no clue :)</p>
]]></description>
   </item>
   <item>
      <title>The sound file does not loop</title>
      <link>https://forum.processing.org/two/discussion/26892/the-sound-file-does-not-loop</link>
      <pubDate>Sun, 18 Mar 2018 00:22:42 +0000</pubDate>
      <dc:creator>yuhi1920</dc:creator>
      <guid isPermaLink="false">26892@/two/discussions</guid>
      <description><![CDATA[<p>Hi Community,</p>

<p>I have got a problem that my sound file can't loop! I tried decreasing the bitrate, which does not work.</p>

<p>Help somebody could help me! Thank you very much!!!!</p>

<p>Here is my main tab! My classes are too long and maybe not related to the sound loop problem.So i did not include them.If the main tab does not have any question,i will go to check my classes.</p>

<pre><code>import g4p_controls.*;
PImage back;

import processing.sound.*; 
SoundFile BGM;


void setup() {
  size(1800, 1000);
  back= loadImage("background13.png");
  textAlign(CENTER, CENTER);
  imageMode(CENTER);
  iniTial();
  createGUI();
  BGM = new SoundFile (this,"BGM.mp3"); 
  BGM.loop();
}


void draw() {
  background(255, 255, 255);
  drawBackground();
  keepersActivity();
  ballActivity();
  winSign();
  chaser_gryffindoActivity();
  chaser_slytherinActivity();

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to pause sketch</title>
      <link>https://forum.processing.org/two/discussion/25063/how-to-pause-sketch</link>
      <pubDate>Fri, 17 Nov 2017 13:21:31 +0000</pubDate>
      <dc:creator>jmean</dc:creator>
      <guid isPermaLink="false">25063@/two/discussions</guid>
      <description><![CDATA[<p>I have an array of lines that draw a 10print pattern.</p>

<p>I then have the lines rotate. 
I want to pause the sketch for a second every 45 degree turn.</p>

<p>I can't come up with a condition that consistently triggers the noLoop() function without it drifting out of sync or causing the browser to crash.</p>

<p>Any ideas?</p>

<p>Code here: <a rel="nofollow" href="https://codepen.io/jmean/pen/ZaLyNJ">https://codepen.io/jmean/pen/ZaLyNJ</a></p>
]]></description>
   </item>
   <item>
      <title>Please explain me the effect of redraw() / loop() / noloop() here</title>
      <link>https://forum.processing.org/two/discussion/24833/please-explain-me-the-effect-of-redraw-loop-noloop-here</link>
      <pubDate>Wed, 01 Nov 2017 11:53:34 +0000</pubDate>
      <dc:creator>ddaann88</dc:creator>
      <guid isPermaLink="false">24833@/two/discussions</guid>
      <description><![CDATA[<p>Please explain me these cases:</p>

<h2>    1. If I run code below, the thick line is drawn after the 2nd click</h2>

<h2>    2. If I remove noLoop(); , the thick line is drawn after the 1st click</h2>

<h2>    3. If I remove loop(); , the thick line is not drawn, not matter how many clicks I perform</h2>

<h2>    4. If I remove noLoop(); and loop();, the thick line is drawn after the 1st click</h2>

<pre><code>         boolean ready_for_thick_line = false; 

         void mousePressed() {
           drawLine(10);
           ready_for_thick_line = true;
           redraw();
         }

         void drawLine(int width) {
           strokeWeight(width);
           line(20, 20, 80, 20);
         }

         void draw() {
         if (ready_for_thick_line) 
         {
            loop();
         }
         else{
            drawLine(1);
            noLoop();
         }  
        }
</code></pre>
]]></description>
   </item>
   <item>
      <title>loop() doesn't seem to work with P2D renderer.</title>
      <link>https://forum.processing.org/two/discussion/20978/loop-doesn-t-seem-to-work-with-p2d-renderer</link>
      <pubDate>Thu, 23 Feb 2017 21:15:31 +0000</pubDate>
      <dc:creator>Ystem</dc:creator>
      <guid isPermaLink="false">20978@/two/discussions</guid>
      <description><![CDATA[<p>I am running a system with a window that is hidden and then can come back. When it is hidden, noLoop() is called, and then loop() is called when restarting. It works fine, but when I switch to using P2D instead of the default renderer, draw stops getting called after restarting. I know that loop() is getting called, but draw is not getting called.</p>

<p>Note: I am removing all the window listeners from the window, maybe a window listener that is specific to the OpenGL version of the window is needed to make draw get called?</p>
]]></description>
   </item>
   <item>
      <title>Draw looping status -- best way of checking?</title>
      <link>https://forum.processing.org/two/discussion/18055/draw-looping-status-best-way-of-checking</link>
      <pubDate>Fri, 02 Sep 2016 21:56:42 +0000</pubDate>
      <dc:creator>jeremydouglass</dc:creator>
      <guid isPermaLink="false">18055@/two/discussions</guid>
      <description><![CDATA[<p>What is the best way of checking on the current Processing loop()/noLoop() status?</p>

<p>I have encountered situations in which I want to toggle looping rather than set it -- a simple example is: press space to pause/un-pause. I couldn't find anything in the <a rel="nofollow" href="https://processing.org/reference/">language reference</a> on looping status -- e.g. nothing referenced from <a rel="nofollow" href="https://processing.org/reference/loop_.html">loop()</a> or <a rel="nofollow" href="https://processing.org/reference/noLoop_.html">noLoop()</a>.</p>

<ul>
<li><code>isLooping()</code>: in the Processing javadocs I found the <a rel="nofollow" href="http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#isLooping--">PApplet.isLooping()</a> method -- however, I'm not sure if this is undocumented / do-not-use.</li>
<li><code>if(looping)</code>: in a <a rel="nofollow" href="https://github.com/processing/processing/issues/226">bug report</a> I found mention of a "looping" flag. Checking it works -- I can even set it directly, and it appears to have the same effect as loop() / noLoop() -- but I couldn't locate it in the github source, and it seems very undocumented...?</li>
</ul>

<p>I went ahead and created a sketch that demonstrates four methods of toggling the draw loop by pressing 1 / 2 / 3 / 4. All four methods work.</p>

<pre><code>boolean myLooping = true;

int bgBlue = 0;
void draw(){
    background( 0, 0, bgBlue );
    bgBlue = (bgBlue+3)%255;
}

void keyPressed(){
    switch(key){
        case '1':
            if(myLooping){ noLoop(); }
            else { loop(); }
            myLooping = !myLooping;
            break;
        //// check the `isLooping()` method
        case '2':
            if(isLooping()){ noLoop(); }
            else { loop(); }
            break;
        //// check `looping` and set with loop()/noLoop()
        case '3':
            if(looping){ noLoop(); }
            else { loop(); }      
            break;
        //// flip `looping` directly
        case '4':
            looping = !looping;
            break;
    }
}
</code></pre>

<p>Just writing <code>looping = !looping;</code> is the most concise, but it is also the most undocumented. Given how complex the looping model is in Processing, any advice on advantages / drawbacks to using any of these methods (or others not mentioned here) to detect the looping status or to toggle it?</p>
]]></description>
   </item>
   <item>
      <title>Getting sound to not overlap</title>
      <link>https://forum.processing.org/two/discussion/13850/getting-sound-to-not-overlap</link>
      <pubDate>Wed, 09 Dec 2015 03:24:53 +0000</pubDate>
      <dc:creator>matmelo649</dc:creator>
      <guid isPermaLink="false">13850@/two/discussions</guid>
      <description><![CDATA[<p>Hi, first time posting here. Im extremely new to coding in general, but Im in a class that uses Processing. So I need help in THE most simplest terms imaginable lol. I have an assignment to make a very simple video game. The only problem Im having is that the background music I have set up to play continually starts to play another file of the mp3 ontop of the original. The end result being the song playing over itself hundreds of times, just milliseconds apart from each other. I set up an if statement to turn the bgm to false as soon as it starts to play, which solves the multiple songs playing at once, but when the song is over I cannot get it to loop. I need the song to just immediately play again as soon as it ends. What is the simplest way to achieve this?</p>
]]></description>
   </item>
   </channel>
</rss>