Package fife :: Package extensions :: Module soundmanager :: Class SoundManager
[hide private]
[frames] | no frames]

Class SoundManager

source code

object --+
         |
        SoundManager

A simple sound manager class.

This class manages and plays all the sounds of the game. It creates SoundEmitters and ensures that there is only one fife.SoundEmitter per unique sound.

Instance Methods [hide private]
 
__init__(self, engine)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
SoundEmitter
createSoundEmitter(self, filename, forceUnique=False, position=None)
Returns a valid SoundEmitter instance.
source code
 
playClip(self, clip)
Plays a sound clip.
source code
 
unregisterClip(self, clip) source code
 
stopClip(self, clip)
Stops playing the sound clip.
source code
 
stopAllSounds(self) source code
 
destroy(self)
Releases all instances of fife.SoundEmitter.
source code
 
_getRolloff(self) source code
 
_setRolloff(self, rolloff) source code
 
_getListenerPosition(self) source code
 
_setListenerPosition(self, position) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  rolloff = property(_getRolloff, _setRolloff)
  listenerposition = property(_getListenerPosition, _setListener...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, engine)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • engine (fife.Engine) - A reference to the FIFE engine
Overrides: object.__init__

createSoundEmitter(self, filename, forceUnique=False, position=None)

source code 

Returns a valid SoundEmitter instance.

Parameters:
  • filename - The relative path and filename of the sound file
  • forceUnique (boolean) - This forces a new fife.SoundEmitter to be created. This is useful if you want more than one instance of the same sound to be played at the same time.
  • position (tuple) - The position on the map that the sound emitter is to be created at.
  • clip (string)
Returns: SoundEmitter
Returns a new SoundEmitter instance.

playClip(self, clip)

source code 

Plays a sound clip.

This function does not use the fife.SoundEmitter "looping" property to loop a sound. Instead it registers a new timer and uses the duration of the clip as the timer length.

If the SoundEmitter is invalid (no fifeemitter) then it attempts to load it before playing it.

Parameters:

Note: This will stop any clips that use the same fife.SoundEmitter. You cannot play the same sound more than once at a time unless you create the SoundEmitter with the forceUnique paramater set to True.

stopClip(self, clip)

source code 

Stops playing the sound clip. Note that this will stop all clips that use the same FIFE emitter.

Parameters:

destroy(self)

source code 

Releases all instances of fife.SoundEmitter.

Note: This does not free the resources from the FIFE sound clip pool.


Class Variable Details [hide private]

listenerposition

Value:
property(_getListenerPosition, _setListenerPosition)