C# Класс 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...
Наследование: FlxBasic
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
amplitude float
amplitudeLeft float
amplitudeRight float
artist string
autoDestroy bool
name string
survive bool
x float
y float

Защищенные свойства (Protected)

Свойство Тип Описание
_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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
createSound ( ) : void

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

Приватные методы

Метод Описание
updateTransform ( ) : void

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

Описание методов

FlxSound() публичный Метод

The FlxSound constructor gets all the variables initialized, but NOT ready to play a sound yet.
public FlxSound ( ) : System
Результат System

createSound() защищенный Метод

An internal function for clearing all the variables used by sounds.
protected createSound ( ) : void
Результат void

destroy() публичный Метод

Clean up memory.
public destroy ( ) : void
Результат void

fadeIn() публичный Метод

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.
Результат void

fadeOut() публичный Метод

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.
Результат void

getActualVolume() публичный Метод

Returns the currently selected "real" volume of the sound (takes fades and proximity into account).
public getActualVolume ( ) : float
Результат float

kill() публичный Метод

public kill ( ) : void
Результат void

loadEmbedded() публичный Метод

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.
Результат FlxSound

loadStream() публичный Метод

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.
Результат FlxSound

pause() публичный Метод

Call this function to pause this sound.
public pause ( ) : void
Результат void

play() публичный Метод

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.
Результат void

proximity() публичный Метод

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).
Результат FlxSound

resume() публичный Метод

Unpause a sound. Only works on sounds that have been paused.
public resume ( ) : void
Результат void

stop() публичный Метод

Call this function to stop this sound.
public stop ( ) : void
Результат void

update() публичный Метод

Handles fade out, fade in, panning, proximity, and amplitude operations each frame.
public update ( ) : void
Результат void

Описание свойств

_fadeInTimer защищенное свойство

Internal timer for fading in the sound playback.
protected float _fadeInTimer
Результат float

_fadeInTotal защищенное свойство

Internal helper for fading in sounds.
protected float _fadeInTotal
Результат float

_fadeOutTimer защищенное свойство

Internal timer used to keep track of requests to fade out the sound playback.
protected float _fadeOutTimer
Результат float

_fadeOutTotal защищенное свойство

Internal helper for fading out sounds.
protected float _fadeOutTotal
Результат float

_looped защищенное свойство

Internal tracker for whether the sound is looping or not.
protected bool _looped
Результат bool

_pan защищенное свойство

Internal tracker for whether to pan the sound left and right. Default is false.
protected bool _pan
Результат bool

_pauseOnFadeOut защищенное свойство

Internal flag for whether to pause or stop the sound when it's done fading out.
protected bool _pauseOnFadeOut
Результат bool

_position защищенное свойство

Internal tracker for the position in runtime of the music playback.
protected float _position
Результат float

_radius защищенное свойство

Internal tracker for the maximum effective radius of this sound (for proximity and panning).
protected float _radius
Результат float

_sound защищенное свойство

Internal tracker for a XNA sound object.
protected SoundEffectInstance,Microsoft.Xna.Framework.Audio _sound
Результат Microsoft.Xna.Framework.Audio.SoundEffectInstance

_target защищенное свойство

Internal tracker for the sound's "target" (for proximity and panning).
protected FlxObject,flxSharp.flxSharp _target
Результат FlxObject

_volume защищенное свойство

Internal tracker for how loud the sound is.
protected float _volume
Результат float

_volumeAdjust защищенное свойство

Internal tracker for total volume adjustment.
protected float _volumeAdjust
Результат float

amplitude публичное свойство

Stores the average wave amplitude of both stereo channels.
public float amplitude
Результат float

amplitudeLeft публичное свойство

Just the amplitude of the left stereo channel.
public float amplitudeLeft
Результат float

amplitudeRight публичное свойство

Just the amplitude of the right stereo channel.
public float amplitudeRight
Результат float

artist публичное свойство

The ID3 artist name. Defaults to null. Currently only works for streamed sounds.
public string artist
Результат string

autoDestroy публичное свойство

Whether to call destroy() when the sound has finished.
public bool autoDestroy
Результат bool

name публичное свойство

The ID3 song name. Defaults to null. Currently only works for streamed sounds.
public string name
Результат string

survive публичное свойство

Whether or not this sound should be automatically destroyed when you switch states.
public bool survive
Результат bool

x публичное свойство

The X position of this sound in world coordinates. Only really matters if you are doing proximity/panning stuff.
public float x
Результат float

y публичное свойство

The Y position of this sound in world coordinates. Only really matters if you are doing proximity/panning stuff.
public float y
Результат float