C# Class FlatRedBall.Audio.AudioManager

Exibir arquivo Open project: vchelaru/FlatRedBall

Public Properties

Property Type Description
GlobalVariables SoundGlobalVariableCollection
SoundListener PositionedSoundListener

Public Methods

Method Description
AddSoundBank ( string soundBankFile ) : void

Adds a sound bank

AddWaveBank ( string waveBankFile ) : void

Adds a wave bank

GetPositionedSound ( String soundName ) : PositionedSound

Gets a positioned sound

GetPositionedSound ( String soundName, string soundBankFile ) : PositionedSound

Gets a positioned sound

GetSound ( String soundName ) : Sound

Gets a sound

GetSound ( String soundName, string soundBankFile ) : Sound

Gets a sound

HasSoundBank ( string soundBankFile ) : bool

Whether or not the given sound bank file has been loaded

HasWaveBank ( string soundBankFile ) : bool

Whether or not the given wave bank file has been loaded

Initialize ( String settingsFile, String waveBankFile, String soundBankFile ) : void

Initializes the audio manager with an XACT audio project

IsSoundEffectPlaying ( SoundEffect soundEffect ) : bool
Play ( SoundEffect soundEffect ) : void
Play ( SoundEffect soundEffect, float volume ) : void

Plays the argument sound effect.

PlayIfNotPlaying ( SoundEffect soundEffect ) : void
PlaySong ( ) : void

Plays the current song. PlaySong with an argument must be called before this can be called. This can be used to resume music when the game is unpaused or if audio options are being turned on/off

PlaySong ( Microsoft.Xna.Framework.Media.Song toPlay, bool forceRestart, bool isSongGlobalContent ) : void

Plays the argument song, optionally restarting it if it is already playing.

PlaySongThenResumeCurrent ( Microsoft.Xna.Framework.Media.Song toPlay, bool songUsesGlobalContent ) : void
PlaySound ( String soundName ) : Cue

Plays a sound immediately

PlaySound ( String soundName, string soundBankFile ) : Cue

Plays a sound immediately

RemovePositionedSound ( PositionedSound sound ) : void

Removes the specified sound from the audio manager Warning: The sound will stop being positioned when removed

RemoveSoundBank ( string soundBankFile ) : void

Removes a sound bank

RemoveWaveBank ( string waveBankFile ) : void

Removes a wave bank

StopAndDisposeCurrentSongIfNameDiffers ( string nameToCompareAgainst ) : bool
StopSong ( ) : void
Update ( ) : void

Private Methods

Method Description
AudioManager ( ) : System
GetCue ( String soundName, string soundBankFile ) : Cue
HandleMediaStateChanged ( object sender, EventArgs e ) : void
OnSuspending ( object sender, EventArgs e ) : void
OnUnsuspending ( object sender, EventArgs e ) : void
UpdateDependencies ( ) : void
UserPermissionCallback ( IAsyncResult r ) : void

Method Details

AddSoundBank() public static method

Adds a sound bank
public static AddSoundBank ( string soundBankFile ) : void
soundBankFile string The sound bank to add
return void

AddWaveBank() public static method

Adds a wave bank
public static AddWaveBank ( string waveBankFile ) : void
waveBankFile string The wave bank to add
return void

GetPositionedSound() public static method

Gets a positioned sound
public static GetPositionedSound ( String soundName ) : PositionedSound
soundName String The name of the sound in the XACT project
return PositionedSound

GetPositionedSound() public static method

Gets a positioned sound
public static GetPositionedSound ( String soundName, string soundBankFile ) : PositionedSound
soundName String The name of the sound in the XACT project
soundBankFile string The name of the sound bank to retrieve the sound from
return PositionedSound

GetSound() public static method

Gets a sound
public static GetSound ( String soundName ) : Sound
soundName String The name of the sound in the XACT project
return Sound

GetSound() public static method

Gets a sound
public static GetSound ( String soundName, string soundBankFile ) : Sound
soundName String The name of the sound in the XACT project
soundBankFile string The name of the sound bank to retrieve the sound from
return Sound

HasSoundBank() public static method

Whether or not the given sound bank file has been loaded
public static HasSoundBank ( string soundBankFile ) : bool
soundBankFile string The sound bank to check
return bool

HasWaveBank() public static method

Whether or not the given wave bank file has been loaded
public static HasWaveBank ( string soundBankFile ) : bool
soundBankFile string The wave bank to check
return bool

Initialize() public static method

Initializes the audio manager with an XACT audio project
public static Initialize ( String settingsFile, String waveBankFile, String soundBankFile ) : void
settingsFile String The settings file for the audio project (xgs)
waveBankFile String The wave bank file for the audio project (xwb)
soundBankFile String The sound bank file for the audio project (xsb)
return void

IsSoundEffectPlaying() public static method

public static IsSoundEffectPlaying ( SoundEffect soundEffect ) : bool
soundEffect Microsoft.Xna.Framework.Audio.SoundEffect
return bool

Play() public static method

public static Play ( SoundEffect soundEffect ) : void
soundEffect Microsoft.Xna.Framework.Audio.SoundEffect
return void

Play() public static method

Plays the argument sound effect.
public static Play ( SoundEffect soundEffect, float volume ) : void
soundEffect Microsoft.Xna.Framework.Audio.SoundEffect The sound effect to play
volume float Volume, ranging from 0.0f (silence) to 1.0f (full volume). 1.0f is full volume
return void

PlayIfNotPlaying() public static method

public static PlayIfNotPlaying ( SoundEffect soundEffect ) : void
soundEffect Microsoft.Xna.Framework.Audio.SoundEffect
return void

PlaySong() public static method

Plays the current song. PlaySong with an argument must be called before this can be called. This can be used to resume music when the game is unpaused or if audio options are being turned on/off
public static PlaySong ( ) : void
return void

PlaySong() public static method

Plays the argument song, optionally restarting it if it is already playing.
public static PlaySong ( Microsoft.Xna.Framework.Media.Song toPlay, bool forceRestart, bool isSongGlobalContent ) : void
toPlay Microsoft.Xna.Framework.Media.Song The song to play.
forceRestart bool Whether the song should be restarted. If the toPlay parameter differs from the currently-playing song then it will /// restart regardless of the forceRestart value. This value only matters when the currently-playing song is passed.
isSongGlobalContent bool Whether the song uses a Global content manager. This is important if StopAndDisposeCurrentSongIfNameDiffers is called. /// StopAndDisposeCurrentSongIfNameDiffers is called by Glue, so the isSongGlobalContent param matters even if your code is not directly calling this function.
return void

PlaySongThenResumeCurrent() public static method

public static PlaySongThenResumeCurrent ( Microsoft.Xna.Framework.Media.Song toPlay, bool songUsesGlobalContent ) : void
toPlay Microsoft.Xna.Framework.Media.Song
songUsesGlobalContent bool
return void

PlaySound() public static method

Plays a sound immediately
public static PlaySound ( String soundName ) : Cue
soundName String The name of the sound in the XACT project
return Microsoft.Xna.Framework.Audio.Cue

PlaySound() public static method

Plays a sound immediately
public static PlaySound ( String soundName, string soundBankFile ) : Cue
soundName String The name of the sound in the XACT project
soundBankFile string The name of the sound bank to retrieve the sound from
return Microsoft.Xna.Framework.Audio.Cue

RemovePositionedSound() public static method

Removes the specified sound from the audio manager Warning: The sound will stop being positioned when removed
public static RemovePositionedSound ( PositionedSound sound ) : void
sound PositionedSound The sound to remove
return void

RemoveSoundBank() public static method

Removes a sound bank
public static RemoveSoundBank ( string soundBankFile ) : void
soundBankFile string The sound bank to remove
return void

RemoveWaveBank() public static method

Removes a wave bank
public static RemoveWaveBank ( string waveBankFile ) : void
waveBankFile string The wave bank to remove
return void

StopAndDisposeCurrentSongIfNameDiffers() public static method

public static StopAndDisposeCurrentSongIfNameDiffers ( string nameToCompareAgainst ) : bool
nameToCompareAgainst string
return bool

StopSong() public static method

public static StopSong ( ) : void
return void

Update() public static method

public static Update ( ) : void
return void

Property Details

GlobalVariables public_oe static_oe property

public static SoundGlobalVariableCollection,FlatRedBall.Audio GlobalVariables
return SoundGlobalVariableCollection

SoundListener public_oe static_oe property

public static PositionedSoundListener,FlatRedBall.Audio SoundListener
return PositionedSoundListener