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

audio/AudioInterface.java

Go to the documentation of this file.
00001 
00002 /**
00003  *  Audio interfaces and CODECs
00004  */
00005 package audio;
00006 
00007 import java.io.IOException;
00008 
00009 /**
00010  *  The abstract audio interface.
00011  *
00012  *  @author Mikica B Kocic
00013  */
00014 public interface AudioInterface
00015 {
00016     /**
00017      *  Audio sender interface used by instance of the AudioInterface class 
00018      *  to send captured audio samples to the remote peer.
00019      */
00020     public interface Packetizer 
00021     {
00022         public abstract void send () throws IOException;
00023     }
00024 
00025     /**
00026      *  Returns the minimum sample size for use in creating buffers etc.
00027      */
00028     public abstract int getSampleSize ();
00029     
00030     /**
00031      *  Reads from the microphone, using the buffer provided,
00032      *  but <em>only</em> filling getSampSize() bytes.
00033      *  Returns the time-stamp of the sample from the audio clock.
00034      */
00035     public abstract long readWithTimestamp( byte[] buff ) throws IOException;
00036     
00037     /**
00038      *  Stops the recorder - but don't throw it away.
00039      */
00040     public abstract void stopRecording ();
00041     
00042     /**
00043      *  Starts the recorder (returning the time-stamp)
00044      */
00045     public abstract long startRecording ();
00046     
00047     /**
00048      *  Starts the player
00049      */
00050     public abstract void startPlay ();
00051     
00052     /**
00053      *  Stops the player
00054      */
00055     public abstract void stopPlay ();
00056 
00057     /**
00058      *  Starts ringing signal
00059      */
00060     public abstract void startRinging ();
00061     
00062     /**
00063      *  Stops ringing signal
00064      */
00065     public abstract void stopRinging();
00066     
00067     /**
00068      *  Plays the sample given (AudioInterface.getSampleSize() bytes) assuming 
00069      *  that it's timestamp is long
00070      */
00071     public abstract void writeBuffered( byte[] buff, long timestamp ) throws IOException;
00072     
00073     /**
00074      *  Writes directly to source line without buffering
00075      */
00076     public abstract void writeDirectly( byte[] buff ) throws IOException;
00077     
00078     /**
00079      *  Gets the VoicePDU subclass attribute of the AbstractAudio object
00080      */
00081     public abstract int getVoicePduSubclass();
00082     
00083     /**
00084      *  Sets the audioSender attribute of the AbstractAudio object
00085      */
00086     public abstract void setAudioSender( AudioInterface.Packetizer as );
00087     
00088     /**
00089      *  Cleans up resources used by the interface.
00090      */
00091     public abstract void cleanUp ();
00092     
00093     /**
00094      *  Creates new instance of the interface by choosing specified CODEC format
00095      */
00096     public abstract AudioInterface getByFormat( Integer format );
00097 }

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