UtiLite  0.3.1
A lite utilities library
Public Member Functions | Protected Member Functions
UAudioCaptureMic Class Reference

#include <UAudioCaptureMic.h>

Inherits UAudioCapture.

List of all members.

Public Member Functions

 UAudioCaptureMic (int driver=0, int fs=44100, int frameLength=1024, int bytesPerSample=2, int channels=1)
 UAudioCaptureMic (const std::string &fileName, int maxFileSizeMb, int driver=0, int fs=44100, int frameLength=1024, int bytesPerSample=2, int channels=1)

Protected Member Functions

virtual void mainLoopBegin ()
virtual void mainLoop ()
virtual void mainLoopEnd ()

Detailed Description

This recorder gets frames from the microphone. It is configured with the driver number of the microphone and the frequency. You can retrieve the list of available drivers on the computer with the method getRecordDrivers(). It can be also created to record in a file while getting frames from the microphone stream. It records by default in wav but if the file name contains ".mp3", it will automatically encode when the process is finished. The recording is finished when the maximum size set is reached.


Example recording to a file and processing the frame:

    UAudioCapture* recorder = new UAudioCaptureMic("fileName.wav", 100);
    Frame frame;
    unsigned int frameId = 0;
    recorder->start();
    while(recorder->getNextFrame(frame, frameId))
    { 
      ...process the frame...
      ... break when a condition is reached...
    }
    recorder->stop();
      delete recorder;
See also:
UAudioRecorderMic::getRecordDrivers

Constructor & Destructor Documentation

UAudioCaptureMic::UAudioCaptureMic ( int  driver = 0,
int  fs = 44100,
int  frameLength = 1024,
int  bytesPerSample = 2,
int  channels = 1 
)

Record from mic.

UAudioCaptureMic::UAudioCaptureMic ( const std::string &  fileName,
int  maxFileSizeMb,
int  driver = 0,
int  fs = 44100,
int  frameLength = 1024,
int  bytesPerSample = 2,
int  channels = 1 
)

Record from mic while saving frames to a file.


Member Function Documentation

virtual void UAudioCaptureMic::mainLoop ( ) [protected, virtual]

Pure virtual method mainLoop(). The inner loop of the thread. This method is called repetitively until the thread is killed. Note that if kill() is called in mainLoopBegin(), mainLoop() is not called, terminating immediately the thread.

See also:
mainLoop()
kill()

Implements UThread.

virtual void UAudioCaptureMic::mainLoopBegin ( ) [protected, virtual]

Virtual method mainLoopBegin(). User can implement this function to add a behavior before the main loop is started. It is called once (before entering mainLoop()).

Reimplemented from UThread.

virtual void UAudioCaptureMic::mainLoopEnd ( ) [protected, virtual]

Virtual method mainLoopEnd(). User can implement this function to add a behavior after the thread is killed (after exiting the mainLoop(), work is still done in the thread before exiting).

Reimplemented from UAudioCapture.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Friends Defines