ch.aplu.util
Class SoundPlayerExt

java.lang.Object
  extended by ch.aplu.util.SoundPlayer
      extended by ch.aplu.util.SoundPlayerExt

public class SoundPlayerExt
extends SoundPlayer

Class for playing sound files using file streaming in a separate thread. Sound format supported: WAV (PCM_SIGNED), MP3 (Layer 1,2,3)

MP3 decoder from JavaLayer distributed by SourceForge.net. The following jar files (or later versions) must reside in the classpath:
- jl1.0.1.jar
- mp3spi1.9.4.jar
- tritonius_share.jar
Download from www.javazoom.net or www.sourceforge.net.
Download of redistribution from www.aplu.ch/mp3support. With thanks to the authors.


Constructor Summary
SoundPlayerExt(javax.sound.sampled.AudioInputStream audioInputStream)
          Same as SoundPlayerExt(audioIputStream, mixerIndex) using the default sound device.
SoundPlayerExt(javax.sound.sampled.AudioInputStream audioInputStream, int mixerIndex)
          Construct a sound player attached to the given AudioInputStream using the given mixer index (sound device).
SoundPlayerExt(byte[] ary, javax.sound.sampled.AudioFormat audioFormat)
          Same as SoundPlayerExt(ary, audioFormat, mixerIndex) using the default sound device.
SoundPlayerExt(byte[] ary, javax.sound.sampled.AudioFormat audioFormat, int mixerIndex)
          Construct a sound player with data from the given byte array using the given mixer index (sound device).
SoundPlayerExt(java.io.ByteArrayOutputStream os, javax.sound.sampled.AudioFormat audioFormat)
          Same as SoundPlayerExt(os, audioFormat, mixerIndex) using the default sound device.
SoundPlayerExt(java.io.ByteArrayOutputStream os, javax.sound.sampled.AudioFormat audioFormat, int mixerIndex)
          Construct a sound player with data from the given ByteArrayOutputStream using the given mixer index (sound device).
SoundPlayerExt(java.io.File audioFile)
          Same as SoundPlayerEx(audioFile, mixerIndex) using the default sound device.
SoundPlayerExt(java.io.File audioFile, int nbMixer)
          Construct a sound player attached to given File instance using the given mixer index (sound device).
SoundPlayerExt(java.lang.Object resourceObj, java.lang.String audioPathname)
          Same as SoundPlayerExt(obj, audioPathname, mixerIndex) using the default sound device.
SoundPlayerExt(java.lang.Object resourceObj, java.lang.String audioPathname, int mixerIndex)
          Construct a sound player attached to given pathname from a JAR archive using the given mixer index (sound device).
SoundPlayerExt(java.lang.String audioPathname)
          Same as SoundPlayerEx(audioPathname, mixerIndex) using the default sound device.
SoundPlayerExt(java.lang.String audioPathname, int nbMixer)
          Construct a sound player attached to given pathname (relative or fully qualified) using the given mixer index (sound device).
SoundPlayerExt(java.net.URL url)
          Same as SoundPlayerEx(url, mixerIndex) using the default sound device.
SoundPlayerExt(java.net.URL url, int nbMixer)
          Construct a sound player attached to given URL using the given mixer index (sound device).
 
Method Summary
 java.lang.String getMP3Info()
          Return string with extended MP3 file information.
 
Methods inherited from class ch.aplu.util.SoundPlayer
addSoundConverter, addSoundPlayerListener, advanceFrames, advanceTime, blockingPlay, delay, getAvailableMixers, getCurrentPos, getCurrentTime, getFormat, getFrameRate, getFrameSize, getMixerIndex, getMono, getStereo, getVolume, getWavInfo, getWavMono, getWavRaw, getWavStereo, isPlaying, mute, pause, play, playLoop, replay, rewindFrames, rewindTime, setVolume, stop, URLfromJAR
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoundPlayerExt

public SoundPlayerExt(java.lang.Object resourceObj,
                      java.lang.String audioPathname,
                      int mixerIndex)
Construct a sound player attached to given pathname from a JAR archive using the given mixer index (sound device). The class loader of the specified object is used.

Deprecated: Use SoundPlayerExt(url, mixerIndex) instead.


SoundPlayerExt

public SoundPlayerExt(java.lang.Object resourceObj,
                      java.lang.String audioPathname)
Same as SoundPlayerExt(obj, audioPathname, mixerIndex) using the default sound device.

Deprecated: Use SoundPlayerExt(url) instead.


SoundPlayerExt

public SoundPlayerExt(java.net.URL url)
Same as SoundPlayerEx(url, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(javax.sound.sampled.AudioInputStream audioInputStream,
                      int mixerIndex)
Construct a sound player attached to the given AudioInputStream using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().

Throws:
java.lang.RuntimeException - if sound initialization fails

SoundPlayerExt

public SoundPlayerExt(javax.sound.sampled.AudioInputStream audioInputStream)
Same as SoundPlayerExt(audioIputStream, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(java.io.ByteArrayOutputStream os,
                      javax.sound.sampled.AudioFormat audioFormat,
                      int mixerIndex)
Construct a sound player with data from the given ByteArrayOutputStream using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().

Throws:
java.lang.RuntimeException - if sound initialization fails

SoundPlayerExt

public SoundPlayerExt(java.io.ByteArrayOutputStream os,
                      javax.sound.sampled.AudioFormat audioFormat)
Same as SoundPlayerExt(os, audioFormat, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(byte[] ary,
                      javax.sound.sampled.AudioFormat audioFormat,
                      int mixerIndex)
Construct a sound player with data from the given byte array using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().

Throws:
java.lang.RuntimeException - if sound initialization fails

SoundPlayerExt

public SoundPlayerExt(byte[] ary,
                      javax.sound.sampled.AudioFormat audioFormat)
Same as SoundPlayerExt(ary, audioFormat, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(java.net.URL url,
                      int nbMixer)
Construct a sound player attached to given URL using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().
Normally an installed sound device has two entries, one for playing and one for recording. You must use the index for the playing device. To load a resource from a jar file use java.net.URL url = getClass().getResource(""), e.g. java.net.URL url = getClass().getResource("wav/mysound.wav");

Throws:
java.lang.IllegalArgumentException - if sound resource or sound system is unavailable.

SoundPlayerExt

public SoundPlayerExt(java.io.File audioFile)
Same as SoundPlayerEx(audioFile, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(java.io.File audioFile,
                      int nbMixer)
Construct a sound player attached to given File instance using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().

Throws:
java.lang.RuntimeException - if sound initialization fails

SoundPlayerExt

public SoundPlayerExt(java.lang.String audioPathname)
Same as SoundPlayerEx(audioPathname, mixerIndex) using the default sound device.


SoundPlayerExt

public SoundPlayerExt(java.lang.String audioPathname,
                      int nbMixer)
Construct a sound player attached to given pathname (relative or fully qualified) using the given mixer index (sound device). To find the mixer indices of all installed sound devices call getAvailableMixers().

Throws:
java.lang.RuntimeException - if sound initialization fails
Method Detail

getMP3Info

public java.lang.String getMP3Info()
Return string with extended MP3 file information.