Package samer.audio
Class LineSink
- java.lang.Object
-
- Viewable
-
- samer.audio.VLine
-
- samer.audio.LineSink
-
- All Implemented Interfaces:
- AudioSink
public class LineSink extends VLine implements AudioSink
An AudioSink that sends samples to a Java Sound SourceDataLine. Audio format can be determined in several ways (see below).Object is a Viewable, and is called "lineout". Reads property "scale" from current environment, but scale can be adjusted afterwards.
- See Also:
AudioSink
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description protected class
LineSink.Writer
-
Nested classes/interfaces inherited from interface samer.audio.AudioSink
AudioSink.Util
-
-
Constructor Summary
Constructors Constructor and Description LineSink(javax.sound.sampled.SourceDataLine l, javax.sound.sampled.AudioFormat f)
Create LineSink reading from given TargetDataLine
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
closeImpl()
void
dispose()
void
execute(java.lang.String cmd, Environment env)
void
getCommands(Registry r)
Commands are :"set scale".javax.sound.sampled.DataLine
getLine()
VDouble
getScale()
Returns the object used to store the scale factor for conversion from doubles/floats to shorts/bytes.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 the line using either the current format or the line's default format if none has been set.void
setBufferSize(int b)
Task
writer(double[] dbuf, int off, int len)
Return a task which takes samples from the given buffer The idea is that the audio sink can choose the right kind of writer depending on the format of the audio stream, and then handle any conversions automatically.Task
writer(float[] dbuf, int off, int len)
-
-
-
Constructor Detail
-
LineSink
public LineSink(javax.sound.sampled.SourceDataLine l, javax.sound.sampled.AudioFormat f) throws java.lang.Exception
Create LineSink reading from given TargetDataLine- Throws:
java.lang.Exception
-
-
Method Detail
-
getLine
public javax.sound.sampled.DataLine getLine()
-
setBufferSize
public void setBufferSize(int b)
-
getScale
public VDouble getScale()
Returns the object used to store the scale factor for conversion from doubles/floats to shorts/bytes. This is multiplied by 128 for conversion to 8 bit audio, or 32768 for conversion to 16 bit audio.
-
dispose
public void dispose()
-
openImpl
public void openImpl() throws java.lang.Exception
Open the line using either the current format or the line's default format if none has been set.- Throws:
java.lang.Exception
-
closeImpl
public void closeImpl() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getCommands
public void getCommands(Registry r)
Commands are :"set scale".- Overrides:
getCommands
in classVLine
-
execute
public void execute(java.lang.String cmd, Environment env) throws java.lang.Exception
-
writer
public Task writer(double[] dbuf, int off, int len)
Description copied from interface:AudioSink
Return a task which takes samples from the given buffer The idea is that the audio sink can choose the right kind of writer depending on the format of the audio stream, and then handle any conversions automatically.
-
writer
public Task writer(float[] dbuf, int off, int len)
-
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)
-
-