Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.action

public Class PDActionSound

extends PDAction
Class Inheritance
Imports
org.apache.pdfbox.cos.COSDictionary, .COSName, .COSStream

This represents a Sound action that can be executed in a PDF document.
Authors
Timur Kamalov, Tilman Hausherr

Field Summary

Modifier and TypeField and Description
public static final String
SUB_TYPE

This type of action this object represents.

Inherited from org.apache.pdfbox.pdmodel.interactive.action.PDAction:
actionTYPE

Constructor Summary

AccessConstructor and Description
public
PDActionSound()

Default constructor.

public
PDActionSound(COSDictionary
The action dictionary.
a
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether to mix this sound with any other sound already playing (default: false).
getMix
()

Gets the flag specifying whether to mix this sound with any other sound already playing.

public boolean

Returns:

Whether to repeat the sound indefinitely (default: false).
getRepeat
()

Gets whether to repeat the sound indefinitely.

public COSStream

Returns:

The sound object defining the sound that shall be played.
getSound
()

Gets the sound object.

public boolean

Returns:

Whether to play the sound synchronously (true) or asynchronously (false, also the default).
getSynchronous
()

Gets the synchronous flag.

public float

Returns:

The volume at which to play the sound, in the range −1.0 to 1.0. Default value: 1.0.
getVolume
()

Sets the volume.

public void
setMix(boolean
whether to mix this sound with any other sound already playing. (false).
mix
)

The flag specifying whether to mix this sound with any other sound already playing.

public void
setRepeat(boolean
Whether to repeat the sound indefinitely.
repeat
)

A flag specifying whether to repeat the sound indefinitely.

public void
setSound(COSStream
the sound object defining the sound that shall be played.
sound
)

Sets the sound object.

public void
setSynchronous(boolean
Whether to play the sound synchronously (true) or asynchronously (false).
synchronous
)

A flag specifying whether to play the sound synchronously or asynchronously.

public void
setVolume(float
The volume at which to play the sound, in the range −1.0 to 1.0.
volume
)

Gets the volume at which to play the sound, in the range −1.0 to 1.0.

Inherited from org.apache.pdfbox.pdmodel.interactive.action.PDAction:
getCOSObjectgetNextgetSubTypegetTypesetNextsetSubTypesetType

Field Detail

SUB_TYPEback to summary
public static final String SUB_TYPE

This type of action this object represents.

Constructor Detail

PDActionSoundback to summary
public PDActionSound()

Default constructor.

PDActionSoundback to summary
public PDActionSound(COSDictionary a)

Constructor.

Parameters
a:COSDictionary

The action dictionary.

Method Detail

getMixback to summary
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:boolean

whether to mix this sound with any other sound already playing (default: false).

getRepeatback to summary
public boolean getRepeat()

Gets whether to repeat the sound indefinitely.

Returns:boolean

Whether to repeat the sound indefinitely (default: false).

getSoundback to summary
public COSStream getSound()

Gets the sound object.

Returns:COSStream

The sound object defining the sound that shall be played.

getSynchronousback to summary
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:boolean

Whether to play the sound synchronously (true) or asynchronously (false, also the default).

getVolumeback to summary
public float getVolume()

Sets the volume.

Returns:float

The volume at which to play the sound, in the range −1.0 to 1.0. Default value: 1.0.

setMixback to summary
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:boolean

whether to mix this sound with any other sound already playing. (false).

setRepeatback to summary
public void setRepeat(boolean repeat)

A flag specifying whether to repeat the sound indefinitely.

Parameters
repeat:boolean

Whether to repeat the sound indefinitely.

setSoundback to summary
public void setSound(COSStream sound)

Sets the sound object.

Parameters
sound:COSStream

the sound object defining the sound that shall be played.

setSynchronousback to summary
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:boolean

Whether to play the sound synchronously (true) or asynchronously (false).

setVolumeback to summary
public void setVolume(float volume)

Gets the volume at which to play the sound, in the range −1.0 to 1.0.

Parameters
volume:float

The volume at which to play the sound, in the range −1.0 to 1.0.

Exceptions
IllegalArgumentException:
if the volume parameter is outside of the range −1.0 to 1.0.