Package samer.audio

Class MultiFileAudioStream

  • java.lang.Object
    • java.io.InputStream
      • samer.audio.MultiFileAudioStream


  • public abstract class MultiFileAudioStream
    extends java.io.InputStream
    • Constructor Summary

      Constructors 
      Constructor and Description
      MultiFileAudioStream(javax.sound.sampled.AudioFormat target, java.util.List<java.io.File> files)
      Construct a FileSource initialised with current file and loop initialised from the current Environment.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int available()
      Returns number of bytes available in current file
      void close()
      Closes current input stream
      java.util.List<java.io.File> directory(java.io.File dir, java.lang.String ext)
      Set playlist to all WAV files in given directory
      javax.sound.sampled.AudioFormat getFormat() 
      java.util.List<java.io.File> getPlaylist() 
      boolean isOpen() 
      void next()
      Move to head of next file in playlist
      void open()
      Opens the playlist starting with the first file.
      void prev()
      Move to head of previous file in playlist
      int read(byte[] buf, int off, int len)
      Returns a Task which copies samples as doubles into the given buffer between the given positions.
      void rewind()
      Go back to start of playlist.
      • Methods inherited from class java.io.InputStream

        mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • MultiFileAudioStream

        public MultiFileAudioStream(javax.sound.sampled.AudioFormat target,
                                    java.util.List<java.io.File> files)
        Construct a FileSource initialised with current file and loop initialised from the current Environment. No exception is thrown if the current file cannot be opened, however, you must be sure to set it to a valid file (or to set a playlist) before trying to read any samples.
    • Method Detail

      • getFormat

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

        public java.util.List<java.io.File> directory(java.io.File dir,
                                                      java.lang.String ext)
        Set playlist to all WAV files in given directory
      • getPlaylist

        public java.util.List<java.io.File> getPlaylist()
      • rewind

        public void rewind()
                    throws java.io.IOException
        Go back to start of playlist. Next block of samples will be from head of first file in playlist. Will throw an exception if there is no playlist
        Throws:
        java.io.IOException
      • next

        public void next()
                  throws java.io.IOException
        Move to head of next file in playlist
        Throws:
        java.io.IOException
      • prev

        public void prev()
                  throws java.lang.Exception
        Move to head of previous file in playlist
        Throws:
        java.lang.Exception
      • isOpen

        public boolean isOpen()
      • close

        public void close()
        Closes current input stream
        Overrides:
        close in class java.io.InputStream
      • open

        public void open()
                  throws java.lang.Exception
        Opens the playlist starting with the first file.
        Throws:
        java.lang.Exception
      • available

        public int available()
        Returns number of bytes available in current file
        Overrides:
        available in class java.io.InputStream
      • read

        public int read(byte[] buf,
                        int off,
                        int len)
                 throws java.io.IOException
        Returns a Task which copies samples as doubles into the given buffer between the given positions.
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException