Package samer.audio

Class FileSink

  • java.lang.Object
    • Viewable
      • samer.audio.FileSink
  • All Implemented Interfaces:
    AudioSink


    public class FileSink
    extends Viewable
    implements AudioSink
    An AudioSink that writes to a wav file. Viewable name: "wavewriter"
    Properties read from current environment:
    filesink.current
    Current file (String)
    filesink.scale
    scale factor for converting floats/doubles (Double)
    • Constructor Summary

      Constructors 
      Constructor and Description
      FileSink(java.lang.String filename, javax.sound.sampled.AudioFormat fmt) 
      FileSink(javax.sound.sampled.AudioFormat fmt) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close() 
      void dispose() 
      void execute(java.lang.String cmd, Environment env) 
      void getCommands(Agent.Registry r) 
      VDouble getScale() 
      Viewer getViewer() 
      boolean isOpen() 
      void open() 
      void open(java.io.File file) 
      void setFormat(javax.sound.sampled.AudioFormat f) 
      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) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileSink

        public FileSink(java.lang.String filename,
                        javax.sound.sampled.AudioFormat fmt)
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • FileSink

        public FileSink(javax.sound.sampled.AudioFormat fmt)
    • Method Detail

      • dispose

        public void dispose()
        Specified by:
        dispose in interface AudioSink
      • getScale

        public VDouble getScale()
      • setFormat

        public void setFormat(javax.sound.sampled.AudioFormat f)
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface AudioSink
      • open

        public void open()
                  throws java.lang.Exception
        Specified by:
        open in interface AudioSink
        Throws:
        java.lang.Exception
      • open

        public void open(java.io.File file)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • close

        public void close()
        Specified by:
        close in interface AudioSink
      • 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.
        Specified by:
        writer in interface AudioSink
      • writer

        public Task writer(float[] dbuf,
                           int off,
                           int len)
        Specified by:
        writer in interface AudioSink
      • getCommands

        public void getCommands(Agent.Registry r)
      • execute

        public void execute(java.lang.String cmd,
                            Environment env)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getViewer

        public Viewer getViewer()