Hello,
I seem to be running into an issue with playing sound samples.
I am loading multiple samples in the header, i.e.:
ofSoundPlayer icons_group_001_sound;
ofSoundPlayer music1a;
then in setup:
icons_group_001_sound.loadSound("sounds/synth.wav");
icons_group_001_sound.setSpeed(3.0f);
icons_group_001_sound.setPan(0.0f);
icons_group_001_sound.setVolume(0.75f);
music1a.loadSound("sounds/beat.wav");
music1a.setSpeed(3.0f);
music1a.setPan(0.0f);
music1a.setVolume(0.75f);
I have an ofSoundUpdate() in the update and a function in the mousemove which checks where the mouse is and should play a sound sample if the mouse is at a certain location
void ofApp::soundOverSomething() {
if (over_001 && !played_001_A && ( ofDist(ofGetMouseX(), ofGetMouseY(), 538, 385 ) <= 12) ) {
music1a.play();
played_001_A = true;
}
}
}
Unfortunately music1a.play() does not play the sound sample which is really odd, because it’s set up in the same exact way as the icons_group_001_sound, which works just fine! If I replace it with icons_group_001_sound.play() it plays the sound file. The sound samples are from the examples audio data folder. and even if I set the music1a to synth.wav, it still doesn’t play anything, so I’m really confused here. Does it matter when I initialize the wav files? should they be loaded at the beginning of the code? Or am I missing something?
I’m on Xcode if that matters.
Thanks!