com.vodafone.v10.sound
Class SoundPlayer

java.lang.Object
  |
  +--com.vodafone.v10.sound.SoundPlayer

public class SoundPlayer
extends java.lang.Object

The SoundPlayer class manages "virtual sound source" tracks capable of being configured inside the sound source of the handset. Functions are defined for allocating these tracks on request from a Java application, and for releasing them when they are no longer needed.

SoundPlayer Creation

Use the SoundPlayer static method getPlayer() to acquire a SoundPlayer object.

getTrackCount() can be used to get the number of available tracks. The valid track numbers are those from 0 to one less than the value obtained by getTrackCount(). The number of available tracks is implementation dependent, but at minimum 2 tracks can be used.

Acquiring Playback Resources

A Java application must use getTrack() to get a SoundTrack object. There are two kinds of getTrack() usage, getTrack(int track) by which the track number is explicitly designated, and getTrack() which leaves track number assignment to SoundPlayer. An exception is thrown if the track number is explicitly designated but that track is already allocated, or if track assignment is left to SoundPlayer but no more tracks are available. The individual sound data is played using the acquired SoundTrack objects.

SoundTrack Tandem Control

The SoundPlayer class provides methods for forcibly stopping, pausing and resuming sound data playback by all SoundTrack objects at once. The kill() method is used for forcible stopping, the pause() method for pausing, and the resume() method for resuming.


Method Summary
 void disposePlayer()
          Destroys a player.
 void disposeTrack(SoundTrack t)
          Returns a track to the player after use.
static SoundPlayer getPlayer()
          Gets a player.
 SoundTrack getTrack()
          Gets an available track.
 SoundTrack getTrack(int track)
          Gets the designated track.
 int getTrackCount()
          Gets the number of tracks.
 void kill()
          Forcibly stops playback on all tracks and removes the sound data.
 void pause()
          Pauses playback on all tracks.
 void resume()
          Resumes playback on all tracks.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPlayer

public static SoundPlayer getPlayer()
Gets a player.
Returns:
SoundPlayer - Player
Throws:
RuntimeException - if the native player could not be set to sound mode.

getTrack

public SoundTrack getTrack()
Gets an available track. The highest-numbered track is passed.
Returns:
SoundTrack - Track
Throws:
IllegalStateException - if there is no available track.

getTrack

public SoundTrack getTrack(int track)
Gets the designated track.
Parameters:
track - Track number
Returns:
SoundTrack - Track
Throws:
IllegalArgumentException - if the designated track number is not in the range of available tracks.
IllegalStateException - if the designated track is in use.

getTrackCount

public int getTrackCount()
Gets the number of tracks.
Returns:
int - Track count

disposePlayer

public void disposePlayer()
Destroys a player.

disposeTrack

public void disposeTrack(SoundTrack t)
Returns a track to the player after use.
Parameters:
t - - The used track
Throws:
NullPointerException - if the track designated in t is null.

kill

public void kill()
Forcibly stops playback on all tracks and removes the sound data.

pause

public void pause()
Pauses playback on all tracks.

resume

public void resume()
Resumes playback on all tracks.


Copyright 2002,2003 Aplix Corporation. All rights reserved. Aplix Confidential and Restricted.