I’m stuck. I’m making a school project using open frameworks.
I’m trying to make a audio player that plays an audio sample when you push a button. This sample fades in and it has to fade out when you push another button, when a new audio sample fades in.
I made it this way now:
//--------------------------------------------------------------
void testApp::setup(){
hail.loadSound(“Hail.mp3”);
abba.loadSound(“Abba.mp3”);
black.loadSound (“Black.mp3”);
johnny.loadSound(“Johnny.mp3”);
peggy.loadSound (“Peggy.mp3”);
tex.loadSound(“Tex.mp3”);
}
//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
void testApp::draw(){
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){
if (key == ‘q’){
; hail.play();
} else if (key == ‘w’){
;hail.stop();
; abba.play();
}
else if (key == ‘e’){
;abba.stop();
;black.play();
}
else if (key == ‘r’){
;black.stop ();
;johnny.play();
}
else if (key == ‘t’){
;johnny.stop();
;peggy.play();
}
else if (key == ‘y’){
peggy.stop();
tex.play ();
}
}
This doesn’t to the trick. Because now you can only get the right result when pressing the buttons in that order…
Can someone help me out?