Package samer.audio

Class 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
    • Constructor Summary

      Constructors 
      Constructor and Description
      LineSource(javax.sound.sampled.TargetDataLine l, javax.sound.sampled.AudioFormat f)
      Create LineSource reading from given TargetDataLine
    • 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

      • getFormat

        public javax.sound.sampled.AudioFormat getFormat()
      • setBufferSize

        public void setBufferSize(int b)
      • getLine

        public javax.sound.sampled.DataLine getLine()
      • 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 interface AudioSource
      • reader

        public Task reader(float[] dbuf,
                           int off,
                           int len)
        Specified by:
        reader in interface AudioSource
      • 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)