Package samer.audio
Class LineSource
- java.lang.Object
-
- Viewable
-
- samer.audio.VLine
-
- samer.audio.LineSource
-
- All Implemented Interfaces:
- AudioSource
public class LineSource extends VLine implements AudioSource
An AudioSource that reads from the sound card in real time. Uses a standard JavaSound TargetDataLine to get data. However, an alternative DataLine can be supplied instead. Audio format is determined by current environment--see VLine.Object is a Viewable, and is called "linein". Node is created in current context, ie with a parent determined by current Environment.
- See Also:
samer.core.AudioSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description protected class
LineSource.Reader
-
Nested classes/interfaces inherited from interface samer.audio.AudioSource
AudioSource.Util
-
-
Constructor Summary
Constructors Constructor and Description LineSource(javax.sound.sampled.TargetDataLine l, javax.sound.sampled.AudioFormat f)
Create LineSource reading from given TargetDataLine
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
closeImpl()
int
getChannels()
javax.sound.sampled.AudioFormat
getFormat()
javax.sound.sampled.DataLine
getLine()
float
getRate()
boolean
isOpen()
static javax.sound.sampled.DataLine.Info
lineInfo(javax.sound.sampled.AudioFormat fmt)
static javax.sound.sampled.DataLine.Info
lineInfo(javax.sound.sampled.AudioFormat fmt, int bufsize)
void
openImpl()
Open using default formatTask
reader(double[] dbuf, int off, int len)
return a task which reads samples into the given buffer The idea is that the audio source can choose the right kind of reader depending on the format of the audio stream, and then handle the conversion to doubles automaticallyTask
reader(float[] dbuf, int off, int len)
void
setBufferSize(int b)
-
Methods inherited from interface samer.audio.AudioSource
close, dispose, open
-
-
-
-
Constructor Detail
-
LineSource
public LineSource(javax.sound.sampled.TargetDataLine l, javax.sound.sampled.AudioFormat f) throws java.lang.Exception
Create LineSource reading from given TargetDataLine- Throws:
java.lang.Exception
-
-
Method Detail
-
getChannels
public int getChannels()
- Specified by:
getChannels
in interfaceAudioSource
-
getRate
public float getRate()
- Specified by:
getRate
in interfaceAudioSource
-
getFormat
public javax.sound.sampled.AudioFormat getFormat()
-
setBufferSize
public void setBufferSize(int b)
-
getLine
public javax.sound.sampled.DataLine getLine()
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceAudioSource
-
openImpl
public void openImpl() throws java.lang.Exception
Open using default format- Throws:
java.lang.Exception
-
closeImpl
public void closeImpl() throws java.lang.Exception
- Throws:
java.lang.Exception
-
reader
public Task reader(double[] dbuf, int off, int len)
Description copied from interface:AudioSource
return a task which reads samples into the given buffer The idea is that the audio source can choose the right kind of reader depending on the format of the audio stream, and then handle the conversion to doubles automatically- Specified by:
reader
in interfaceAudioSource
-
reader
public Task reader(float[] dbuf, int off, int len)
- Specified by:
reader
in interfaceAudioSource
-
lineInfo
public static javax.sound.sampled.DataLine.Info lineInfo(javax.sound.sampled.AudioFormat fmt)
-
lineInfo
public static javax.sound.sampled.DataLine.Info lineInfo(javax.sound.sampled.AudioFormat fmt, int bufsize)
-
-