cannam@140: #ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX cannam@140: #define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX cannam@140: cannam@140: // --------------------------------------------------------------------------------------- cannam@140: cannam@140: #include "portaudio.h" cannam@140: cannam@140: #include "portaudiocpp/DirectionSpecificStreamParameters.hxx" cannam@140: cannam@140: // --------------------------------------------------------------------------------------- cannam@140: cannam@140: // Declaration(s): cannam@140: namespace portaudio cannam@140: { cannam@140: cannam@140: ////// cannam@140: /// @brief The entire set of parameters needed to configure and open cannam@140: /// a Stream. cannam@140: /// cannam@140: /// It contains parameters of input, output and shared parameters. cannam@140: /// Using the isSupported() method, the StreamParameters can be cannam@140: /// checked if opening a Stream using this StreamParameters would cannam@140: /// succeed or not. Accessors are provided to higher-level parameters cannam@140: /// aswell as the lower-level parameters which are mainly intended for cannam@140: /// internal use. cannam@140: ////// cannam@140: class StreamParameters cannam@140: { cannam@140: public: cannam@140: StreamParameters(); cannam@140: StreamParameters(const DirectionSpecificStreamParameters &inputParameters, cannam@140: const DirectionSpecificStreamParameters &outputParameters, double sampleRate, cannam@140: unsigned long framesPerBuffer, PaStreamFlags flags); cannam@140: cannam@140: // Set up for direction-specific: cannam@140: void setInputParameters(const DirectionSpecificStreamParameters ¶meters); cannam@140: void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); cannam@140: cannam@140: // Set up for common parameters: cannam@140: void setSampleRate(double sampleRate); cannam@140: void setFramesPerBuffer(unsigned long framesPerBuffer); cannam@140: void setFlag(PaStreamFlags flag); cannam@140: void unsetFlag(PaStreamFlags flag); cannam@140: void clearFlags(); cannam@140: cannam@140: // Validation: cannam@140: bool isSupported() const; cannam@140: cannam@140: // Accessors (direction-specific): cannam@140: DirectionSpecificStreamParameters &inputParameters(); cannam@140: const DirectionSpecificStreamParameters &inputParameters() const; cannam@140: DirectionSpecificStreamParameters &outputParameters(); cannam@140: const DirectionSpecificStreamParameters &outputParameters() const; cannam@140: cannam@140: // Accessors (common): cannam@140: double sampleRate() const; cannam@140: unsigned long framesPerBuffer() const; cannam@140: PaStreamFlags flags() const; cannam@140: bool isFlagSet(PaStreamFlags flag) const; cannam@140: cannam@140: private: cannam@140: // Half-duplex specific parameters: cannam@140: DirectionSpecificStreamParameters inputParameters_; cannam@140: DirectionSpecificStreamParameters outputParameters_; cannam@140: cannam@140: // Common parameters: cannam@140: double sampleRate_; cannam@140: unsigned long framesPerBuffer_; cannam@140: PaStreamFlags flags_; cannam@140: }; cannam@140: cannam@140: cannam@140: } // namespace portaudio cannam@140: cannam@140: // --------------------------------------------------------------------------------------- cannam@140: cannam@140: #endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX