Class PDActionSound

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SUB_TYPE
      This type of action this object represents.
      • Fields inherited from class org.apache.pdfbox.pdmodel.interactive.action.PDAction

        action, TYPE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean getMix()
      Gets the flag specifying whether to mix this sound with any other sound already playing.
      boolean getRepeat()
      Gets whether to repeat the sound indefinitely.
      COSStream getSound()
      Gets the sound object.
      boolean getSynchronous()
      Gets the synchronous flag.
      float getVolume()
      Sets the volume.
      void setMix​(boolean mix)
      The flag specifying whether to mix this sound with any other sound already playing.
      void setRepeat​(boolean repeat)
      A flag specifying whether to repeat the sound indefinitely.
      void setSound​(COSStream sound)
      Sets the sound object.
      void setSynchronous​(boolean synchronous)
      A flag specifying whether to play the sound synchronously or asynchronously.
      void setVolume​(float volume)
      Gets the volume at which to play the sound, in the range −1.0 to 1.0.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SUB_TYPE

        public static final java.lang.String SUB_TYPE
        This type of action this object represents.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PDActionSound

        public PDActionSound()
        Default constructor.
      • PDActionSound

        public PDActionSound​(COSDictionary a)
        Constructor.
        Parameters:
        a - The action dictionary.
    • Method Detail

      • setSound

        public void setSound​(COSStream sound)
        Sets the sound object.
        Parameters:
        sound - the sound object defining the sound that shall be played.
      • getSound

        public COSStream getSound()
        Gets the sound object.
        Returns:
        The sound object defining the sound that shall be played.
      • setVolume

        public void setVolume​(float volume)
        Gets the volume at which to play the sound, in the range −1.0 to 1.0.
        Parameters:
        volume - The volume at which to play the sound, in the range −1.0 to 1.0.
        Throws:
        java.lang.IllegalArgumentException - if the volume parameter is outside of the range −1.0 to 1.0.
      • getVolume

        public float getVolume()
        Sets the volume.
        Returns:
        The volume at which to play the sound, in the range −1.0 to 1.0. Default value: 1.0.
      • setSynchronous

        public void setSynchronous​(boolean synchronous)
        A flag specifying whether to play the sound synchronously or asynchronously. When true, the reader allows no further user interaction other than canceling the sound until the sound has been completely played.
        Parameters:
        synchronous - Whether to play the sound synchronously (true) or asynchronously (false).
      • getSynchronous

        public boolean getSynchronous()
        Gets the synchronous flag. It specifyes whether to play the sound synchronously or asynchronously. When true, the reader allows no further user interaction other than canceling the sound until the sound has been completely played.
        Returns:
        Whether to play the sound synchronously (true) or asynchronously (false, also the default).
      • setRepeat

        public void setRepeat​(boolean repeat)
        A flag specifying whether to repeat the sound indefinitely.
        Parameters:
        repeat - Whether to repeat the sound indefinitely.
      • getRepeat

        public boolean getRepeat()
        Gets whether to repeat the sound indefinitely.
        Returns:
        Whether to repeat the sound indefinitely (default: false).
      • setMix

        public void setMix​(boolean mix)
        The flag specifying whether to mix this sound with any other sound already playing. If this flag is false, any previously playing sound shall be stopped before starting this sound; this can be used to stop a repeating sound (see Repeat). Default value: false.
        Parameters:
        mix - whether to mix this sound with any other sound already playing. (false).
      • getMix

        public boolean getMix()
        Gets the flag specifying whether to mix this sound with any other sound already playing. If this flag is false, any previously playing sound shall be stopped before starting this sound; this can be used to stop a repeating sound (see Repeat).
        Returns:
        whether to mix this sound with any other sound already playing (default: false).