gramods
Public Member Functions | Static Public Member Functions | List of all members
gramods::gmSound::Capture Class Referenceabstract

The interface for a capture device that allow for extraction of sample data. More...

#include <Capture.hh>

Inheritance diagram for gramods::gmSound::Capture:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmSound::Capture:
Collaboration graph
[legend]

Public Member Functions

virtual size_t getSampleRate ()=0
 Returns the sample rate. More...
 
virtual size_t getChannelCount ()=0
 Sets the number of channels to attempt to open for the capture device. More...
 
virtual bool isOpen ()=0
 
virtual void startCapture ()=0
 
virtual void stopCapture ()=0
 
virtual size_t getAvailableSamplesCount ()=0
 
virtual std::vector< float > getAvailableSamples ()=0
 
std::string getDefaultKey () override
 Returns the default key for the Object when automatically instantiated in a Configuration, i.e. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void initialize ()
 Called to initialize the Object. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 

Static Public Member Functions

template<size_t N>
static std::array< std::vector< float >, N > deinterlaceSamples (std::vector< float > data)
 De-interlaces the input sample data into an array of N vectors each with an Nth of the original samples. More...
 
static std::vector< std::vector< float > > deinterlaceSamples (std::vector< float > data, size_t N)
 De-interlaces the input sample data into an array of N vectors each with an Nth of the original samples. More...
 

Detailed Description

The interface for a capture device that allow for extraction of sample data.

Member Function Documentation

◆ deinterlaceSamples() [1/2]

template<size_t N>
std::array< std::vector< float >, N > gramods::gmSound::Capture::deinterlaceSamples ( std::vector< float >  data)
static

De-interlaces the input sample data into an array of N vectors each with an Nth of the original samples.

◆ deinterlaceSamples() [2/2]

std::vector< std::vector< float > > gramods::gmSound::Capture::deinterlaceSamples ( std::vector< float >  data,
size_t  N 
)
static

De-interlaces the input sample data into an array of N vectors each with an Nth of the original samples.

◆ getChannelCount()

virtual size_t gramods::gmSound::Capture::getChannelCount ( )
pure virtual

Sets the number of channels to attempt to open for the capture device.

Implemented in gramods::gmSound::OpenALCapture, and gramods::gmSound::CaptureFromWav.

◆ getDefaultKey()

std::string gramods::gmSound::Capture::getDefaultKey ( )
inlineoverridevirtual

Returns the default key for the Object when automatically instantiated in a Configuration, i.e.

where it ends up in a parent Object. Default is "object", but this should be overriden by sub classes and can also be overridden in XML by using the attribute KEY, as in KEY="view".

The key can also be used to extract a specific object from a Configuration instance:

gmCore::Configuration config(argc, argv);
std::shared_ptr<MyClass> my_object;
if (! config.getObjectByKey("view", my_object)) {
GM_ERR("MyCode", "Cannot run without MyClass instance");
exit(-1);
}

Reimplemented from gramods::gmCore::Object.

◆ getSampleRate()

virtual size_t gramods::gmSound::Capture::getSampleRate ( )
pure virtual

Returns the sample rate.

Implemented in gramods::gmSound::OpenALCapture, and gramods::gmSound::CaptureFromWav.


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