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