- All Implemented Interfaces:
EqualizerListener
-
Method Summary
Modifier and TypeMethodDescriptionvoidcallback(String format, int rate, int channels, AudioCallback audioCallback) Enable audio callbacks and set the component used to process the audio samples.voidcallback(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.longdelay()Get the audio delay.Get the current audio equalizer.final voidequalizerChanged(Equalizer equalizer) The state of the equalizer changed.booleanisMute()Test whether or not the volume is currently muted.booleanmute()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.booleansetChannel(AudioChannel channel) Set the audio channel.voidsetDelay(long delay) Set the audio delay.voidsetEqualizer(Equalizer equalizer) Set the audio equalizer.voidsetMute(boolean mute) Mute or un-mute the volume.booleanSet the desired audio output.voidsetOutputDevice(String output, String outputDeviceId) Set the desired audio output device.intsetTrack(int track) Set a new audio track to play.booleansetVolume(int volume) Set the volume.inttrack()Get the current audio track.intGet the number of available audio tracks.Get the audio track descriptions.intvolume()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:
trueif 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
nullif 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
trueif the volume is muted,falseif the volume is not muted
-
setMute
public void setMute(boolean mute) Mute or un-mute the volume.- Parameters:
mute-trueto mute the volume,falseto un-mute it
-
isMute
public boolean isMute()Test whether or not the volume is currently muted.- Returns:
- mute
trueif the volume is muted,falseif 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:
trueif successful;falseon 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:
trueif successful;falseon 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
nullif there is no active equalizer
-
setEqualizer
Set the audio equalizer.- Parameters:
equalizer- equalizer, ornullto disable the audio equalizer
-
equalizerChanged
Description copied from interface:EqualizerListenerThe state of the equalizer changed.- Specified by:
equalizerChangedin interfaceEqualizerListener- Parameters:
equalizer- the equalizer that changed
-
trackCount
public int trackCount()Get the number of available audio tracks.- Returns:
- track count
-
track
public int track()Get the current audio track.- Returns:
- track identifier, see
trackDescriptions()
-
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-trueif the callback will manage audio volume;falseif not
-