|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.SignalSplitter
public class SignalSplitter
A SignalSplitter
acts exactly like a headphone splitter.
When you pass it audio with the samples
method, it echoes that
audio out to all of its listeners, giving each their own copy of the audio.
In other words, changes that the listeners make to the float arrays
they receive from a SignalSplitter
will not be reflected in
the arrays you pass to samples
. SignalSplitter
is
fully synchronized
so that listeners cannot be added and
removed while it is in the midst transmitting.
Constructor Summary | |
---|---|
SignalSplitter(javax.sound.sampled.AudioFormat format,
int bufferSize)
Construct a SignalSplitter that will receive
audio in the given format and in buffers the size of
bufferSize . |
Method Summary | |
---|---|
void |
addListener(AudioListener listener)
Adds a listener who will be notified each time this receives or creates a new buffer of samples. |
int |
bufferSize()
Returns the buffer size being used by this. |
javax.sound.sampled.AudioFormat |
getFormat()
Returns the format of this recordable audio. |
void |
removeListener(AudioListener listener)
Removes the listener from the list of listeners. |
float |
sampleRate()
Returns the sample rate of this recordable audio. |
void |
samples(float[] samp)
Called by the Recordable object this is attached to
when that object has new samples. |
void |
samples(float[] sampL,
float[] sampR)
Called by the Recordable object this is attached to
when that object has new samples. |
int |
type()
Returns either Minim.MONO or Minim.STEREO |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SignalSplitter(javax.sound.sampled.AudioFormat format, int bufferSize)
SignalSplitter
that will receive
audio in the given format and in buffers the size of
bufferSize
. Strictly speaking, a SignalSplitter
doesn't care about either of these things because it does nothing with
the samples it receives other than pass them on. But both things are
required to fulfill the Recordable
contract.
format
- the AudioFormat
of samples that this will receivebufferSize
- the size of the float arrays this will receiveMethod Detail |
---|
public int bufferSize()
Recordable
bufferSize
in interface Recordable
public javax.sound.sampled.AudioFormat getFormat()
Recordable
getFormat
in interface Recordable
public int type()
Recordable
type
in interface Recordable
public void addListener(AudioListener listener)
Recordable
addListener
in interface Recordable
listener
- the listener to addpublic void removeListener(AudioListener listener)
Recordable
removeListener
in interface Recordable
listener
- the listener to removepublic void samples(float[] samp)
AudioListener
Recordable
object this is attached to
when that object has new samples.
samples
in interface AudioListener
samp
- a buffer of samples from a MONO sound streampublic void samples(float[] sampL, float[] sampR)
AudioListener
Recordable
object this is attached to
when that object has new samples.
samples
in interface AudioListener
sampL
- the left channel of a STEREO sound streamsampR
- the right channel of a STEREO sound streampublic float sampleRate()
Recordable
sampleRate
in interface Recordable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |