|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AudioOutputControl
AudioOutputControl
is an interface for setting application
preferred audio output mode.
SYMBIAN SPECIFIC BEHAVIOR:
Audio output mode is within the scope of a player instance and can be set
when the MIDlet which set the audio routing is finished with the audio
when the player is in REALIZED, PREFETCHED, STARTED or STOPPED state.
The preferences are applied or imposed when media is played.
Audio output control is retrieved using 'Player' interface by calling
Control getControl ( java.lang.string controlType )
The control type to be passed as an argument is
com.nokia.mid.media.AudioOutputControl
S40 SPECIFIC BEHAVIOR:
The AudioOutputControl is a Global Control and will effect all players.
When the MIDlet which set the audio routing is finished with the audio
change then it must set it back to DEFAULT.
Audio output control is retrieved using 'GlobalManager' interface by calling
Control getControl ( java.lang.string controlType )
The control type to be passed as an argument is
com.nokia.mid.media.AudioOutputControl
Code Snippet:
1. Getting AudioOutputControl:
In SYMBIAN:
Player p =
Manager.createPlayer(getClass().getResourceAsStream
("nokia_tune.mid"), "audio/midi");
p.realize();
AudioOutputControl iAudioOutputControl=
(AudioOutputControl)p.getControl("com.nokia.mid.media.AudioOutputControl");
p.addPlayerListener(this);
In S40:
import javax.microedition.amms.*;
iAudioOutputControl = (AudioOutputControl) GlobalManager.getControl("com.nokia.mid.media.AudioOutputControl");
2. Setting and getting Audio Output Mode:
2.1 Setting PRIVATE mode:
iAudioOutputControl.setOutputMode(PRIVATE);
2.2 Getting Current Mode:
AudioOutput audioOutput = iAudioOutputControl.getCurrent();
int mode = audioOutput.getOutputMode();
3. Getting notification:
Notifications are supported only on SYMBIAN.
The notification about the preference change is done using
PlayerListener's playerUpdate() function.
Whereas, this specific Event type is "com.nokia.audiooutputchange.event"
and Event data is AudioOutput object.
public void playerUpdate(Player aPlayer, String aEvent, Object aEventData){
}
Field Summary | |
---|---|
static int |
ALL
The ALL audio output mode. |
static int |
DEFAULT
The DEFAULT audio output mode. |
static int |
NONE
The NONE audio output mode. |
static int |
PRIVATE
The PRIVATE audio output mode. |
static int |
PUBLIC
The PUBLIC audio output mode. |
Method Summary | |
---|---|
int[] |
getAvailableOutputModes()
Get all supported audio output modes |
AudioOutput |
getCurrent()
|
int |
getOutputMode()
Get the currently set audio output mode. |
int |
setOutputMode(int mode)
Sets the preferred audio output mode. |
Field Detail |
---|
static final int DEFAULT
No Preference. The audio routing is restored to the default value.
Value 0 is assigned to DEFAULT
.
SYMBIAN SPECIFIC BEHAVIOR:
Audio is by default routed to loudspeaker.
Audio output changes dynamically to headset, when headset is connected to
the device and vice versa. Application is notified about audio output
change with audio output change event.
static final int ALL
Audio is routed to one public and one private output at the same time. The primary output method within public and private outputs is selected by the device and can change dynamically when external peripherals are connected or disconnected by the user (see "public" and "private" for their priorities).
Value 1 is assigned to ALL
.
static final int NONE
Audio is not routed to any output.
Value 2 is assigned to NONE
.
static final int PRIVATE
Audio is routed to earpiece or wired / wireless(BT) headset if connected. If there are several private output methods available at the same time audio is routed to only one of those selected with following priority order 1) wired headset 2) wireless headset 3) earpiece.
Value 3 is assigned to PRIVATE
.
static final int PUBLIC
Audio is routed to loudspeaker, wireless(BT) speakers or TV output. If there are several public output methods available at the same time audio is routed to only one of those selected with following priority order: (1) wired headset 2) Loudspeaker
Value 4 is assigned to PUBLIC
.
Method Detail |
---|
int[] getAvailableOutputModes()
int getOutputMode()
This does not return the actual audio output mode of the device. The AudioOutput can be used to provide the actual audio output mode.
AudioOutput getCurrent()
int setOutputMode(int mode)
java.lang.IllegalArgumentException
- with message "audio output mode is
not valid" when the audio output mode is not valid
java.lang.IllegalStateException
- with message "Accessory connected" if
unable to change the audio routing due to an accessory connected
java.lang.SecurityException
- with message "Permission denied" if the
called does not have permission to set the audio routing.
SYMBIAN SPECIFIC BEHAVIOR:
This effects only a specific player instance.
Preference can be set when Player is in REALIZED, PREFETCHED,
STARTED or STOPPED state.
S40 SPECIFIC BEHAVIOR:
This will effect all players.
|
forum.nokia.com/java | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |