C# 클래스 SunsetHigh.BGMusic

Static class for managing all the background music for the game, using the NAudio library. Currently supports playing, pausing, resuming, stopping, fading in and out, and looping. Fading effects are recommended when changing screens/songs. When providing song file names, please specify the file extension (it's not necessary, but recommended).
파일 보기 프로젝트 열기: ErraticUnicorn/MOSH

공개 메소드들

메소드 설명
dispose ( ) : void

Disposes of all resources contained in BGMusic. Call this method at the end of the Game's life.

fadeIn ( ) : void

Song starts from silence and fades in to full volume. Default fade in time.

fadeIn ( double fadeTime ) : void

Song starts from silence and fades in to full volume

fadeOut ( ) : void

Song starts from full volume and fades out to silence. Default fade out time.

fadeOut ( double fadeTime ) : void

Song starts from full volume and fades out to silence

isLooping ( ) : bool

Specifies whether a song is looping (true by default)

isPaused ( ) : bool

Specifies whether the soundtrack is paused (false if is playing)

playSong ( string fileName ) : void

Begins playing a song with the specified file name. Only .mp3, .wma, and .m4a are supported.

setLooping ( bool looping ) : void

Sets whether a song should loop upon ending (true by default)

setPaused ( bool pause ) : void

Sets whether the soundtrack is paused or not

setVolume ( float volume ) : void

Changes the volume of playback; BGMusic.SILENCE can be used for muting the song, while BGMusic.FULL_VOLUME can unmute.

stopSong ( ) : void

Stops song and disposes of it (cannot be resumed afterward)

transitionToSong ( string fileName ) : void

Fades out the current song and starts playing the new song after a short lag. Default fade time and lag times are used.

transitionToSong ( string fileName, double fadeTime, double lagTime ) : void

Fades out the current song and starts playing the new song after a short lag

transitionToSongWithFadeIn ( string fileName ) : void

Fades out the current song and starts fading into the new song after a short lag. Default fade and lag times are used.

transitionToSongWithFadeIn ( string fileName, double fadeTime, double lagTime ) : void

Fades out the current song and starts fading into the new song after a short lag

비공개 메소드들

메소드 설명
OnFadeOver ( object source, System.Timers.ElapsedEventArgs e ) : void
OnFadeOverFadeIn ( object source, System.Timers.ElapsedEventArgs e ) : void
tryAllFileTypes ( string fileName ) : bool

메소드 상세

dispose() 공개 정적인 메소드

Disposes of all resources contained in BGMusic. Call this method at the end of the Game's life.
public static dispose ( ) : void
리턴 void

fadeIn() 공개 정적인 메소드

Song starts from silence and fades in to full volume. Default fade in time.
public static fadeIn ( ) : void
리턴 void

fadeIn() 공개 정적인 메소드

Song starts from silence and fades in to full volume
public static fadeIn ( double fadeTime ) : void
fadeTime double Time to fade in, in milliseconds
리턴 void

fadeOut() 공개 정적인 메소드

Song starts from full volume and fades out to silence. Default fade out time.
public static fadeOut ( ) : void
리턴 void

fadeOut() 공개 정적인 메소드

Song starts from full volume and fades out to silence
public static fadeOut ( double fadeTime ) : void
fadeTime double Time to fade out, in milliseconds
리턴 void

isLooping() 공개 정적인 메소드

Specifies whether a song is looping (true by default)
public static isLooping ( ) : bool
리턴 bool

isPaused() 공개 정적인 메소드

Specifies whether the soundtrack is paused (false if is playing)
public static isPaused ( ) : bool
리턴 bool

playSong() 공개 정적인 메소드

Begins playing a song with the specified file name. Only .mp3, .wma, and .m4a are supported.
public static playSong ( string fileName ) : void
fileName string File name of the song in the "Content" directory
리턴 void

setLooping() 공개 정적인 메소드

Sets whether a song should loop upon ending (true by default)
public static setLooping ( bool looping ) : void
looping bool True if the song should loop, false otherwise
리턴 void

setPaused() 공개 정적인 메소드

Sets whether the soundtrack is paused or not
public static setPaused ( bool pause ) : void
pause bool
리턴 void

setVolume() 공개 정적인 메소드

Changes the volume of playback; BGMusic.SILENCE can be used for muting the song, while BGMusic.FULL_VOLUME can unmute.
public static setVolume ( float volume ) : void
volume float
리턴 void

stopSong() 공개 정적인 메소드

Stops song and disposes of it (cannot be resumed afterward)
public static stopSong ( ) : void
리턴 void

transitionToSong() 공개 정적인 메소드

Fades out the current song and starts playing the new song after a short lag. Default fade time and lag times are used.
public static transitionToSong ( string fileName ) : void
fileName string File name of the new song to play in the "Content" folder
리턴 void

transitionToSong() 공개 정적인 메소드

Fades out the current song and starts playing the new song after a short lag
public static transitionToSong ( string fileName, double fadeTime, double lagTime ) : void
fileName string File name of the new song to play in the "Content" folder
fadeTime double Time to fade out, in milliseconds
lagTime double Lag time between the two songs (excluding fade time), in milliseconds
리턴 void

transitionToSongWithFadeIn() 공개 정적인 메소드

Fades out the current song and starts fading into the new song after a short lag. Default fade and lag times are used.
public static transitionToSongWithFadeIn ( string fileName ) : void
fileName string File name of the new song to play in the "Content" folder
리턴 void

transitionToSongWithFadeIn() 공개 정적인 메소드

Fades out the current song and starts fading into the new song after a short lag
public static transitionToSongWithFadeIn ( string fileName, double fadeTime, double lagTime ) : void
fileName string File name of the new song to play in the "Content" folder
fadeTime double Time to fade out and fade in (each), in milliseconds
lagTime double Lag time between the two songs (excluding fade time), in milliseconds
리턴 void