org.qtunes.speaker.spi.justeport.javasoundspi
Class RAOPClient

java.lang.Object
  extended by org.qtunes.speaker.spi.justeport.javasoundspi.RAOPClient

public class RAOPClient
extends Object

The raw RAOP client. Pared down version of C# original


Field Summary
static int DEFAULTPORT
          The default port to connect RAOP client to
static float MAXGAIN
          The maximum valid value for setGain(double)
static float MINGAIN
          The minimum valid value for setGain(double)
 
Constructor Summary
RAOPClient(String host)
          Create a new RAOPClient
RAOPClient(String host, int port)
          Create a new RAOPClient
 
Method Summary
 void connect()
          Connect to the airport
 void disconnect()
          Disconnect from the Airport
 void flush()
          Flush any buffered data on the Airport - used to stop audio immediately
 double getGain()
          Get the gain from the Airport
 String getServerType()
          Get the server type (only valid after connection)
 boolean isAudioJackConnected()
          Return true if the audio-jack on the Airport is connected
 boolean isAudioJackDigital()
          Return true if the audio-jack on the Airport is digital (false=analog)
 void setGain(double gain)
          Set the gain on the Airport
 void write(byte[] buf, int off, int len, boolean bigendian)
          Write a block of data to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTPORT

public static final int DEFAULTPORT
The default port to connect RAOP client to

See Also:
Constant Field Values

MINGAIN

public static final float MINGAIN
The minimum valid value for setGain(double)

See Also:
Constant Field Values

MAXGAIN

public static final float MAXGAIN
The maximum valid value for setGain(double)

See Also:
Constant Field Values
Constructor Detail

RAOPClient

public RAOPClient(String host)
Create a new RAOPClient

Parameters:
host - the host to connect to, eg "airport.local"

RAOPClient

public RAOPClient(String host,
                  int port)
Create a new RAOPClient

Parameters:
host - the host to connect to, eg "airport.local"
port - the port to connect to, eg 5000
Method Detail

getServerType

public String getServerType()
Get the server type (only valid after connection)


isAudioJackConnected

public boolean isAudioJackConnected()
Return true if the audio-jack on the Airport is connected


isAudioJackDigital

public boolean isAudioJackDigital()
Return true if the audio-jack on the Airport is digital (false=analog)


connect

public void connect()
             throws IOException,
                    GeneralSecurityException
Connect to the airport

Throws:
IOException - if the connection fails
GeneralSecurityException - if the encryption fails for any reason

flush

public void flush()
           throws IOException
Flush any buffered data on the Airport - used to stop audio immediately

Throws:
IOException

disconnect

public void disconnect()
                throws IOException
Disconnect from the Airport

Throws:
IOException

getGain

public double getGain()
Get the gain from the Airport

Returns:
the gain - a value between MINGAIN and MAXGAIN

setGain

public void setGain(double gain)
             throws IOException
Set the gain on the Airport

Parameters:
gain - a value between MINGAIN and MAXGAIN
Throws:
IOException

write

public void write(byte[] buf,
                  int off,
                  int len,
                  boolean bigendian)
           throws IOException
Write a block of data to the server. The block must be 16384 bytes long or an IllegalStateException is thrown.

Parameters:
buf - the buffer
off - the offset into the buffer to read data from
len - the value 16384
Throws:
IOException