Class AudioSource


  • public class AudioSource
    extends Object
    Class that represents a audio source to play audio from
    Author:
    Darius Dinger
    • Constructor Detail

      • AudioSource

        public AudioSource()
        Create new audio source
    • Method Detail

      • play

        public void play​(String sound)
        Setting sound for this source and play
        Parameters:
        sound - Sound to play from source
      • setSound

        public void setSound​(String sound)
        Parameters:
        sound - Setting sound to play from this source
      • setVolume

        public void setVolume​(int vol)
        Parameters:
        vol - New volume of the source
      • stop

        public void stop()
        Stop source from playing audio
      • pause

        public void pause()
        Pause source from playing audio
      • play

        public void play()
        Continue playing after pause
      • setLoop

        public void setLoop​(boolean loop)
        Parameters:
        loop - Should source playing in loop?
      • setPosition

        public void setPosition​(float x,
                                float y,
                                float z)
        Setting position of the source in the 3d world
        Parameters:
        x - X Position of the source
        y - Y Position of the source
        z - Z Position of the source
      • setVelocity

        public void setVelocity​(float x,
                                float y,
                                float z)
        Setting direction and range of the source in the 3d world as 3d vector
        Parameters:
        x - X Direction of the source
        y - Y Direction of the source
        z - Z Direction of the source
      • setRolloff

        public void setRolloff​(float rolloff)
        Setting rolloff factor for this source in the distance. Zero will b no rolloff.
        Parameters:
        rolloff - New rolloff factor
      • setRelative

        public void setRelative​(boolean rel)
        Parameters:
        rel - Is the source relative?