Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 25, 2013 1:57 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon May 03, 2010 12:36 pm 
Offline

Joined: Mon May 03, 2010 12:24 pm
Posts: 2
Hi All,

New to Slick (and loving it), but having some problems with sound.

So at load time have something like:

Sound waterfall = new Sound("assets/sfx/waterfall.wav");

Then in the game loop as the player gets close to the waterfall:

if (playerIsCloseToWaterfall) {
if (!waterfall.playing()) {
waterfall.loop();
}
} else {
if (waterfall.playing()) {
waterfall.stop();
}
}

This works fine to start, so the player comes close and the waterfall sound starts playing and as the player leaves the waterfall sound stops. However, once the waterfall sound stops, all sounds in the game will no longer play (for example jump sound). If I go back to the waterfall the sound starts again and I can hear the jump sound again, but once I leave all sound is gone.

I have seen this on Windows XP and Windows Vista.

I couldn't find any mention of this on the boards, so thought I would post here. Appreciate any help.

Matt


Top
 Profile  
 
 Post subject: Possible Solution
PostPosted: Tue May 04, 2010 2:22 am 
Offline

Joined: Wed Dec 24, 2008 1:13 am
Posts: 1
This fix may help:

AudioImpl.java

Code:
   /**
    * @see org.newdawn.slick.openal.Audio#stop()
    */
   public void stop() {
      if (index != -1) {
         store.stopSource(index);
         index = -1;
      }
   }


I think the index isn't being reset so that future calls to isPlaying() will use an invalid index and may be returning the state of the wrong source.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2010 6:18 pm 
Offline

Joined: Mon May 03, 2010 12:24 pm
Posts: 2
This did fix my problem. Thanks deerslyr1.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 13, 2010 7:44 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Thanks for the fix. Commited into SVN

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group