From 37c97e345d12f95dde44e1d1a4c2f2aadd4615bc Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 25 Aug 2022 14:54:53 -0500 Subject: add initial structure --- .../cpp/include/portaudiocpp/StreamParameters.hxx | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx (limited to 'portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx') diff --git a/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx b/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx new file mode 100644 index 0000000..c0ec9a9 --- /dev/null +++ b/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx @@ -0,0 +1,77 @@ +#ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX +#define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/DirectionSpecificStreamParameters.hxx" + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + ////// + /// @brief The entire set of parameters needed to configure and open + /// a Stream. + /// + /// It contains parameters of input, output and shared parameters. + /// Using the isSupported() method, the StreamParameters can be + /// checked if opening a Stream using this StreamParameters would + /// succeed or not. Accessors are provided to higher-level parameters + /// aswell as the lower-level parameters which are mainly intended for + /// internal use. + ////// + class StreamParameters + { + public: + StreamParameters(); + StreamParameters(const DirectionSpecificStreamParameters &inputParameters, + const DirectionSpecificStreamParameters &outputParameters, double sampleRate, + unsigned long framesPerBuffer, PaStreamFlags flags); + + // Set up for direction-specific: + void setInputParameters(const DirectionSpecificStreamParameters ¶meters); + void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); + + // Set up for common parameters: + void setSampleRate(double sampleRate); + void setFramesPerBuffer(unsigned long framesPerBuffer); + void setFlag(PaStreamFlags flag); + void unsetFlag(PaStreamFlags flag); + void clearFlags(); + + // Validation: + bool isSupported() const; + + // Accessors (direction-specific): + DirectionSpecificStreamParameters &inputParameters(); + const DirectionSpecificStreamParameters &inputParameters() const; + DirectionSpecificStreamParameters &outputParameters(); + const DirectionSpecificStreamParameters &outputParameters() const; + + // Accessors (common): + double sampleRate() const; + unsigned long framesPerBuffer() const; + PaStreamFlags flags() const; + bool isFlagSet(PaStreamFlags flag) const; + + private: + // Half-duplex specific parameters: + DirectionSpecificStreamParameters inputParameters_; + DirectionSpecificStreamParameters outputParameters_; + + // Common parameters: + double sampleRate_; + unsigned long framesPerBuffer_; + PaStreamFlags flags_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX -- cgit v1.2.1