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

net.java.sip.communicator.impl.neomedia.portaudio.streams
Class InputPortAudioStream

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.portaudio.streams.InputPortAudioStream

public class InputPortAudioStream
extends Object

The input audio stream.

Author:
Damian Minkov, Lubomir Marinov

Constructor Summary
InputPortAudioStream(MasterPortAudioStream parentStream)
          Creates new input stream (slave) with master input stream.
 
Method Summary
 void read(javax.media.Buffer buffer)
          Reads audio data from this InputPortAudioStream into a specific Buffer blocking until audio data is indeed available.
(package private)  void setBuffer(byte[] bufferData, int bufferLength, long bufferTimeStamp)
          Sets the audio data to be read from this InputPortAudioStream upon the next request.
 void start()
          Starts the stream.
 void stop()
          Stops the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputPortAudioStream

public InputPortAudioStream(MasterPortAudioStream parentStream)
Creates new input stream (slave) with master input stream.

Parameters:
parentStream - the parent/master input stream.
Method Detail

read

public void read(javax.media.Buffer buffer)
          throws PortAudioException
Reads audio data from this InputPortAudioStream into a specific Buffer blocking until audio data is indeed available.

Parameters:
buffer - the Buffer into which the audio data read from this InputPortAudioStream is to be returned
Throws:
PortAudioException - if an error occurs while reading

setBuffer

void setBuffer(byte[] bufferData,
               int bufferLength,
               long bufferTimeStamp)
Sets the audio data to be read from this InputPortAudioStream upon the next request. Used by parentStream in order to provide all audio samples to all its slaves and not only to the one which caused the actual read from PortAudio.

Parameters:
bufferData - the audio data to be read from this InputPortAudioStream upon the next request
bufferLength - the number of bytes in bufferData which represent valid audio data to be read from this InputPortAudioStream upon the next request
bufferTimeStamp - the time stamp of the audio data in bufferData represented in accord with Buffer.FLAG_SYSTEM_TIME

start

public void start()
           throws PortAudioException
Starts the stream. Also starts the parent stream if its not already started.

Throws:
PortAudioException - if an error occurs while starting this InputPortAudioStream

stop

public void stop()
          throws PortAudioException
Stops the stream. Also stops the parent if we are the last slave stream that use it.

Throws:
PortAudioException - if an error occurs while stopping this InputPortAudioStream

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

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