Package visuals.audio
Class AudioMemory
java.lang.Object
visuals.audio.AudioMemory
AudioMemory is a singleton class that handles playing and loading audio files for the game
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ModeTypeprivate MediaPlayerprivate final MediaPlayerprivate final MediaPlayerprivate final MediaPlayerprivate static AudioMemorybooleanboolean toggle for playing audioprivate final MediaPlayerprivate final MediaPlayerprivate final MediaPlayer -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivate constructor, loads the audio files and sets them to loop -
Method Summary
Modifier and TypeMethodDescriptionstatic AudioMemoryreturns the instance of the AudioMemorybooleanisMuted()boolean check for if audio is mutedvoidplays the song for given modetypevoidplays the intro song, starts muted and fades inprivate voidplayTheSong(MediaPlayer mediaPlayer) plays the song given as parametervoidStops playing the song for given modetypeprivate voidstopTheSong(MediaPlayer mediaPlayer) stops the song given as parametervoidMutes audio
-
Field Details
-
instance
-
easyPlayer
-
mediumPlayer
-
hardPlayer
-
leaderBoardPlayer
-
infoPlayer
-
currentSong
-
isMuted
public boolean isMutedboolean toggle for playing audio -
currentMode
-
-
Constructor Details
-
AudioMemory
private AudioMemory()private constructor, loads the audio files and sets them to loop
-
-
Method Details
-
getInstance
returns the instance of the AudioMemory- Returns:
- the instance of the AudioMemory
-
playSong
plays the song for given modetype- Parameters:
type- the modetype (such as easy, medium, leaderboards..)
-
stopSong
Stops playing the song for given modetype- Parameters:
type- the modetype (such as easy, medium, leaderboards..)
-
toggleMute
public void toggleMute()Mutes audio -
isMuted
public boolean isMuted()boolean check for if audio is muted- Returns:
- true if audio is muted, false otherwise
-
playTheSong
plays the song given as parameter- Parameters:
mediaPlayer- the song to be played
-
playTheIntro
public void playTheIntro()plays the intro song, starts muted and fades in -
stopTheSong
stops the song given as parameter- Parameters:
mediaPlayer- the song to be stopped
-