Chris@4
|
1 #ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
|
Chris@4
|
2 #define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
|
Chris@4
|
3
|
Chris@4
|
4 // ---------------------------------------------------------------------------------------
|
Chris@4
|
5
|
Chris@4
|
6 #include "portaudio.h"
|
Chris@4
|
7
|
Chris@4
|
8 #include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
|
Chris@4
|
9
|
Chris@4
|
10 // ---------------------------------------------------------------------------------------
|
Chris@4
|
11
|
Chris@4
|
12 // Declaration(s):
|
Chris@4
|
13 namespace portaudio
|
Chris@4
|
14 {
|
Chris@4
|
15
|
Chris@4
|
16 //////
|
Chris@4
|
17 /// @brief The entire set of parameters needed to configure and open
|
Chris@4
|
18 /// a Stream.
|
Chris@4
|
19 ///
|
Chris@4
|
20 /// It contains parameters of input, output and shared parameters.
|
Chris@4
|
21 /// Using the isSupported() method, the StreamParameters can be
|
Chris@4
|
22 /// checked if opening a Stream using this StreamParameters would
|
Chris@4
|
23 /// succeed or not. Accessors are provided to higher-level parameters
|
Chris@4
|
24 /// aswell as the lower-level parameters which are mainly intended for
|
Chris@4
|
25 /// internal use.
|
Chris@4
|
26 //////
|
Chris@4
|
27 class StreamParameters
|
Chris@4
|
28 {
|
Chris@4
|
29 public:
|
Chris@4
|
30 StreamParameters();
|
Chris@4
|
31 StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
|
Chris@4
|
32 const DirectionSpecificStreamParameters &outputParameters, double sampleRate,
|
Chris@4
|
33 unsigned long framesPerBuffer, PaStreamFlags flags);
|
Chris@4
|
34
|
Chris@4
|
35 // Set up for direction-specific:
|
Chris@4
|
36 void setInputParameters(const DirectionSpecificStreamParameters ¶meters);
|
Chris@4
|
37 void setOutputParameters(const DirectionSpecificStreamParameters ¶meters);
|
Chris@4
|
38
|
Chris@4
|
39 // Set up for common parameters:
|
Chris@4
|
40 void setSampleRate(double sampleRate);
|
Chris@4
|
41 void setFramesPerBuffer(unsigned long framesPerBuffer);
|
Chris@4
|
42 void setFlag(PaStreamFlags flag);
|
Chris@4
|
43 void unsetFlag(PaStreamFlags flag);
|
Chris@4
|
44 void clearFlags();
|
Chris@4
|
45
|
Chris@4
|
46 // Validation:
|
Chris@4
|
47 bool isSupported() const;
|
Chris@4
|
48
|
Chris@4
|
49 // Accessors (direction-specific):
|
Chris@4
|
50 DirectionSpecificStreamParameters &inputParameters();
|
Chris@4
|
51 const DirectionSpecificStreamParameters &inputParameters() const;
|
Chris@4
|
52 DirectionSpecificStreamParameters &outputParameters();
|
Chris@4
|
53 const DirectionSpecificStreamParameters &outputParameters() const;
|
Chris@4
|
54
|
Chris@4
|
55 // Accessors (common):
|
Chris@4
|
56 double sampleRate() const;
|
Chris@4
|
57 unsigned long framesPerBuffer() const;
|
Chris@4
|
58 PaStreamFlags flags() const;
|
Chris@4
|
59 bool isFlagSet(PaStreamFlags flag) const;
|
Chris@4
|
60
|
Chris@4
|
61 private:
|
Chris@4
|
62 // Half-duplex specific parameters:
|
Chris@4
|
63 DirectionSpecificStreamParameters inputParameters_;
|
Chris@4
|
64 DirectionSpecificStreamParameters outputParameters_;
|
Chris@4
|
65
|
Chris@4
|
66 // Common parameters:
|
Chris@4
|
67 double sampleRate_;
|
Chris@4
|
68 unsigned long framesPerBuffer_;
|
Chris@4
|
69 PaStreamFlags flags_;
|
Chris@4
|
70 };
|
Chris@4
|
71
|
Chris@4
|
72
|
Chris@4
|
73 } // namespace portaudio
|
Chris@4
|
74
|
Chris@4
|
75 // ---------------------------------------------------------------------------------------
|
Chris@4
|
76
|
Chris@4
|
77 #endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
|