org.alchemy.core
Class AlcMicrophone

java.lang.Object
  extended by org.alchemy.core.AlcMicrophone

public class AlcMicrophone
extends java.lang.Object

Base class used for microphone input
With very limited functionality at the moment to return a buffer or the current sound level
Based on code by Richard G. Baldwin from: http://www.developer.com/java/other/print.php/1572251


Constructor Summary
AlcMicrophone(AlcMicInterface parent)
           
AlcMicrophone(AlcMicInterface parent, int bufferSize)
          Creates a new instance of AlcMicrophone
AlcMicrophone(int bufferSize)
          Creates a new instance of AlcMicrophone
 
Method Summary
 void closeLine()
          Close the mic line The line can be opened again by calling setBufer() or openLine() directly
 byte[] getBuffer()
          Get the raw buffer
 double getMicLevel()
          Get the current Microphone Level Based on an average value of the buffer
 int[] getSamples()
          Get the Samples
 void openLine()
          Open the mic line
 void setBuffer(int bufferSize)
          Set the buffer to a certain size
 void start()
          Starts Microphone Input
 void stop()
          Stops Microphone Input
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlcMicrophone

public AlcMicrophone(int bufferSize)
Creates a new instance of AlcMicrophone

Parameters:
bufferSize - Size of the audio buffer - affects latency

AlcMicrophone

public AlcMicrophone(AlcMicInterface parent,
                     int bufferSize)
Creates a new instance of AlcMicrophone

Parameters:
parent - Reference to the parent class implementing the AlcMicInterface
bufferSize - Size of the required buffer

AlcMicrophone

public AlcMicrophone(AlcMicInterface parent)
Method Detail

setBuffer

public void setBuffer(int bufferSize)
Set the buffer to a certain size

Parameters:
bufferSize - Size for the buffer

openLine

public void openLine()
Open the mic line


closeLine

public void closeLine()
Close the mic line The line can be opened again by calling setBufer() or openLine() directly


start

public void start()
Starts Microphone Input


stop

public void stop()
Stops Microphone Input


getMicLevel

public double getMicLevel()
Get the current Microphone Level Based on an average value of the buffer

Returns:
Current Microphone Level

getBuffer

public byte[] getBuffer()
Get the raw buffer


getSamples

public int[] getSamples()
Get the Samples