Hello @starzorrow ,
Here is an example that loads the sound file in the background and sets boolean flags for decisions on program flow/control:
//https://www.youtube.com/watch?v=P-KjGrbuov4
import processing.sound.*;
SoundFile file;
boolean loaded = false;
boolean done = false;
void setup()
{
size(300, 300);
textSize(48);
textAlign(CENTER, CENTER);
thread("loadFile");
}
void draw()
{
background(255, 0, 0);
if(loaded == true)
{
file.play();
//Volume meter(0-1)
file.amp(1);
loaded = false;
done = true;
}
if(done == false)
{
fill(255);
textSize(48);
text(frameCount, width/2, height/2-10);
return; // jumps to end of draw() function
}
// Resume draw() cycle...
background(0, 255, 0);
fill(0);
text(frameCount, width/2, height/2-10);
}
void loadFile()
{
file = new SoundFile(this, "Loituma - Ievas polka Ievan Polkka good sound.mp3");
loaded = true;
}
Please looks up all references to code here:
The draw() reference states:
All Processing programs update the screen at the end of draw(), never earlier.
This also applies to setup() as well which is frameCount = 0;
When testing your code I had to add a fill(255) for the text otherwise I did not see the text on the black background.
:)