|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cnrg.itx.datax.Channel | +--cnrg.itx.datax.MixerChannel
MixerChannel acts as a channel with multiple inputs. Destinations can be set (as in a standard Channel) with the addDestination() method. To use multiple inputs, call the getNewInput method. This returns a Channel object that can be assigned a source. Example:
The following creates a MixerChannel and adds a microphone soruce and a mixer source to it.
Channel ch; MixerChannel mc = new MixerChannel(); ch = mc.getNewInput(); ch.setSource(new MicrophoneSource(ch)); ch = mc.getNewInput(); ch.setSource(new NetworkSource(...,ch,...));
Field Summary | |
private int |
BUFFER_TIME
The number of ms we try to hold buffered at our destination. |
private int |
iMyInstance
Instance number of the current mixer; used for stat output numbering. |
private java.util.Vector |
inChannels
a vector containing the input ChannelBuffers to feed into the mixer. |
(package private) static int |
instances
Number of instances of the mixer; used for statistics output numbering. |
private java.util.Hashtable |
ioLinks
holds correspondence between linked inputs and outputs for source muting in conferences. |
private int |
mixSampleSize
The number of bytes to be mixed at a time. |
private long |
outBytes
number of bytes the mixerChannel has sent so far |
private Channel |
outChannel
A post-mixing buffering channel. |
private int |
SAMPLE_RATE
The sample rate of the data to be mixed. |
private float |
SAMPLE_TIME
The number of time we have to process each byte in ms. |
private int |
totalSilence
Total bytes of silence mixed in to samples we've sent. |
private boolean |
useOutputChannel
Determines if we will use a second buffering stage after the mixer. |
Fields inherited from class cnrg.itx.datax.Channel |
closed,
destinations,
INPUT,
mode,
OTHER,
OUTPUT,
pipedInput,
pipedOutput,
readerThread,
running,
SAMPLE_SIZE,
sampleSize,
source |
Constructor Summary | |
MixerChannel()
Creates an mixerChannel with no sources or destinations. |
|
MixerChannel(int sampleSize)
Creates a new mixerChannel with the specified sample size. |
Method Summary | |
void |
addDestination(Destination d)
Method to add a destination for the Channel. |
void |
close()
This method closes the MixerChannel. |
private void |
doSetup()
Setup steps common to both constructors. |
Channel |
getNewInput()
Adds an additional source to the mixerChannel. |
Channel |
getNewSubtractedInput(Destination dest)
Adds an additional source to the mixerChannel that will be silent to the given destination. |
PropertiesCollection |
getProperties()
Gets the properties for this MixerChannel |
Source |
getSource()
Returns the channel's source. |
Stats |
getStatistics()
Method to get the statistics from the channel. |
void |
mute(boolean state)
Method to mute all the sources and destinations |
void |
open()
Method to open the Channel. |
void |
push(byte[] b)
This method will push data into the MixerChannel's output channel skipping over the mixer. |
void |
removeAllDestinations()
Method to remove all destinations. |
boolean |
removeDestination(Destination d)
Method to remove a destination from the list. |
void |
removeInput(Channel c)
Closes and removes a channel form the mixer. |
void |
removeInput(Source s)
Closes and removes from the mixer the channel corresponding to the given source. |
void |
run()
Implements the mixer thread. |
void |
setPeerProperties(PropertiesCollection pc)
Interface to set the given properties collection into the device. |
void |
setProperties(PropertiesCollection pc)
Sets the properties for this MixerChannel |
void |
setSource(Source s)
Sets the source of the Mixer channel to a single source. |
private byte[] |
subtract(int[] sum,
Destination dest,
java.util.Vector inputs)
|
private int[] |
sum(java.util.Vector v)
Sum adds together the corresponding elements of the byte[]'s in the specified vector. |
Methods inherited from class cnrg.itx.datax.Channel |
getMode,
setMode |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.util.Vector inChannels
private Channel outChannel
private long outBytes
private int mixSampleSize
private int BUFFER_TIME
private int SAMPLE_RATE
private float SAMPLE_TIME
private boolean useOutputChannel
static int instances
private int iMyInstance
private int totalSilence
private java.util.Hashtable ioLinks
Constructor Detail |
public MixerChannel()
public MixerChannel(int sampleSize)
sampleSize
- the number of bytes to be sent by the channel in each write.Method Detail |
private void doSetup()
public void addDestination(Destination d) throws DuplicateDestinationException
d
- The destination to add to the list of destination for the channelpublic boolean removeDestination(Destination d)
d
- The Destination object to removepublic void removeAllDestinations()
public void open() throws DataException
public void mute(boolean state)
state
- The state of the mute. true to mute and false to unmutepublic PropertiesCollection getProperties()
public void setProperties(PropertiesCollection pc)
pc
- The new PropertiesCollection for this MixerChannelpublic void setPeerProperties(PropertiesCollection pc) throws DataException
public Stats getStatistics()
public Source getSource()
public void setSource(Source s)
s
- the new source for the MixerChannelpublic Channel getNewInput()
public Channel getNewSubtractedInput(Destination dest)
dest
- the Destination object to be removed from the mix sent to the returned channelpublic void removeInput(Channel c)
Closing this channel also closes its source.
the
- channel corresponding to the input to be removed.public void removeInput(Source s)
(closes both channel and source)
NOTE: slower than removeInput(Channel c).
s
- the Source corresponding to the input to be removedpublic void run()
public void close()
public void push(byte[] b)
b
- the data to be sent to the outputprivate int[] sum(java.util.Vector v)
v
- a vector containing byte[]'s to be summed.private byte[] subtract(int[] sum, Destination dest, java.util.Vector inputs)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |