com.tuneology.avm.player
Class ALSAPlayer
java.lang.Object
|
+--com.tuneology.avm.player.Player
|
+--com.tuneology.avm.player.LocalPlayer
|
+--com.tuneology.avm.player.ALSAPlayer
- All Implemented Interfaces:
- AudioPlayer, MediaPlayer
- public class ALSAPlayer
- extends LocalPlayer
- implements AudioPlayer
A native API to ALSA player.
- Version:
- $Id: ALSAPlayer.java,v 1.8 2003/06/19 17:55:54 xnarf Exp $
- Author:
- Fran Taylor
|
Constructor Summary |
ALSAPlayer(java.lang.String dev,
java.lang.String name)
|
|
Method Summary |
void |
close()
Close the player and release its resources. |
void |
cueFile(MediaData mf)
Loads the sound file, determines its type and characteristics,
and gets ready to play the file. |
static java.lang.String |
getDescription()
|
static java.lang.String[] |
getDevices()
|
static java.lang.String |
getFormatName(int fmt)
Returns a string containing the name of the audio format,
suitable for user display. |
java.lang.String |
getName()
|
int |
getSize()
Returns the maximum size of the current file. |
static java.lang.String |
getStreamName(int fmt)
|
static java.lang.String |
getVersionString()
|
Volume |
getVolume()
Gets the audio output volume. |
VolumeRange |
getVolumeRange()
|
static boolean |
isEnabled()
Returns true if ALSA libraries are present. |
void |
jumpTo(int pos)
Moves the current position. |
void |
pause()
Temporarily stops playing at the current position. |
void |
play()
Starts playing after calling stop or cuefile. |
boolean |
playFile(java.lang.String f)
Play the file, blocking until it's done. |
void |
playNextTrack()
|
void |
playPrevTrack()
|
void |
playStream(java.io.InputStream str)
|
void |
setVolume(Volume vol)
Sets the audio output volume. |
void |
shutdown()
|
void |
stop()
Stops playing and resets the current position to the
beginning of the file. |
static void |
touch()
|
void |
unpause()
Starts playing after calling pause or cueFile. |
| Methods inherited from class com.tuneology.avm.player.LocalPlayer |
canEject, eject, getCanvas, getMixerChannel, getPcmChannel, initInstance, setArtist, setTime, setTitle, setTotal, setTrack |
| Methods inherited from class com.tuneology.avm.player.Player |
addStatusListener, findPlayerClass, findVideoPlayerClass, formatSeconds, getAudioDevices, getAudioPlayers, getDescription, getDevice, getDeviceDescription, getLoop, getVersions, getVideoPlayers, newMediaPlayer, removeStatusListener, setDevice, setLoop, shutdownPlayers |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.tuneology.avm.player.MediaPlayer |
addStatusListener, getCanvas, getDevice, getLoop, removeStatusListener, setArtist, setDevice, setLoop, setTitle, setTotal, setTrack |
STREAM_FORMAT_FIRST
public static final int STREAM_FORMAT_FIRST
STREAM_FORMAT_RAW
public static final int STREAM_FORMAT_RAW
STREAM_FORMAT_VOC
public static final int STREAM_FORMAT_VOC
STREAM_FORMAT_WAVE
public static final int STREAM_FORMAT_WAVE
STREAM_FORMAT_AU
public static final int STREAM_FORMAT_AU
STREAM_FORMAT_LAST
public static final int STREAM_FORMAT_LAST
DATA_FORMAT_FIRST
public static final int DATA_FORMAT_FIRST
DATA_FORMAT_S8
public static final int DATA_FORMAT_S8
DATA_FORMAT_U8
public static final int DATA_FORMAT_U8
DATA_FORMAT_S16_LE
public static final int DATA_FORMAT_S16_LE
DATA_FORMAT_S16_BE
public static final int DATA_FORMAT_S16_BE
DATA_FORMAT_U16_LE
public static final int DATA_FORMAT_U16_LE
DATA_FORMAT_U16_BE
public static final int DATA_FORMAT_U16_BE
DATA_FORMAT_MU_LAW
public static final int DATA_FORMAT_MU_LAW
DATA_FORMAT_A_LAW
public static final int DATA_FORMAT_A_LAW
DATA_FORMAT_IMA_ADPCM
public static final int DATA_FORMAT_IMA_ADPCM
DATA_FORMAT_MPEG
public static final int DATA_FORMAT_MPEG
DATA_FORMAT_LAST
public static final int DATA_FORMAT_LAST
ALSAPlayer
public ALSAPlayer(java.lang.String dev,
java.lang.String name)
throws java.lang.Exception
- Parameters:
dev - the output device- Throws:
java.io.IOException -
getDevices
public static java.lang.String[] getDevices()
isEnabled
public static boolean isEnabled()
- Returns true if ALSA libraries are present.
playFile
public boolean playFile(java.lang.String f)
throws java.lang.Exception
- Description copied from interface:
MediaPlayer
- Play the file, blocking until it's done.
- Specified by:
playFile in interface MediaPlayer
- Parameters:
f - a file to play- Throws:
java.lang.Exception -
playStream
public void playStream(java.io.InputStream str)
throws java.lang.Exception
- Specified by:
playStream in interface MediaPlayer
- Parameters:
str - - Throws:
java.lang.Exception -
playNextTrack
public void playNextTrack()
throws java.lang.Exception
- Specified by:
playNextTrack in interface MediaPlayer- Overrides:
playNextTrack in class LocalPlayer
- Throws:
java.lang.Exception -
playPrevTrack
public void playPrevTrack()
throws java.lang.Exception
- Specified by:
playPrevTrack in interface MediaPlayer- Overrides:
playPrevTrack in class LocalPlayer
- Throws:
java.lang.Exception -
cueFile
public void cueFile(MediaData mf)
throws java.lang.Exception
- Loads the sound file, determines its type and characteristics,
and gets ready to play the file. getSize() is valid after
cueFile has been called.
- Specified by:
cueFile in interface MediaPlayer
- Parameters:
f - the file to play- Throws:
java.lang.Exception -
getSize
public int getSize()
throws java.lang.Exception
- Description copied from interface:
MediaPlayer
- Returns the maximum size of the current file.
- Specified by:
getSize in interface MediaPlayer
- Throws:
java.lang.Exception -
jumpTo
public void jumpTo(int pos)
throws java.lang.Exception
- Moves the current position. Valid values are 0 - getSize().
If the player was playing, it will continue playing
at the new position. If the player was paused, it will
remain paused at the new position.
- Specified by:
jumpTo in interface MediaPlayer- Overrides:
jumpTo in class LocalPlayer
- Parameters:
pos - - Throws:
java.lang.Exception -
shutdown
public void shutdown()
- Overrides:
shutdown in class Player
play
public void play()
throws java.lang.Exception
- Description copied from interface:
MediaPlayer
- Starts playing after calling stop or cuefile.
- Specified by:
play in interface MediaPlayer- Overrides:
play in class LocalPlayer
- Following copied from interface:
com.tuneology.avm.player.MediaPlayer
- Throws:
java.lang.Exception -
pause
public void pause()
throws java.lang.Exception
- Temporarily stops playing at the current position.
- Specified by:
pause in interface MediaPlayer- Overrides:
pause in class LocalPlayer
- Throws:
java.lang.Exception -
unpause
public void unpause()
throws java.lang.Exception
- Starts playing after calling pause or cueFile.
- Specified by:
unpause in interface MediaPlayer- Overrides:
unpause in class LocalPlayer
- Throws:
java.lang.Exception -
stop
public void stop()
throws java.lang.Exception
- Stops playing and resets the current position to the
beginning of the file.
- Specified by:
stop in interface MediaPlayer- Overrides:
stop in class LocalPlayer
- Throws:
java.lang.Exception -
getVolumeRange
public VolumeRange getVolumeRange()
- Specified by:
getVolumeRange in interface MediaPlayer- Overrides:
getVolumeRange in class LocalPlayer
- Following copied from class:
com.tuneology.avm.player.LocalPlayer
- Throws:
java.lang.Exception -
getVolume
public Volume getVolume()
throws java.io.IOException
- Gets the audio output volume.
- Specified by:
getVolume in interface MediaPlayer- Overrides:
getVolume in class LocalPlayer
- Returns:
- volume level.
- Throws:
java.io.IOException -
setVolume
public void setVolume(Volume vol)
throws java.io.IOException
- Sets the audio output volume.
- Specified by:
setVolume in interface MediaPlayer- Overrides:
setVolume in class LocalPlayer
- Parameters:
vol - - Throws:
java.io.IOException -
close
public void close()
throws java.lang.Exception
- Description copied from interface:
MediaPlayer
- Close the player and release its resources.
- Specified by:
close in interface MediaPlayer
- Throws:
java.lang.Exception -
getName
public java.lang.String getName()
- Specified by:
getName in interface MediaPlayer- Overrides:
getName in class Player
getStreamName
public static java.lang.String getStreamName(int fmt)
getFormatName
public static java.lang.String getFormatName(int fmt)
- Returns a string containing the name of the audio format,
suitable for user display.
- Parameters:
fmt - the format id- Returns:
- a string containing the name of the audio format.
touch
public static void touch()
getDescription
public static java.lang.String getDescription()
getVersionString
public static java.lang.String getVersionString()