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