Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3507 Members - Latest Member: PienueDut

26. May 2012, 12:30:45 pm
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Sound state
Pages: [1]
Print
Author Topic: Sound state  (Read 756 times)
nooc
Just dropped in

Offline Offline

Posts: 4


View Profile
« on: 20. September 2009, 03:39:26 am »

Would be nice to have a sound state listener, for example:

Code:
interface SoundStateListener {

   abstract void soundStateChanged(Sound sound, SoundState state);
   abstract void soundLooped(Sound sound);
}

class Sound ... {

...

   static final int LISTEN_STATE =1; // flag for receiving soundStateChanged
   static final int LISTEN_LOOP =2; // flag for receiving soundLooped

...

public void addSoundStateListener(SoundStateListener listener, int flags);
public void removeSoundStateListener(SoundStateListener listener);

...

}

What do you think?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 20. September 2009, 12:16:35 pm »

The problem is, that the sound driver (e.g. JOAL) does the looping internally. So there doesn't seem to be a way to detect, when the sound was looped. The state change is a user action. So you can easily track that on your own.

Marvin
Logged
nooc
Just dropped in

Offline Offline

Posts: 4


View Profile
« Reply #2 on: 20. September 2009, 05:57:51 pm »

Streaming sounds are not processed internally and also, there is AL_SAMPLE_OFFSET and AL_SEC_OFFSET  that can be checked. It shouldn't be a problem.
While play is a user action, stop is not always one. It would be nice if one could fire-and-forget a sound and then later be notified when it stops. For example, play a voice dialog and at the end, execute an action, this without having to think about timing.
Sound event systems are very useful. Many good sound systems have them.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic