-
Method Summary
Modifier and TypeMethodDescriptionvoid
callback
(String format, int rate, int channels, AudioCallback audioCallback) Enable audio callbacks and set the component used to process the audio samples.void
callback
(String format, int rate, int channels, AudioCallback audioCallback, boolean manageVolume) Enable audio callbacks and set the component used to process the audio samples.channel()
Get the current audio channel.long
delay()
Get the audio delay.Get the current audio equalizer.final void
equalizerChanged
(Equalizer equalizer) The state of the equalizer changed.boolean
isMute()
Test whether or not the volume is currently muted.boolean
mute()
Toggle volume mute.Get the identifier of the current audio output device, if available.Get the available audio devices for the media player audio output.boolean
setChannel
(AudioChannel channel) Set the audio channel.void
setDelay
(long delay) Set the audio delay.void
setEqualizer
(Equalizer equalizer) Set the audio equalizer.void
setMute
(boolean mute) Mute or un-mute the volume.boolean
Set the desired audio output.void
setOutputDevice
(String output, String outputDeviceId) Set the desired audio output device.int
setTrack
(int track) Set a new audio track to play.boolean
setVolume
(int volume) Set the volume.int
track()
Get the current audio track.int
Get the number of available audio tracks.Get the audio track descriptions.int
volume()
Get the current volume.
-
Method Details
-
setOutput
Set the desired audio output.The change will not be applied until the media player has been stopped and then played again.
The output name comes from
AudioApi.audioOutputs()
.- Parameters:
output
- name of the desired audio output- Returns:
true
if the output was successfully set, otherwisefalse
-
outputDevice
Get the identifier of the current audio output device, if available.To return a useful value, an audio output must be active (i.e. the media must be playing).
- Returns:
- identifier of the current audio output device, or
null
if not available
-
setOutputDevice
Set the desired audio output device.The change will not be applied until the media player has been stopped and then played again.
The output name comes from
AudioApi.audioOutputs()
.The device id comes from the
AudioDevice.getDeviceId()
returned byAudioApi.audioOutputs()
.- Parameters:
output
- name of the desired audio outputoutputDeviceId
- id of the desired audio output device
-
outputDevices
Get the available audio devices for the media player audio output.- Returns:
- list of audio devices, may be empty but not
null
-
mute
public boolean mute()Toggle volume mute.- Returns:
- mute
true
if the volume is muted,false
if the volume is not muted
-
setMute
public void setMute(boolean mute) Mute or un-mute the volume.- Parameters:
mute
-true
to mute the volume,false
to un-mute it
-
isMute
public boolean isMute()Test whether or not the volume is currently muted.- Returns:
- mute
true
if the volume is muted,false
if the volume is not muted
-
volume
public int volume()Get the current volume.- Returns:
- volume, a percentage of full volume in the range 0 to 200
-
setVolume
public boolean setVolume(int volume) Set the volume.The volume is actually a percentage of full volume, setting a volume over 100 may cause audible distortion.
- Parameters:
volume
- volume, a percentage of full volume in the range 0 to 200- Returns:
true
if successful;false
on error
-
channel
Get the current audio channel. For channel values seeAudioChannel
.- Returns:
- audio channel
-
setChannel
Set the audio channel. For channel values seeAudioChannel
.- Parameters:
channel
- channel- Returns:
true
if successful;false
on error
-
delay
public long delay()Get the audio delay.- Returns:
- audio delay, in microseconds
-
setDelay
public void setDelay(long delay) Set the audio delay.The audio delay is set for the current item only and will be reset to zero each time the media changes.
- Parameters:
delay
- desired audio delay, in microseconds
-
equalizer
Get the current audio equalizer.- Returns:
- equalizer, or
null
if there is no active equalizer
-
setEqualizer
Set the audio equalizer.- Parameters:
equalizer
- equalizer, ornull
to disable the audio equalizer
-
equalizerChanged
Description copied from interface:EqualizerListener
The state of the equalizer changed.- Specified by:
equalizerChanged
in interfaceEqualizerListener
- Parameters:
equalizer
- the equalizer that changed
-
trackCount
public int trackCount()Get the number of available audio tracks.- Returns:
- track count
-
track
-
setTrack
public int setTrack(int track) Set a new audio track to play.The track identifier must be one of those returned by
trackDescriptions()
.Audio can be disabled by passing here the identifier of the track with a description of "Disable".
There is no guarantee that the available track identifiers go in sequence from zero up to
trackCount()
-1. ThetrackDescriptions()
method should always be used to ascertain the available track identifiers.- Parameters:
track
- track identifier- Returns:
- current audio track identifier
-
trackDescriptions
Get the audio track descriptions.The media must be playing before this information is available.
- Returns:
- list of descriptions, may be empty but will never be
null
-
callback
Enable audio callbacks and set the component used to process the audio samples.The callback will not manage audio volume.
- Parameters:
format
- audio buffer formatrate
- audio buffer bit-ratechannels
- number of audio channelsaudioCallback
- component that will process the audio samples- See Also:
-
callback
public void callback(String format, int rate, int channels, AudioCallback audioCallback, boolean manageVolume) Enable audio callbacks and set the component used to process the audio samples.- Parameters:
format
- audio buffer formatrate
- audio buffer bit-ratechannels
- number of audio channelsaudioCallback
- component that will process the audio samplesmanageVolume
-true
if the callback will manage audio volume;false
if not
-