我试图根据什么"区域"来尝试播放不同的音频文件。单击了我的window.name
草图。我在点击第一个区域时遇到问题Processing
甚至只播放一个文件。
我已导入soundFile
但我必须有语法或目录错误。这是我不断得到的信息:
sound library
首先,是否可以加载5个不同的声音文件作为Error: Soundfile doesn't exist. Pleae check path
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.
语句的条件?
代码在这里:
if
答案 0 :(得分:2)
用minim
解决了这个问题。代码如下:
PImage img; // Declare variable "a" of type PImage
import ddf.minim.*;
AudioPlayer player;
Minim minim;
void setup() {
size(1475, 995);
// The image file must be in the data folder of the current sketch
// to load successfully
img = loadImage("PaceTaker.jpg"); // Load the image into the program
minim = new Minim(this);
player = minim.loadFile("Heartbeatreg.mp3");
}
void draw() {
// Displays the image at its actual size at point (0,0)
image(img, 0, 0);
}
void mousePressed() {
if (mouseX>105 && mouseX<337 && mouseY>696 && mouseY<714){
if (player.isPlaying()) {
player.close();}
player = minim.loadFile("Heartbeatreg.mp3");
player.play();
stroke(0);
}
else if (mouseX>410 && mouseX<584 && mouseY>696 && mouseY<714) {
if (player.isPlaying()) {
player.close();}
player = minim.loadFile("Heartbeatflatline.mp3");
player.play();
stroke(0);
}
else if (mouseX>659 && mouseX<837 && mouseY>696 && mouseY<714) {
if (player.isPlaying()) {
player.close();}
player = minim.loadFile("Heartbeatsuperfast.mp3");
player.play();
stroke(0);
}
else if (mouseX>928 && mouseX<1065 && mouseY>696 && mouseY<714) {
if (player.isPlaying()) {
player.close();}
player = minim.loadFile("Heartbeatslow.mp3");
player.play();
stroke(0);
}
else if (mouseX>1123 && mouseX<1397 && mouseY>696 && mouseY<714) {
if (player.isPlaying()) {
player.close();}
player = minim.loadFile("Heartbeatfast.mp3");
player.play();
stroke(0);
}
else {
println("void click");
}
}
答案 1 :(得分:2)
你真的不应该像这样加载SELECT c.complain_desc, cr1.status_id, cs.name AS status_desc
FROM complain AS c
INNER JOIN complain_review AS cr1
ON cr1.complain_id = c.id
LEFT OUTER JOIN complain_review AS cr2
ON cr2.complain_id = c.id AND (cr2.date > cr1.date OR cr2.date = cr1.date AND cr2.id > cr1.id)
INNER JOIN complain_status AS cs
ON cs.id = cr1.status_id
WHERE cr2.id IS NULL;
内的文件。相反,将它们全部加载到mousePressed()
内,然后在需要时引用它们。这是一个例子:
setup()