setup minim problem...learner advice please
in
Core Library Questions
•
2 years ago
/* requires a sound samples to fully run, ...but i'm not getting that far even. fails at void setup even though i was doing ok until i added minim which is why i'm posting here. i think i'm not implementing minim correctly and that causes the error? OR i'm missing something too obvious...i would really value some advice - thank you :) the array is meant to be able to play back different samples when events as yet uncoded occur...
*/
import ddf.minim.signals.*;
Minim minim;
AudioPlayer player;
AudioInput input;
int cols = 4;
int rows = 4;
int samplecount;
//2D Module array;
Module[][] mods;
String sample = "audiosample"
void setup() {
size(800, 800);
mods = new Module[cols][rows];
int widthdiv = width / cols;
int heightdiv = height / rows;
samplecount = widthdiv * heightdiv;
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
// Initialize each object
mods[i][j] = new Module(i*widthdiv,j*heightdiv,widthdiv,heightdiv, sample + samplecount);
}
}
}
void draw() {
background(255);
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
mods[i][j].display();
}
}
}
////////
class Module {
AudioPlayer player;
float x, y; // x,y location
float w, h; // width and height
String sample;
// Constructor
Module(int tempX, int tempY, int tempW, int tempH, String sample) {
x = tempX;
y = tempY;
w = tempW;
h = tempH;
s = sample
}
//methods
void display() {
//a visualization rectangle only
//fill(127);
stroke(0);
rect(x, y, w, h);
}
void playsound() {
// load file
String name = name
minim = new Minim(this);
player = minim.loadFile(s, 2048);
}
//so (this) loop can be called from outside
void loop() {
}
void noLoop() {
}
}
1