Class AudioClient

java.lang.Object
  |
  +--AudioClient

public class AudioClient
extends java.lang.Object

This class is the native interface for AudioClient.

Version:
1.0
Author:
Thomas Dreibholz (Dreibholz@bigfoot.com)

Constructor Summary
AudioClient(int outputDevice)
          Constructor for a new AudioClient.
 
Method Summary
 void change(java.lang.String mediaName)
          Change media of an established connection.
 void doFinalization()
          Do garbage collection: Delete AudioClient and AudioDevice.
 void finalize()
          Do garbage collection.
 int getBandwidthLimit()
          Get bandwidth limit.
 int getBits()
          Get number of audio bits
 int getBitsPerSample()
          Get bits per sample.
 int getByteOrder()
          Get audio byte order.
 int getBytesPerSecond()
          Get audio bytes per second.
 long getBytesReceived(int layer)
          Get number of bytes received
 int getChannels()
          Get number of audio channels.
 java.lang.String getEncoding()
          Get encoding name.
 java.lang.String getEncodingName(int index)
          Get encoding name for a given index of the client's decoder repository.
 int getErrorCode()
          Get error code.
 int getFlowLabel(int layer)
          Get flow label of last received packet in given layer.
 double getFractionLost(int layer)
          Get fraction of packets lost in given layer.
 int getIPVersion()
          Get IP version.
 double getJitter(int layer)
          Get jitter in given layer.
 int getLayers()
          Get number of layers in last transmission.
 long getMaxPosition()
          Get maximum media position.
 void getMediaInfo(MediaInfo mediaInfo)
          Get MediaInfo.
 java.lang.String getNameForTrafficClass(int trafficClass)
          Get name for traffic class.
 java.lang.String getOurAddressString()
          Get client address string.
 int getOurSSRC()
          Get client SSRC.
 long getPacketsLost(int layer)
          Get number of packets lost in given layer.
 long getPacketsReceived(int layer)
          Get number of packets received
 long getPosition()
          Get current media position.
 int getRawBytesPerSecond()
          Get number of raw bytes (incl.
 int getSamplingRate()
          Get audio sampling rate.
 java.lang.String getServerAddressString()
          Get server address string.
 int getServerSSRC(int layer)
          Get server SSRC in given layer.
 int getTrafficClass(int layer)
          Get traffic class of last received packet in given layer.
 void getTransportInfo(TransportInfo transportInfo)
          Get TransportInfo for current setting.
 int getValidBits(int index)
          Get entry from table of valid audio bits.
 int getValidSamplingRate(int index)
          Get entry from table of valid sampling rates.
static void killJavaInterpreter()
          Kill Java interpreter by sending SIGINT and SIGKILL to current process.
 boolean play(java.lang.String server, java.lang.String mediaName)
          Start playing given media from given server.
 boolean playing()
          Check, if audio client is playing.
 void setBandwidthLimit(int bandwidthLimit)
          Set bandwidth limit.
 void setBits(int bits)
          Set number of audio bits.
 void setChannels(int channels)
          Set number of audio channels
 void setEncoding(int index)
          Set encoding by index in client's decoder repository.
 void setPause(boolean on)
          Set pause.
 void setPosition(long position)
          Set media position.
 void setSamplingRate(int rate)
          Set audio sampling rate.
 void stop()
          Stop playing.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioClient

public AudioClient(int outputDevice)
            throws java.lang.OutOfMemoryError
Constructor for a new AudioClient.
Parameters:
outputDevice - 0 for AudioDevice, 1000 for AudioDebug, -1 for AudioNull.
Method Detail

doFinalization

public void doFinalization()
Do garbage collection: Delete AudioClient and AudioDevice. Note: Due to some Java incompatibilities, the native method destructIt may not be called from finalize() directly. Otherwise Java will crash running destructIt() (AudioClient and AudioDevice addresses are not delivered correctly to native method!!)

finalize

public void finalize()
Do garbage collection. Note: Due to some Java incompatibilities, the native method destructIt may not be called from finalize() directly. Otherwise Java will crash running destructIt() (AudioClient and AudioDevice addresses are not delivered correctly to native method!!)
Overrides:
finalize in class java.lang.Object

killJavaInterpreter

public static void killJavaInterpreter()
Kill Java interpreter by sending SIGINT and SIGKILL to current process. This is necessary due to Java 1.3 System.exit() bug!

play

public boolean play(java.lang.String server,
                    java.lang.String mediaName)
Start playing given media from given server.
Parameters:
server - Server address (e.g. gaffel:7500).
mediaName - Media name (e.g. ../AudioFiles/Test1.list)
Returns:
true, if play request has been sent to server.

change

public void change(java.lang.String mediaName)
Change media of an established connection.
Parameters:
mediaName - New media name (e.g. ../AudioFiles/Test2.list)
See Also:
play(java.lang.String, java.lang.String)

stop

public void stop()
Stop playing.

getPosition

public long getPosition()
Get current media position.
Returns:
Position in milliseconds.

getMaxPosition

public long getMaxPosition()
Get maximum media position.
Returns:
Maximum position in milliseconds.

getSamplingRate

public int getSamplingRate()
Get audio sampling rate.
Returns:
Sampling rate.

getChannels

public int getChannels()
Get number of audio channels.
Returns:
Number of audio channels.

getBits

public int getBits()
Get number of audio bits
Returns:
Number of audio bits

getBytesPerSecond

public int getBytesPerSecond()
Get audio bytes per second.
Returns:
Number of bytes per second.

getBitsPerSample

public int getBitsPerSample()
Get bits per sample.
Returns:
Number of bits per sample.

getByteOrder

public int getByteOrder()
Get audio byte order.
Returns:
Audio byte order.

getRawBytesPerSecond

public int getRawBytesPerSecond()
Get number of raw bytes (incl. IPv6/UDP/RTP/RTPAudio headers) per second.
Returns:
Number of raw bytes per second.

getBytesReceived

public long getBytesReceived(int layer)
Get number of bytes received
Parameters:
layer - Layer number or -1 for sum of all layers.
Returns:
Number of bytes received

getPacketsReceived

public long getPacketsReceived(int layer)
Get number of packets received
Parameters:
layer - Layer number or -1 for sum of all layers.
Returns:
Number of packets received

getTransportInfo

public void getTransportInfo(TransportInfo transportInfo)
Get TransportInfo for current setting.
Parameters:
transportInfo - TransportInfo.

getMediaInfo

public void getMediaInfo(MediaInfo mediaInfo)
Get MediaInfo.
Parameters:
mediaInfo - MediaInfo.

getErrorCode

public int getErrorCode()
Get error code.
Returns:
Error code.

getIPVersion

public int getIPVersion()
Get IP version.
Returns:
IP Version.

getEncoding

public java.lang.String getEncoding()
Get encoding name.
Returns:
Encoding name.

getBandwidthLimit

public int getBandwidthLimit()
Get bandwidth limit.
Returns:
Bandwidth limit.

getEncodingName

public java.lang.String getEncodingName(int index)
Get encoding name for a given index of the client's decoder repository.
Parameters:
index - Repository index.
Returns:
Encoding name or NULL, if index is too high.

getValidSamplingRate

public int getValidSamplingRate(int index)
Get entry from table of valid sampling rates.
Parameters:
index - Table index.
Returns:
Value or NULL, if index is too high.

getValidBits

public int getValidBits(int index)
Get entry from table of valid audio bits.
Parameters:
index - Table index.
Returns:
Value or NULL, if index is too high.

playing

public boolean playing()
Check, if audio client is playing.
Returns:
true, if client is playing; false otherwise.

getServerAddressString

public java.lang.String getServerAddressString()
Get server address string.
Returns:
Server address.

getOurAddressString

public java.lang.String getOurAddressString()
Get client address string.
Returns:
Client address.

getFlowLabel

public int getFlowLabel(int layer)
Get flow label of last received packet in given layer.
Parameters:
layer - Layer number.
Returns:
Flow label.

getTrafficClass

public int getTrafficClass(int layer)
Get traffic class of last received packet in given layer.
Parameters:
layer - Layer number.
Returns:
Traffic class.

getNameForTrafficClass

public java.lang.String getNameForTrafficClass(int trafficClass)
Get name for traffic class.
Parameters:
trafficClass - Traffic class.

getLayers

public int getLayers()
Get number of layers in last transmission.

getServerSSRC

public int getServerSSRC(int layer)
Get server SSRC in given layer.
Parameters:
layer - Layer number.
Returns:
Server SSRC.

getOurSSRC

public int getOurSSRC()
Get client SSRC.
Returns:
Client SSRC.

getPacketsLost

public long getPacketsLost(int layer)
Get number of packets lost in given layer.
Parameters:
layer - Layer number.
Returns:
Number of packets lost.

getFractionLost

public double getFractionLost(int layer)
Get fraction of packets lost in given layer.
Parameters:
layer - Layer number.
Returns:
Fraction of packets lost.

getJitter

public double getJitter(int layer)
Get jitter in given layer.
Parameters:
layer - Layer number.
Returns:
Jitter.

setPosition

public void setPosition(long position)
Set media position.
Parameters:
position - New media position in milliseconds.

setPause

public void setPause(boolean on)
Set pause.
Parameters:
on - true for pause on; false for pause off.

setSamplingRate

public void setSamplingRate(int rate)
Set audio sampling rate.
Parameters:
rate - New audio sampling rate.

setChannels

public void setChannels(int channels)
Set number of audio channels
Parameters:
channels - New number of audio channels.

setBits

public void setBits(int bits)
Set number of audio bits.
Parameters:
bits - New number of audio bits.

setEncoding

public void setEncoding(int index)
Set encoding by index in client's decoder repository.
Parameters:
index - Index in decoder repository.

setBandwidthLimit

public void setBandwidthLimit(int bandwidthLimit)
Set bandwidth limit.
Parameters:
bandwidthLimit - Bandwidth limit.