sounds only playing once

context: new to OF. iOS app using xcode. graphics and touch controls work fine, trying to set up audio.

I try to play an mp3 file with an ofSoundPlayer, it works the first time, and then does nothing every subsequent time.
I’ve compiled the soundplayer example and that works fine, but doing the same things in this existing project fails.

I’ve commented out everything else so what’s happening is just this:

  
int main()  
{  
ofSetupOpenGL(SCREEN_WIDTH, SCREEN_HEIGHT, OF_FULLSCREEN);  
ofRunApp(new mainApp);  
}  
  
void mainApp::setup()  
{  
sound.loadSound("boom.mp3");  
sound.setMultiPlay(true);  
sound.setVolume(1.0f);  
}  
  
void mainApp::update() { ofSoundUpdate(); }  
  
void mainApp::touchDown(ofTouchEventArgs &touch) { sound.play(); }  
  

…and the behaviour’s unchanged. Tried various permutations with no effect - multiplay off, setting volume after each play, loading the file again for each play, using ofxOpenALSoundPlayer instead of just ofSoundPlayer.

This is driving me crazier. Any ideas?

Thanks.

Hi,

I had a similar problem. try to get the develop-branch from github as it contains some fixes for ofSoundPlayer.
If you already cloned openFrameworks via git clone you do it like this:
cd /$yourOfxDir/
git pull origin develop
cd /yourOfxDir/libs/openFrameworksCompiled/project/linux64/
make Clean
make
cd /$yourOfxDir/apps/$yourApp/
make

Thanks, but no luck. =[
I’ve grabbed the develop branch and rebuilt everything, but still the same exact problem.

Sounds frustrating. I’ve seen quite a few bugfixes around sound in iOS, but I think it’s working pretty well now. The big one I know of is https://github.com/openframeworks/openFrameworks/issues/863 but even that is fixed. Could you post up some more of your code so I could maybe try to debug it a bit?

Experimenting with the soundplayerexample project, I’ve deduced that this is a problem with mp3 files. The “.caf” files that come with the example work fine. Plus I’m getting this output now: “error, cannot get position on mp3s in openAL”, “error, cannot set multiplay on mp3s in openAL”.

So it’s pretty annoying but I guess I can work around it. =/

Hi all!

I’m having the same problem!
Anyone as manage to solve this?

thanks