Class AudioMixingPushBufferDataSource
- java.lang.Object
-
- javax.media.protocol.DataSource
-
- javax.media.protocol.PushBufferDataSource
-
- org.jitsi.impl.neomedia.conference.AudioMixingPushBufferDataSource
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.Duration,javax.media.protocol.CaptureDevice,javax.media.protocol.Controls,InbandDTMFDataSource,MuteDataSource
public class AudioMixingPushBufferDataSource extends javax.media.protocol.PushBufferDataSource implements javax.media.protocol.CaptureDevice, MuteDataSource, InbandDTMFDataSource
Represents a PushBufferDataSource which provides a single PushBufferStream containing the result of the audio mixing of DataSources.- Author:
- Lyubomir Marinov
-
-
Constructor Summary
Constructors Constructor Description AudioMixingPushBufferDataSource(AudioMixer audioMixer)Initializes a new AudioMixingPushBufferDataSource instance which gives access to the result of the audio mixing performed by a specific AudioMixer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDTMF(DTMFInbandTone tone)Adds a new inband DTMF tone to send.voidaddInDataSource(javax.media.protocol.DataSource inDataSource)Adds a new input DataSource to be mixed by the associated AudioMixer of this instance and to not have its audio contributions included in the mixing output represented by this DataSource.voidconnect()ImplementsDataSource.connect().voiddisconnect()ImplementsDataSource.disconnect().javax.media.CaptureDeviceInfogetCaptureDeviceInfo()ImplementsCaptureDevice.getCaptureDeviceInfo().StringgetContentType()ImplementsDataSource.getContentType().ObjectgetControl(String controlType)ImplementsControls.getControl(String).Object[]getControls()ImplementsControls.getControls().javax.media.TimegetDuration()ImplementsDuration.getDuration().javax.media.control.FormatControl[]getFormatControls()ImplementsCaptureDevice.getFormatControls().short[]getNextToneSignal(double sampleRate, int sampleSizeInBits)Gets the next inband DTMF tone signal.javax.media.protocol.PushBufferStream[]getStreams()ImplementsPushBufferDataSource.getStreams().booleanisMute()Determines whether this DataSource is mute.booleanisSendingDTMF()Determines whether this DataSource sends a DTMF tone.voidsetMute(boolean mute)Sets the mute state of this DataSource.voidstart()ImplementsDataSource.start().voidstop()ImplementsDataSource.stop().voidupdateInDataSource(javax.media.protocol.DataSource inDataSource)The input DataSource has been updated.
-
-
-
Constructor Detail
-
AudioMixingPushBufferDataSource
public AudioMixingPushBufferDataSource(AudioMixer audioMixer)
Initializes a new AudioMixingPushBufferDataSource instance which gives access to the result of the audio mixing performed by a specific AudioMixer.- Parameters:
audioMixer- the AudioMixer performing audio mixing, managing the input DataSources and pushing the data of the new output PushBufferDataSource
-
-
Method Detail
-
addDTMF
public void addDTMF(DTMFInbandTone tone)
Adds a new inband DTMF tone to send.- Specified by:
addDTMFin interfaceInbandDTMFDataSource- Parameters:
tone- the DTMF tone to send.
-
addInDataSource
public void addInDataSource(javax.media.protocol.DataSource inDataSource)
Adds a new input DataSource to be mixed by the associated AudioMixer of this instance and to not have its audio contributions included in the mixing output represented by this DataSource.- Parameters:
inDataSource- a DataSource to be added for mixing to the AudioMixer associate with this instance and to not have its audio contributions included in the mixing output represented by this DataSource
-
connect
public void connect() throws IOExceptionImplementsDataSource.connect(). Lets the AudioMixer know that one of its output PushBufferDataSources has been connected and marks this DataSource as connected.- Specified by:
connectin interfacejavax.media.protocol.CaptureDevice- Specified by:
connectin classjavax.media.protocol.DataSource- Throws:
IOException- if the AudioMixer fails to connect
-
disconnect
public void disconnect()
ImplementsDataSource.disconnect(). Marks this DataSource as disconnected and notifies the AudioMixer that one of its output PushBufferDataSources has been disconnected.- Specified by:
disconnectin interfacejavax.media.protocol.CaptureDevice- Specified by:
disconnectin classjavax.media.protocol.DataSource
-
getCaptureDeviceInfo
public javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
ImplementsCaptureDevice.getCaptureDeviceInfo(). Delegates to the associated AudioMixer because it knows which CaptureDevice is being wrapped.- Specified by:
getCaptureDeviceInfoin interfacejavax.media.protocol.CaptureDevice- Returns:
- the CaptureDeviceInfo of the CaptureDevice of the AudioMixer
-
getContentType
public String getContentType()
ImplementsDataSource.getContentType(). Delegates to the associated AudioMixer because it manages the inputs and knows their characteristics.- Specified by:
getContentTypein classjavax.media.protocol.DataSource- Returns:
- a String value which represents the type of the content being made available by this DataSource i.e. the associated AudioMixer
-
getControl
public Object getControl(String controlType)
ImplementsControls.getControl(String).- Specified by:
getControlin interfacejavax.media.Controls- Parameters:
controlType- a String value which names the type of the control of this instance to be retrieved- Returns:
- an Object which represents the control of this instance with the specified type if such a control is available; otherwise, null
-
getControls
public Object[] getControls()
ImplementsControls.getControls(). Gets an array of Objects which represent the controls available for this DataSource.- Specified by:
getControlsin interfacejavax.media.Controls- Returns:
- an array of Objects which represent the controls available for this DataSource
-
getDuration
public javax.media.Time getDuration()
ImplementsDuration.getDuration(). Delegates to the associated AudioMixer because it manages the inputs and knows their characteristics.- Specified by:
getDurationin interfacejavax.media.Duration- Returns:
- a Time value which represents the duration of the media being made available through this DataSource
-
getFormatControls
public javax.media.control.FormatControl[] getFormatControls()
ImplementsCaptureDevice.getFormatControls(). Delegates to the associated AudioMixer because it knows which CaptureDevice is being wrapped.- Specified by:
getFormatControlsin interfacejavax.media.protocol.CaptureDevice- Returns:
- an array of FormatControls of the CaptureDevice of the associated AudioMixer
-
getNextToneSignal
public short[] getNextToneSignal(double sampleRate, int sampleSizeInBits)Gets the next inband DTMF tone signal.- Parameters:
sampleRate- The sampling frequency (codec clock rate) in Hz of the stream which will encapsulate this signal.sampleSizeInBits- The size of each sample (8 for a byte, 16 for a short and 32 for an int)- Returns:
- The data array containing the DTMF signal.
-
getStreams
public javax.media.protocol.PushBufferStream[] getStreams()
ImplementsPushBufferDataSource.getStreams(). Gets a PushBufferStream which reads data from the associated AudioMixer and mixes its inputs.- Specified by:
getStreamsin classjavax.media.protocol.PushBufferDataSource- Returns:
- an array with a single PushBufferStream which reads data from the associated AudioMixer and mixes its inputs if this DataSource is connected; otherwise, an empty array
-
isMute
public boolean isMute()
Determines whether this DataSource is mute.- Specified by:
isMutein interfaceMuteDataSource- Returns:
- true if this DataSource is mute; otherwise, false
-
isSendingDTMF
public boolean isSendingDTMF()
Determines whether this DataSource sends a DTMF tone.- Returns:
- true if this DataSource is sending a DTMF tone; otherwise, false.
-
setMute
public void setMute(boolean mute)
Sets the mute state of this DataSource.- Specified by:
setMutein interfaceMuteDataSource- Parameters:
mute- true to mute this DataSource; otherwise, false
-
start
public void start() throws IOExceptionImplementsDataSource.start(). Starts the output PushBufferStream of this DataSource (if it exists) and notifies the AudioMixer that one of its output PushBufferDataSources has been started.- Specified by:
startin interfacejavax.media.protocol.CaptureDevice- Specified by:
startin classjavax.media.protocol.DataSource- Throws:
IOException- if anything wrong happens while starting the output PushBufferStream of this DataSource
-
stop
public void stop() throws IOExceptionImplementsDataSource.stop(). Notifies the AudioMixer that one of its output PushBufferDataSources has been stopped and stops the output PushBufferStream of this DataSource (if it exists).- Specified by:
stopin interfacejavax.media.protocol.CaptureDevice- Specified by:
stopin classjavax.media.protocol.DataSource- Throws:
IOException- if anything wrong happens while stopping the output PushBufferStream of this DataSource
-
updateInDataSource
public void updateInDataSource(javax.media.protocol.DataSource inDataSource)
The input DataSource has been updated.- Parameters:
inDataSource- the DataSource that was updated.
-
-