Build 1.0_r1(from source)

android.speech.recognition
Class Microphone

java.lang.Object
  extended by android.speech.recognition.Microphone
All Implemented Interfaces:
AudioSource
Direct Known Subclasses:
MicrophoneImpl

public abstract class Microphone
extends Object
implements AudioSource

Records live audio.


Constructor Summary
Microphone()
           
 
Method Summary
abstract  AudioStream createAudio()
          Creates an audio source
static Microphone getInstance()
          Returns the microphone instance
abstract  void setCodec(Codec recordingCodec)
          Sets the recording codec.
abstract  void setListener(AudioSourceListener listener)
          Sets the microphone listener.
abstract  void start()
          Start recording audio.
abstract  void stop()
          Stops recording audio.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Microphone

public Microphone()
Method Detail

getInstance

public static Microphone getInstance()
Returns the microphone instance

Returns:
an instance of a Microphone class.

setCodec

public abstract void setCodec(Codec recordingCodec)
                       throws IllegalStateException,
                              IllegalArgumentException
Sets the recording codec. This must be called before start() is called.

Parameters:
recordingCodec - the codec in which the samples will be recorded.
Throws:
IllegalStateException - if Microphone is started
IllegalArgumentException - if codec is not supported

setListener

public abstract void setListener(AudioSourceListener listener)
                          throws IllegalStateException
Sets the microphone listener.

Parameters:
listener - the microphone listener.
Throws:
IllegalStateException - if Microphone is started

createAudio

public abstract AudioStream createAudio()
Creates an audio source

Specified by:
createAudio in interface AudioSource
Returns:
an AudioStream instance

start

public abstract void start()
                    throws IllegalStateException
Start recording audio.

Specified by:
start in interface AudioSource
Throws:
IllegalStateException - if Microphone is already started

stop

public abstract void stop()
Stops recording audio.

Specified by:
stop in interface AudioSource

Build 1.0_r1(from source)

Please submit a feedback, bug or feature