C# Class flxSharp.flxSharp.FlxSound

This is the universal flixel sound object, used for streaming, music, and sound effects. For all the pan stuff http://allcomputers.us/windows_phone/xna-game-studio-4_0---playing-sound-effects-(part-1)---using-soundeffect-for-audio-playback.aspx TODO: Implement overloaded functionality for Sound (mp3 files) all over the place...
Inheritance: FlxBasic
Afficher le fichier Open project: jlorek/flxSharp

Méthodes publiques

Свойство Type Description
amplitude float
amplitudeLeft float
amplitudeRight float
artist string
autoDestroy bool
name string
survive bool
x float
y float

Protected Properties

Свойство Type Description
_fadeInTimer float
_fadeInTotal float
_fadeOutTimer float
_fadeOutTotal float
_looped bool
_pan bool
_pauseOnFadeOut bool
_position float
_radius float
_sound Microsoft.Xna.Framework.Audio.SoundEffectInstance
_target FlxObject
_volume float
_volumeAdjust float

Méthodes publiques

Méthode Description
FlxSound ( ) : System

The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.

destroy ( ) : void

Clean up memory.

fadeIn ( float seconds ) : void

Call this function to make a sound fade in over a certain time interval (calls play() automatically).

fadeOut ( float seconds, bool pauseInstead = false ) : void

Call this function to make this sound fade out over a certain time interval.

getActualVolume ( ) : float

Returns the currently selected "real" volume of the sound (takes fades and proximity into account).

kill ( ) : void
loadEmbedded ( SoundEffect embeddedSound, bool looped = false, bool autoDestroy = false ) : FlxSound

One of two main setup functions for sounds, this function loads a sound from an embedded MP3.

loadStream ( string soundUrl, bool looped = false, bool autoDestroy = false ) : FlxSound

One of two main setup functions for sounds, this function loads a sound from a URL.

pause ( ) : void

Call this function to pause this sound.

play ( bool forceRestart = false ) : void

Call this function to play the sound - also works on paused sounds.

proximity ( float x, float y, FlxObject target, float radius, bool pan = true ) : FlxSound

Call this function if you want this sound's volume to change based on distance from a particular FlxCore object.

resume ( ) : void

Unpause a sound. Only works on sounds that have been paused.

stop ( ) : void

Call this function to stop this sound.

update ( ) : void

Handles fade out, fade in, panning, proximity, and amplitude operations each frame.

Méthodes protégées

Méthode Description
createSound ( ) : void

An internal function for clearing all the variables used by sounds.

Private Methods

Méthode Description
updateTransform ( ) : void

Call after adjusting the volume to update the sound channel's settings.

Method Details

FlxSound() public méthode

The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.
public FlxSound ( ) : System
Résultat System

createSound() protected méthode

An internal function for clearing all the variables used by sounds.
protected createSound ( ) : void
Résultat void

destroy() public méthode

Clean up memory.
public destroy ( ) : void
Résultat void

fadeIn() public méthode

Call this function to make a sound fade in over a certain time interval (calls play() automatically).
public fadeIn ( float seconds ) : void
seconds float The amount of time the fade-in operation should take.
Résultat void

fadeOut() public méthode

Call this function to make this sound fade out over a certain time interval.
public fadeOut ( float seconds, bool pauseInstead = false ) : void
seconds float The amount of time the fade out operation should take.
pauseInstead bool Tells the sound to pause on fadeout, instead of stopping.
Résultat void

getActualVolume() public méthode

Returns the currently selected "real" volume of the sound (takes fades and proximity into account).
public getActualVolume ( ) : float
Résultat float

kill() public méthode

public kill ( ) : void
Résultat void

loadEmbedded() public méthode

One of two main setup functions for sounds, this function loads a sound from an embedded MP3.
public loadEmbedded ( SoundEffect embeddedSound, bool looped = false, bool autoDestroy = false ) : FlxSound
embeddedSound Microsoft.Xna.Framework.Audio.SoundEffect An embedded Class object representing an MP3 file.
looped bool Whether or not this sound should loop endlessly.
autoDestroy bool Whether or not this FlxSound instance should be destroyed when the sound finishes playing. Default value is false, but FlxG.play() and FlxG.stream() will set it to true by default.
Résultat FlxSound

loadStream() public méthode

One of two main setup functions for sounds, this function loads a sound from a URL.
public loadStream ( string soundUrl, bool looped = false, bool autoDestroy = false ) : FlxSound
soundUrl string A string representing the URL of the MP3 file you want to play.
looped bool Whether or not this sound should loop endlessly.
autoDestroy bool Whether or not this FlxSound instance should be destroyed when the sound finishes playing. Default value is false, but FlxG.play() and FlxG.stream() will set it to true by default.
Résultat FlxSound

pause() public méthode

Call this function to pause this sound.
public pause ( ) : void
Résultat void

play() public méthode

Call this function to play the sound - also works on paused sounds.
public play ( bool forceRestart = false ) : void
forceRestart bool Whether to start the sound over or not. Default value is false, meaning if the sound is already playing or was paused when you call play(), it will continue playing from its current position, NOT start again from the beginning.
Résultat void

proximity() public méthode

Call this function if you want this sound's volume to change based on distance from a particular FlxCore object.
public proximity ( float x, float y, FlxObject target, float radius, bool pan = true ) : FlxSound
x float The X position of the sound.
y float The Y position of the sound.
target FlxObject The object you want to track.
radius float The maximum distance this sound can travel.
pan bool Whether the sound should pan in addition to the volume changes (default: true).
Résultat FlxSound

resume() public méthode

Unpause a sound. Only works on sounds that have been paused.
public resume ( ) : void
Résultat void

stop() public méthode

Call this function to stop this sound.
public stop ( ) : void
Résultat void

update() public méthode

Handles fade out, fade in, panning, proximity, and amplitude operations each frame.
public update ( ) : void
Résultat void

Property Details

_fadeInTimer protected_oe property

Internal timer for fading in the sound playback.
protected float _fadeInTimer
Résultat float

_fadeInTotal protected_oe property

Internal helper for fading in sounds.
protected float _fadeInTotal
Résultat float

_fadeOutTimer protected_oe property

Internal timer used to keep track of requests to fade out the sound playback.
protected float _fadeOutTimer
Résultat float

_fadeOutTotal protected_oe property

Internal helper for fading out sounds.
protected float _fadeOutTotal
Résultat float

_looped protected_oe property

Internal tracker for whether the sound is looping or not.
protected bool _looped
Résultat bool

_pan protected_oe property

Internal tracker for whether to pan the sound left and right. Default is false.
protected bool _pan
Résultat bool

_pauseOnFadeOut protected_oe property

Internal flag for whether to pause or stop the sound when it's done fading out.
protected bool _pauseOnFadeOut
Résultat bool

_position protected_oe property

Internal tracker for the position in runtime of the music playback.
protected float _position
Résultat float

_radius protected_oe property

Internal tracker for the maximum effective radius of this sound (for proximity and panning).
protected float _radius
Résultat float

_sound protected_oe property

Internal tracker for a XNA sound object.
protected SoundEffectInstance,Microsoft.Xna.Framework.Audio _sound
Résultat Microsoft.Xna.Framework.Audio.SoundEffectInstance

_target protected_oe property

Internal tracker for the sound's "target" (for proximity and panning).
protected FlxObject,flxSharp.flxSharp _target
Résultat FlxObject

_volume protected_oe property

Internal tracker for how loud the sound is.
protected float _volume
Résultat float

_volumeAdjust protected_oe property

Internal tracker for total volume adjustment.
protected float _volumeAdjust
Résultat float

amplitude public_oe property

Stores the average wave amplitude of both stereo channels.
public float amplitude
Résultat float

amplitudeLeft public_oe property

Just the amplitude of the left stereo channel.
public float amplitudeLeft
Résultat float

amplitudeRight public_oe property

Just the amplitude of the right stereo channel.
public float amplitudeRight
Résultat float

artist public_oe property

The ID3 artist name. Defaults to null. Currently only works for streamed sounds.
public string artist
Résultat string

autoDestroy public_oe property

Whether to call destroy() when the sound has finished.
public bool autoDestroy
Résultat bool

name public_oe property

The ID3 song name. Defaults to null. Currently only works for streamed sounds.
public string name
Résultat string

survive public_oe property

Whether or not this sound should be automatically destroyed when you switch states.
public bool survive
Résultat bool

x public_oe property

The X position of this sound in world coordinates. Only really matters if you are doing proximity/panning stuff.
public float x
Résultat float

y public_oe property

The Y position of this sound in world coordinates. Only really matters if you are doing proximity/panning stuff.
public float y
Résultat float