Ocean
Ocean::Media::Microphone Class Reference

This class is the base class for all microphones. More...

Inheritance diagram for Ocean::Media::Microphone:

Public Types

enum  MicrophoneTypes : uint32_t { MT_UNKNOWN = 0u , MT_BUILTIN = 1u << 0u , MT_EXTERNAL = 1u << 1u , MT_ANY = MT_BUILTIN | MT_EXTERNAL }
 Definition of individual microphone types. More...
 
enum  MicrophoneConfigurations : uint32_t { MC_DEFAULT = 0u , MC_VOICE_COMMUNICATION = 1u << 0u , MC_PERFORMANCE = 1u << 1u , MC_GAINED = 1u << 2u }
 Definition of individual microphone configurations. More...
 
enum  SamplesType : uint32_t { ST_INVALID = 0u , ST_INTEGER_16_MONO_48 }
 Definition of individual samples types. More...
 
using SamplesCallbackFunction = std::function< void(const SamplesType samplesType, const void *data, const size_t size)>
 Definition of a callback function for microphone samples. More...
 
using SamplesScopedSubscription = ScopedSubscriptionHandler::ScopedSubscriptionType
 Definition of a subscription object for microphone samples. More...
 
- Public Types inherited from Ocean::Media::Medium
enum  Type : uint32_t {
  MEDIUM = 0u , FRAME_MEDIUM = 1u << 0u , SOUND_MEDIUM = 1u << 1u , FINITE_MEDIUM = 1u << 2u ,
  LIVE_MEDIUM = 1u << 3u , CONFIG_MEDIUM = 1u << 4u , AUDIO = (1u << 5u) | FINITE_MEDIUM | SOUND_MEDIUM , IMAGE = (1u << 6u) | FRAME_MEDIUM ,
  PIXEL_IMAGE = (1u << 7u) | FRAME_MEDIUM , BUFFER_IMAGE = (1u << 8u) | FRAME_MEDIUM , IMAGE_SEQUENCE = (1u << 9u) | FRAME_MEDIUM | FINITE_MEDIUM , LIVE_AUDIO = (1u << 10u) | LIVE_MEDIUM | SOUND_MEDIUM ,
  LIVE_VIDEO = (1u << 11u) | LIVE_MEDIUM | FRAME_MEDIUM , MICROPHONE = (1u << 12u) | LIVE_MEDIUM , MOVIE = (1u << 13u) | FINITE_MEDIUM | FRAME_MEDIUM | SOUND_MEDIUM
}
 Definition of different medium types. More...
 
- Public Types inherited from Ocean::Media::ConfigMedium
typedef std::vector< std::string > ConfigNames
 Definition of a vector holding configuration names. More...
 

Public Member Functions

virtual MicrophoneTypes microphoneTypes () const
 Returns the type of this microphone. More...
 
virtual MicrophoneConfigurations microphoneConfigurations () const
 Returns the configuration of this microphone. More...
 
virtual SamplesScopedSubscription addSamplesCallback (SamplesCallbackFunction samplesCallbackFunction)
 Adds a new callback function for samples events. More...
 
- Public Member Functions inherited from Ocean::Media::Medium
const std::string & url () const
 Returns the url of the medium. More...
 
bool isValid () const
 Returns whether the medium is valid. More...
 
const std::string & library () const
 Returns the name of the owner library. More...
 
Type type () const
 Returns the type of the medium. More...
 
bool isType (const Type type) const
 Returns whether a medium has a given type. More...
 
virtual bool isStarted () const =0
 Returns whether the medium is started currently. More...
 
bool isExclusive () const
 Returns whether this medium can be use exclusively. More...
 
virtual bool start ()=0
 Starts the medium. More...
 
virtual bool pause ()=0
 Pauses the medium. More...
 
virtual bool stop ()=0
 Stops the medium. More...
 
virtual Timestamp startTimestamp () const =0
 Returns the start timestamp. More...
 
virtual Timestamp pauseTimestamp () const =0
 Returns the pause timestamp. More...
 
virtual Timestamp stopTimestamp () const =0
 Returns the stop timestamp. More...
 
virtual MediumRef clone () const
 Clones this medium and returns a new independent instance of this medium. More...
 
- Public Member Functions inherited from Ocean::Media::ConfigMedium
virtual bool configuration (const std::string &name, long long data)
 Starts a configuration possibility. More...
 
virtual ConfigNames configs () const
 Returns the names of the configuration possibilities. More...
 

Protected Types

using SamplesCallbackHandler = ScopedSubscriptionCallbackHandlerT< SamplesCallbackFunction, Microphone, true >
 Definition of a subscription handler for voip samples events. More...
 

Protected Member Functions

 Microphone (const std::string &url)
 Creates a new microphone by a given url. More...
 
void sendSamples (const SamplesType samplesType, const void *data, const size_t size)
 Sends samples to all subscribed callback functions. More...
 
- Protected Member Functions inherited from Ocean::Media::LiveMedium
 LiveMedium (const std::string &url)
 Creates a new live medium by a given url. More...
 
- Protected Member Functions inherited from Ocean::Media::Medium
 Medium (const Medium &medium)=delete
 Disabled copy constructor. More...
 
 Medium (const std::string &url)
 Creates a new medium by a given url. More...
 
virtual ~Medium ()
 Destructs a medium. More...
 
Mediumoperator= (const Medium &medium)=delete
 Disabled copy operator. More...
 
- Protected Member Functions inherited from Ocean::Media::ConfigMedium
 ConfigMedium (const std::string &url)
 Creates a new ConfigMedium object by a given url. More...
 

Protected Attributes

MicrophoneTypes microphoneTypes_ = MT_UNKNOWN
 The microphone's types. More...
 
MicrophoneConfigurations microphoneConfigurations_ = MC_DEFAULT
 The microphone's configurations. More...
 
SamplesCallbackHandler samplesCallbackHandler_
 The handler for samples callback functions. More...
 
- Protected Attributes inherited from Ocean::Media::Medium
std::string url_
 Url of the medium. More...
 
std::string libraryName_
 Name of the owner library. More...
 
bool isValid_ = false
 Determines whether the medium is valid. More...
 
Type type_ = MEDIUM
 Type of the medium. More...
 
Lock lock_
 Medium lock. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Ocean::Media::Medium
static std::string convertType (const Type type)
 Converts a medium type to a unique string. More...
 
static Type convertType (const std::string &type)
 Converts a medium type string to a medium type. More...
 

Detailed Description

This class is the base class for all microphones.

Member Typedef Documentation

◆ SamplesCallbackFunction

using Ocean::Media::Microphone::SamplesCallbackFunction = std::function<void(const SamplesType samplesType, const void* data, const size_t size)>

Definition of a callback function for microphone samples.

Parameters
samplesTypeThe type of the samples
dataThe samples data, must be valid
sizeThe size of the data, in bytes, with range [1, infinity)

◆ SamplesCallbackHandler

Definition of a subscription handler for voip samples events.

◆ SamplesScopedSubscription

Definition of a subscription object for microphone samples.

Member Enumeration Documentation

◆ MicrophoneConfigurations

Definition of individual microphone configurations.

Enumerator
MC_DEFAULT 

A default microphone configuration.

MC_VOICE_COMMUNICATION 

The microphone is configured for voice communication and can include features like an Acoustic Echo Canceler, may have some latency.

MC_PERFORMANCE 

The microphone is configured for performance with low latency.

MC_GAINED 

The microphone is gained.

◆ MicrophoneTypes

Definition of individual microphone types.

Enumerator
MT_UNKNOWN 

An unknown microphone type.

MT_BUILTIN 

A built-in microphone (e.g., in a mobile phone).

MT_EXTERNAL 

An external microphone (e.g., as part of headphones).

MT_ANY 

Any microphone either built-in or external.

◆ SamplesType

Definition of individual samples types.

Enumerator
ST_INVALID 

An invalid samples type.

ST_INTEGER_16_MONO_48 

Samples with 16bit signed integer precision as mono channel and 48kHz.

Constructor & Destructor Documentation

◆ Microphone()

Ocean::Media::Microphone::Microphone ( const std::string &  url)
explicitprotected

Creates a new microphone by a given url.

Parameters
urlUrl of the microphone

Member Function Documentation

◆ addSamplesCallback()

virtual SamplesScopedSubscription Ocean::Media::Microphone::addSamplesCallback ( SamplesCallbackFunction  samplesCallbackFunction)
virtual

Adds a new callback function for samples events.

Parameters
samplesCallbackFunctionThe callback function to add, must be valid
Returns
The subscription object, the callback function will exist as long as the subscription object exists

◆ microphoneConfigurations()

virtual MicrophoneConfigurations Ocean::Media::Microphone::microphoneConfigurations ( ) const
virtual

Returns the configuration of this microphone.

Returns
The microphone's configuration

◆ microphoneTypes()

virtual MicrophoneTypes Ocean::Media::Microphone::microphoneTypes ( ) const
virtual

Returns the type of this microphone.

Returns
The microphone's type

◆ sendSamples()

void Ocean::Media::Microphone::sendSamples ( const SamplesType  samplesType,
const void *  data,
const size_t  size 
)
inlineprotected

Sends samples to all subscribed callback functions.

Parameters
samplesTypeThe type of the samples
dataThe samples data, must be valid
sizeThe size of the data, in bytes, with range [1, infinity)

Field Documentation

◆ microphoneConfigurations_

MicrophoneConfigurations Ocean::Media::Microphone::microphoneConfigurations_ = MC_DEFAULT
protected

The microphone's configurations.

◆ microphoneTypes_

MicrophoneTypes Ocean::Media::Microphone::microphoneTypes_ = MT_UNKNOWN
protected

The microphone's types.

◆ samplesCallbackHandler_

SamplesCallbackHandler Ocean::Media::Microphone::samplesCallbackHandler_
protected

The handler for samples callback functions.


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