Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. and Motorola, Inc. All rights reserved.

MID Profile

javax.microedition.media.control
Interface VolumeControl

All Superinterfaces:
Control

public interface VolumeControl
extends Control

VolumeControl is an interface for manipulating the audio volume of a Player.

Volume Settings

This interface allows the output volume to be specified using an integer value that varies between 0 and 100.

Specifying Volume in the Level Scale

The level scale specifies volume in a linear scale. It ranges from 0 to 100, where 0 represents silence and 100 represents the highest volume. The mapping for producing a linear multiplicative value is implementation dependent.

Mute

Setting mute on or off doesn't change the volume level returned by getLevel. If mute is true, no audio signal is produced by this Player; if mute is false an audio signal is produced and the volume is restored.

Volume Change Events

When the state of the VolumeControl changes, a VOLUME_CHANGED event is delivered through the PlayerListener.

See Also:
Control, Player, PlayerListener

Method Summary
 int getLevel()
          Get the current volume level set.
 boolean isMuted()
          Get the mute state of the signal associated with this VolumeControl.
 int setLevel(int level)
          Set the volume using a linear point scale with values between 0 and 100.
 void setMute(boolean mute)
          Mute or unmute the Player associated with this VolumeControl.
 

Method Detail

setMute

public void setMute(boolean mute)
Mute or unmute the Player associated with this VolumeControl.

Calling setMute(true) on the Player that is already muted is ignored, as is calling setMute(false) on the Player that is not currently muted. Setting mute on or off doesn't change the volume level returned by getLevel.

When setMute results in a change in the muted state, a VOLUME_CHANGED event will be delivered through the PlayerListener.

Parameters:
mute - Specify true to mute the signal, false to unmute the signal.
See Also:
isMuted()

isMuted

public boolean isMuted()
Get the mute state of the signal associated with this VolumeControl.

Returns:
The mute state.
See Also:
setMute(boolean)

setLevel

public int setLevel(int level)
Set the volume using a linear point scale with values between 0 and 100.
0 is silence; 100 is the loudest useful level that this VolumeControl supports. If the given level is less than 0 or greater than 100, the level will be set to 0 or 100 respectively.
When setLevel results in a change in the volume level, a VOLUME_CHANGED event will be delivered through the PlayerListener.

Parameters:
level - The new volume specified in the level scale.
Returns:
The level that was actually set.
See Also:
getLevel()

getLevel

public int getLevel()
Get the current volume level set.

getLevel may return -1 if and only if the Player is in the REALIZED state (the audio device has not been initialized) and setLevel has not yet been called.

Returns:
The current volume level or -1.
See Also:
setLevel(int)

MID Profile

Copyright © 2006 Sun Microsystems, Inc. and Motorola, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 118 specification.