why sounds doesn't play twice!!
in
Core Library Questions
•
4 months ago
Hellow.
i am making a program.
this program is simple but i am suffering now.
when line touch the dot,
dot will change color with play sound what she already have it.
ex)
do re do re re mi -> play, play, mute, mute, play
but color changes very well itself..
i dont know why!!, just guess minim problem..
I am koran. because of it. im not familiar with english.
i know you are very hard to understand.
i wish youguys understanding the point what i want to say.
(with kind english);
}
but I am very thank you for your answering or helping or kind a hint!!!!!!
very very thankyou
very very thankyou
- import ddf.minim.spi.*;
- import ddf.minim.signals.*;
- import ddf.minim.*;
- import ddf.minim.analysis.*;
- import ddf.minim.ugens.*;
- import ddf.minim.effects.*;
- Minim minim = new Minim(this);
- Dot[] dots = new Dot[40]; //랜덤으로 불러낼 음표의 수
- int totalDots = 0; //초기화
- int lineX = 0;
- AudioPlayer playDo;
- AudioPlayer playRe;
- AudioPlayer playMi;
- AudioPlayer playPa;
- AudioPlayer playSol;
- AudioPlayer playRa;
- AudioPlayer playSi;
- AudioPlayer playDo_2;
- AudioPlayer playRe_2;
- AudioPlayer playMi_2;
- AudioPlayer playPa_2;
- void setup(){
- size(1200,130);
- playDo = minim.loadFile("do.wav");
- playRe = minim.loadFile("re.wav");
- playMi = minim.loadFile("mi.wav");
- playPa = minim.loadFile("pa.wav");
- playSol = minim.loadFile("sol.wav");
- playRa = minim.loadFile("ra.wav");
- playSi = minim.loadFile("si.wav");
- playDo_2 = minim.loadFile("do_2.wav");
- playRe_2 = minim.loadFile("re_2.wav");
- playMi_2 = minim.loadFile("mi_2.wav");
- playPa_2 = minim.loadFile("pa_2.wav");
- }
- void draw (){
- background(255);
- // ---------------------------------
- for (int i = 0; i< 5; i++){
- line (30, 30+14*i, 1170, 30+14*i);
- }
- // ---------------------------------
- // ---------------------------------
- dots[totalDots] = new Dot(0);
- totalDots++;
- if (totalDots >= dots.length) {
- totalDots = 39;
- }
- for (int i = 0; i < totalDots; i++ ) {
- dots[i].pot();
- }
- // ---------------------------------
- // --------------------------------
- line(lineX,0,lineX,height);
- lineX++;
- // ---------------------------------
- }
- class Dot {
- float x, y;
- float r;
- int c;
- float l;
- Dot(int tempC) {
- r = 14; // Dot의 크기는 volume 크기를 나타냄.
- x = 100 + (int(random(0,50))*15); //
- y = 30+ (int(random(-1, 11))*14)/2; //
- c = tempC;
- l = 30;
- }
- void pot() {
- fill(c);
- ellipse (x, y, r, r);
- line (x+r/2, y, x+r/2, y-l);
- if (lineX > x && y<103 && y> 96){
- c =#FF7458;
- playDo.play();
- }
- else if (lineX > x && y<96 && y> 89){
- c =#FFA958;
- playRe.play();
- }
- else if (lineX > x && y<89 && y> 82){
- c =#FFF158;
- playMi.play();
- }
- else if (lineX > x && y<82 && y> 75){
- c =#ADFF58;
- playPa.play();
- }
- else if (lineX > x && y<75 && y> 68){
- c =#58FFF2;
- playSol.play();
- }
- else if (lineX > x && y<68 && y> 61){
- c =#5888FF;
- playRa.play();
- }
- else if (lineX > x && y<61 && y> 54){
- c =#7058FF;
- playSi.play();
- }
- else if (lineX > x && y<54 && y> 47){
- c =#C458FF;
- playDo_2.play();
- }
- else if (lineX > x && y<47 && y> 40){
- c =#FF58E3;
- playRe_2.play();
- }
- else if (lineX > x && y<40 && y> 33){
- c =#FF58BA;
- playMi_2.play();
- }
- else if (lineX > x && y<33 && y> 26){
- c =#FFAF00;
- playPa_2.play();
- }
- }
- }
1