• Main Page
  • Related Pages
  • Packages
  • Classes
  • Files
  • File List

audio/AudioBuffer.java

Go to the documentation of this file.
00001 
00002 package audio;
00003 
00004 /**
00005  *  Encapsulates the concept of an audio buffer with a time-stamp.
00006  *  It also contains 'written' flag, which can be used to indicate
00007  *  whether there is written but unread data in the buffer.
00008  */
00009 public class AudioBuffer
00010 {
00011     private byte[] buf;
00012     private boolean written;
00013     private long timestamp;
00014 
00015     /**
00016      *  Constructs buffer with given size.
00017      */
00018     public AudioBuffer( int size )
00019     {
00020         this.buf = new byte[ size ];
00021     }
00022     
00023     /**
00024      *  Gets buffer contents.
00025      */
00026     public byte[] getByteArray ()
00027     {
00028         return this.buf;
00029     }
00030     
00031     /**
00032      *  Returns status of the flag 'written'
00033      */
00034     public boolean isWritten () 
00035     {
00036         return this.written;
00037     }
00038     
00039     /**
00040      *  Sets the flag 'written'
00041      */
00042     public void setWritten () 
00043     {
00044         this.written = true;
00045     }
00046     
00047     /**
00048      *  Resets the flag 'written'
00049      */
00050     public void setRead () 
00051     {
00052         this.written = false;
00053     }
00054     
00055     /**
00056      *  Returns the time-stamp associated with the buffer
00057      */
00058     public long getTimestamp () 
00059     {
00060         return timestamp;
00061     }
00062     
00063     /**
00064      *  Associates time-stamp with the buffer.
00065      */
00066     public void setTimestamp( long timestamp ) 
00067     {
00068         this.timestamp = timestamp;
00069     }
00070 }

Generated on Thu Dec 16 2010 14:44:42 for VoIP Kryptofon by  doxygen 1.7.2