Class PDActionSound
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.action.PDAction
org.apache.pdfbox.pdmodel.interactive.action.PDActionSound
- All Implemented Interfaces:
COSObjectable
,PDDestinationOrAction
This represents a Sound action that can be executed in a PDF document
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getMix()
Gets the flag specifying whether to mix this sound with any other sound already playing.boolean
Gets whether to repeat the sound indefinitely.getS()
Deprecated.getSound()
Gets the sound object.boolean
Gets the synchronous flag.float
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
Deprecated.void
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 Details
-
SUB_TYPE
This type of action this object represents.- See Also:
-
-
Constructor Details
-
PDActionSound
public PDActionSound()Default constructor. -
PDActionSound
Constructor.- Parameters:
a
- The action dictionary.
-
-
Method Details
-
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.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
Sets the sound object.- Parameters:
sound
- the sound object defining the sound that shall be played.
-
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:
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).
-
PDAction.getSubType()
.