We are about to switch to a new forum software. Until then we have removed the registration on this forum.
This is my GUI BUTTON: I want to use it to play/pause my audio file:
public void imgButton1_click1(GImageButton source, GEvent event) { //_CODE_:imgButton1:842456:
println("imgButton1 - GImageButton >> 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();
}
Answers
In the button event handler you have
which doesn't make sense, think about it, then try this
Ah thank you very much! I still can't get the player to work though,1 I have successfully imported all my libraries.
Please edit your post, select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code.
You can explore previous posts working with the minim library: https://forum.processing.org/two/search?Search=minim or explore the examples that come with the library.
Kf
The audio file was corrupt. Quarks answer above was right. Thanks.