Class PDActionSound
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.action.PDAction
-
- org.apache.pdfbox.pdmodel.interactive.action.PDActionSound
-
- All Implemented Interfaces:
COSObjectable
,PDDestinationOrAction
public class PDActionSound extends PDAction
This represents a Sound action that can be executed in a PDF document
-
-
Constructor Summary
Constructors Constructor Description PDActionSound()
Default constructor.PDActionSound(COSDictionary a)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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.java.lang.String
getS()
Deprecated.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
setS(java.lang.String s)
Deprecated.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 org.apache.pdfbox.pdmodel.interactive.action.PDAction
getCOSObject, getNext, getSubType, getType, setNext, setSubType, setType
-
-
-
-
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
-
getS
@Deprecated public java.lang.String getS()
Deprecated.This will get the type of action that the actions dictionary describes. It must be Sound for a Sound action.- Returns:
- The S entry of the specific Sound action dictionary.
-
setS
@Deprecated public void setS(java.lang.String s)
Deprecated.This will set the type of action that the actions dictionary describes. It must be Sound for a Sound action.- Parameters:
s
- The Sound action.
-
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).
-
-