gramods
Loading...
Searching...
No Matches
Capture.hh
1
2#ifndef GRAMODS_SOUND_CAPTURE
3#define GRAMODS_SOUND_CAPTURE
4
5#include <gmSound/config.hh>
6
7#include <gmCore/OFactory.hh>
8
9namespace gramods {
10namespace gmSound {
11
16class Capture : public gmCore::Object {
17
18public:
19
23 virtual size_t getSampleRate() = 0;
24
29 virtual size_t getChannelCount() = 0;
30
31 virtual bool isOpen() = 0;
32
33 virtual void startCapture() = 0;
34 virtual void stopCapture() = 0;
35 virtual size_t getAvailableSamplesCount() = 0;
36 virtual std::vector<float> getAvailableSamples() = 0;
37
38 std::string getDefaultKey() override { return "capture"; }
39
44 template<size_t N>
45 static std::array<std::vector<float>, N>
46 deinterlaceSamples(std::vector<float> data);
47
52 static std::vector<std::vector<float>>
53 deinterlaceSamples(std::vector<float> data, size_t N);
54};
55}}
56
57#endif
Base type for objects in the Gramods package for standardized handling of construction,...
Definition Object.hh:42
The interface for a capture device that allow for extraction of sample data.
Definition Capture.hh:16
virtual size_t getChannelCount()=0
Sets the number of channels to attempt to open for the capture device.
virtual size_t getSampleRate()=0
Returns the sample rate.
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 sampl...
Definition Capture.cpp:17
std::string getDefaultKey() override
Returns the default key for the Object when automatically instantiated in a Configuration,...
Definition Capture.hh:38
Gramods, short for Graphics Modules, is a collection of weakly inter dependent and useful APIs for Vi...
Definition config.hh:25