Package horizons :: Package engine :: Module sound :: Class Sound
[hide private]
[frames] | no frames]

Class Sound

source code

Stuff related to engine & sound

Instance Methods [hide private]
 
__init__(self, engine) source code
 
end(self) source code
 
setup_sound(self) source code
 
enable_sound(self)
Enable all sound and start playing music.
source code
 
disable_sound(self)
Disable all sound outputs.
source code
 
check_music(self, refresh_playlist=False, play_menu_tracks=False)
Used as callback to check if music is still running or if we have to load the next song.
source code
 
play_sound(self, emitter, soundfile)
Plays a soundfile on the given emitter.
source code
 
set_volume_emitter(self, emitter, volume)
Sets the volume on the emitter specified by emitter_name.
source code
 
set_volume_bgmusic(self, volume)
Sets the volume for the backgroundmusic.
source code
 
set_volume_effects(self, volume)
Sets the volume for the effects, speech and ambient sounds.
source code
Method Details [hide private]

__init__(self, engine)
(Constructor)

source code 
Parameters:
  • engine - Fife from horizons.engine.engine

check_music(self, refresh_playlist=False, play_menu_tracks=False)

source code 

Used as callback to check if music is still running or if we have to load the next song.

Parameters:
  • refresh_playlist - Whether to update the playlist type (menu, ingame). refresh_playlist should e.g. be set when loading happens, after which we no longer want to play menu music. The current track, however, will still finish playing before choosing a new track.
  • play_menu_tracks - Whether to start the playlist with menu music. Only works with refresh_playlist=True.

play_sound(self, emitter, soundfile)

source code 

Plays a soundfile on the given emitter.

Parameters:
  • emitter - string: name of emitter that is to play the sound
  • soundfile - string: path to the sound file we want to play

set_volume_emitter(self, emitter, volume)

source code 

Sets the volume on the emitter specified by emitter_name.

Parameters:
  • emitter - string with the emitters name, used as key for the self.emitter dict
  • volume - double which volume the emitter is to be set to range[0, 1]

set_volume_bgmusic(self, volume)

source code 

Sets the volume for the backgroundmusic.

Parameters:
  • volume - double which volume the emitter is to be set to range[0, 1]

set_volume_effects(self, volume)

source code 

Sets the volume for the effects, speech and ambient sounds.

Parameters:
  • volume - double which volume the emitter is to be set to range[0, 1]