libPocuter 1.0 Support library for programming the Pocuter

Public Types | Public Member Functions | List of all members
PocuterMicrophone Class Referenceabstract

options to access the Pocuter microphone More...

`#include <PocuterMicrophone.h>`

## Public Types
enum | MICERROR { MICERROR_OK, MICERROR_RESOURCE_NOT_AVAILABLE, MICERROR_UNKNOWN }
enum | MICEVENT { MIC_DATA_PACKAGE }
enum | NOICE_REDUCTION_LEVEL { REDUCTION_LEVEL_NONE, REDUCTION_LEVEL_SMALL, REDUCTION_LEVEL_MEDIUM, REDUCTION_LEVEL_HIGHT, REDUCTION_LEVEL_RAW }
enum | SAMLE_RATE_HZ { SAMLE_RATE_8000 = 8000, SAMLE_RATE_11025 = 11025, SAMLE_RATE_16000 = 16000, SAMLE_RATE_22050 = 22050, SAMLE_RATE_32000 = 32000, SAMLE_RATE_44100 = 44100, SAMLE_RATE_48000 = 48000 }
typedef void() | micEventHandler(MICEVENT, void *data, size_t dataSize, void *userData)

## Public Member Functions
virtual MICERROR | registerEventHandler (micEventHandler *h, void *u)=0
| register an event callback More...
virtual void | unregisterEventHandler ()=0
| unregister the event handler More...
virtual MICERROR | startRecording (SAMLE_RATE_HZ s, NOICE_REDUCTION_LEVEL n)=0
| start the recording More...
virtual MICERROR | stopRecording ()=0
| stop the recording More...

## Detailed Description

options to access the Pocuter microphone

## Member Typedef Documentation

## ◆ micEventHandler

typedef void() PocuterMicrophone::micEventHandler(MICEVENT, void *data, size_t dataSize, void *userData)

## Member Enumeration Documentation

## ◆ MICERROR

enum PocuterMicrophone::MICERROR

Enumerator
MICERROR_OK | everything went well
MICERROR_RESOURCE_NOT_AVAILABLE | the given recource in not available now
MICERROR_UNKNOWN | an unusual error

## ◆ MICEVENT

enum PocuterMicrophone::MICEVENT

Enumerator
MIC_DATA_PACKAGE | a data package is ready

## ◆ NOICE_REDUCTION_LEVEL

enum PocuterMicrophone::NOICE_REDUCTION_LEVEL

Enumerator
REDUCTION_LEVEL_NONE | No noice reduction
REDUCTION_LEVEL_SMALL | A little reduction
REDUCTION_LEVEL_MEDIUM | Medium reduction
REDUCTION_LEVEL_HIGHT | hight noice reduction
REDUCTION_LEVEL_RAW | send raw data only

## ◆ SAMLE_RATE_HZ

enum PocuterMicrophone::SAMLE_RATE_HZ

Enumerator
SAMLE_RATE_8000 | Sample Rate 8 khz
SAMLE_RATE_11025 | Sample Rate 11 khz
SAMLE_RATE_16000 | Sample Rate 16 khz
SAMLE_RATE_22050 | Sample Rate 22 khz
SAMLE_RATE_32000 | Sample Rate 32 khz
SAMLE_RATE_44100 | Sample Rate 44 khz
SAMLE_RATE_48000 | Sample Rate 48 khz

## Member Function Documentation

## ◆ registerEventHandler()

virtual MICERROR PocuterMicrophone::registerEventHandler | ( | micEventHandler * | h,
|  | void * | u
| ) |  |
| pure virtual

register an event callback

Note
  the event handler is called every time a new data package is ready. You can only have one event handler at a time.

Parameters

  h | a pointer to the callback function
  u | a pointer to user data sent to the event handler on each event

Returns
  - MICERROR_OK everything works well
  - MICERROR_RESOURCE_NOT_AVAILABLE can not add an event handler now

## ◆ startRecording()

virtual MICERROR PocuterMicrophone::startRecording | ( | SAMLE_RATE_HZ | s,
|  | NOICE_REDUCTION_LEVEL | n
| ) |  |
| pure virtual

start the recording

Note
  after starting the event handler will be calls periodically, when a data package is ready.

Parameters

  s | the sample rate
  n | the noice reduction level, or raw data

Returns
  - MICERROR_OK everything works well
  - MICERROR_RESOURCE_NOT_AVAILABLE cannot start recording

## ◆ stopRecording()

virtual MICERROR PocuterMicrophone::stopRecording | ( |  | ) |
| pure virtual

stop the recording

Note
  after stopping the event handler will not be called anymore

## ◆ unregisterEventHandler()

virtual void PocuterMicrophone::unregisterEventHandler | ( |  | ) |
| pure virtual

unregister the event handler

The documentation for this class was generated from the following file:

- include/hal/PocuterMicrophone.h