SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media.protocol.portaudio.streams
Class OutputPortAudioStream

java.lang.Object
  extended by net.java.sip.communicator.impl.media.protocol.portaudio.streams.OutputPortAudioStream

public class OutputPortAudioStream
extends Object

The output stream that opens and writes to the PortAudio stream.

Author:
Damian Minkov

Constructor Summary
OutputPortAudioStream(int deviceIndex, double sampleRate, int channels)
          Creates output stream.
OutputPortAudioStream(int deviceIndex, double sampleRate, int channels, long sampleFormat)
          Creates output stream.
 
Method Summary
 int getDeviceIndex()
          The index of the device that we use.
 long getStream()
          The pointer of the PortAudio stream.
 void start()
          Starts the stream operation
 void stop()
          Stops the stream operation.
 void write(byte[] buffer)
          We will split everything into parts of PortAudioManager.NUM_SAMPLES.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputPortAudioStream

public OutputPortAudioStream(int deviceIndex,
                             double sampleRate,
                             int channels)
                      throws PortAudioException
Creates output stream.

Parameters:
deviceIndex - the index of the device to use.
sampleRate - the samepl rate.
channels - the channels to serve.
Throws:
PortAudioException - if stream fails to open.

OutputPortAudioStream

public OutputPortAudioStream(int deviceIndex,
                             double sampleRate,
                             int channels,
                             long sampleFormat)
                      throws PortAudioException
Creates output stream.

Parameters:
deviceIndex - the index of the device to use.
sampleRate - the samepl rate.
channels - the channels to serve.
sampleFormat - the sample format to use.
Throws:
PortAudioException - if stream fails to open.
Method Detail

write

public void write(byte[] buffer)
           throws PortAudioException
We will split everything into parts of PortAudioManager.NUM_SAMPLES. If something is left we will save it for next write and use it than.

Parameters:
buffer - the current buffer.
Throws:
PortAudioException - error while writing to device.

start

public void start()
           throws PortAudioException
Starts the stream operation

Throws:
PortAudioException

stop

public void stop()
          throws PortAudioException
Stops the stream operation.

Throws:
PortAudioException

getDeviceIndex

public int getDeviceIndex()
The index of the device that we use.

Returns:
the deviceIndex

getStream

public long getStream()
The pointer of the PortAudio stream.

Returns:
the stream pointer.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.