Interface AudioManager


public interface AudioManager
The AudioManager interface should be implemented by the specific platform running the application, it contains function for manipulation audio files.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getLength(AudioPlayer audioPlayer)
    The function "getLength" takes an AudioPlayer object as input and returns its length as a double.
    double
    getPosition(AudioPlayer audioPlayer)
    The function returns the current position of an audio player.
    boolean
    isPlaying(AudioPlayer audioPlayer)
    The function checks if an audio player is currently playing.
    loadAudio(AudioPlayer audio, FileIOManager ioManager)
    This function loads an audio file.
    void
    loop(AudioPlayer audioPlayer)
     
    void
    pause(AudioPlayer audioPlayer)
    This function takes an AudioPlayer object as input and pauses it.
    void
    play(AudioPlayer audioPlayer)
    The function "play" plays an audio clip from an AudioPlayer object.
    void
    setGain(AudioPlayer audioPlayer, double gain)
    The function sets the gain of an audio player.
    void
    setPan(AudioPlayer audioPlayer, double pan)
    The setPan function sets the stereo panning of an audio player.
    void
    setPosition(AudioPlayer audioPlayer, double position)
    The function sets the position of an audio player.
    void
    The function unloads an audio clip from an audio player.
  • Method Details

    • loadAudio

      Object loadAudio(AudioPlayer audio, FileIOManager ioManager)
      This function loads an audio file.
      Parameters:
      audio - The "audio" parameter in the "loadAudio" method is an object of the "AudioPlayer" class. This object contains an audio file that needs to be loaded into the program. The "loadAudio" method is responsible for loading the audio file into the program and returning its clip reference.
      ioManager - The ioManager used to load the audio file.
      Returns:
      The audio clip reference.
    • unloadAudio

      void unloadAudio(AudioPlayer audio, FileIOManager ioManager)
      The function unloads an audio clip from an audio player.
      Parameters:
      audio - The "audio" parameter is an object of type "AudioPlayer" that contains an audio file that has been loaded into memory. The "unloadAudio" function is used to free up the memory used by the audio file.
      ioManager - The ioManager used to load the audio file.
    • play

      void play(AudioPlayer audioPlayer)
      The function "play" plays an audio clip from an AudioPlayer object.
      Parameters:
      audioPlayer - The parameter "audioPlayer" is an object of the class "AudioPlayer". It is being passed as an argument to the function "play". The function will play the audio clip related to this AudioPlayer object.
    • loop

      void loop(AudioPlayer audioPlayer)
    • pause

      void pause(AudioPlayer audioPlayer)
      This function takes an AudioPlayer object as input and pauses it.
      Parameters:
      audioPlayer - The audio player to be paused.
    • getLength

      double getLength(AudioPlayer audioPlayer)
      The function "getLength" takes an AudioPlayer object as input and returns its length as a double.
      Parameters:
      audioPlayer - The audio player.
      Returns:
      A double value representing the length of the audio file being hold by the AudioPlayer object passed as a parameter.
    • getPosition

      double getPosition(AudioPlayer audioPlayer)
      The function returns the current position of an audio player.
      Parameters:
      audioPlayer - The audio player.
      Returns:
      a double value, which is the current position of the audio player in seconds.
    • setPosition

      void setPosition(AudioPlayer audioPlayer, double position)
      The function sets the position of an audio player.
      Parameters:
      audioPlayer - The audio player.
      position - The position parameter is a double value that represents the desired position in the audio file being played by the AudioPlayer. It is measured in seconds from the beginning of the audio file. By setting the position parameter, you can move the playback position of the audio file to a specific point in time.
    • setGain

      void setGain(AudioPlayer audioPlayer, double gain)
      The function sets the gain of an audio player.
      Parameters:
      audioPlayer - The audioPlayer parameter is an object of the AudioPlayer class. It represents the audio player that you want to set the gain for.
      gain - The gain parameter in the setGain() function is a double value that represents the amount of amplification to be applied to the audio signal.
    • setPan

      void setPan(AudioPlayer audioPlayer, double pan)
      The setPan function sets the stereo panning of an audio player.
      Parameters:
      audioPlayer - The audioPlayer parameter is an object of the AudioPlayer class. It represents the audio player that you want to set the pan for.
      pan - The "pan" parameter in the "setPan" method is a double value that represents the stereo panning of the audio player.
    • isPlaying

      boolean isPlaying(AudioPlayer audioPlayer)
      The function checks if an audio player is currently playing.
      Parameters:
      audioPlayer - The audio player.
      Returns:
      A boolean value is being returned.