1 #ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
2 #define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
3 
4 // ---------------------------------------------------------------------------------------
5 
6 #include <cstddef>
7 
8 #include "portaudio.h"
9 
10 #include "portaudiocpp/System.hxx"
11 #include "portaudiocpp/SampleDataFormat.hxx"
12 
13 // ---------------------------------------------------------------------------------------
14 
15 // Forward declaration(s):
16 namespace portaudio
17 {
18 	class Device;
19 }
20 
21 // ---------------------------------------------------------------------------------------
22 
23 // Declaration(s):
24 namespace portaudio
25 {
26 
27 	//////
28 	/// @brief All parameters for one direction (either in or out) of a Stream. Together with
29 	/// parameters common to both directions, two DirectionSpecificStreamParameters can make up
30 	/// a StreamParameters object which contains all parameters for a Stream.
31 	//////
32 	class DirectionSpecificStreamParameters
33 	{
34 	public:
35 		static DirectionSpecificStreamParameters null();
36 
37 		DirectionSpecificStreamParameters();
38 		DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format,
39 			bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo);
40 
41 		// Set up methods:
42 		void setDevice(const Device &device);
43 		void setNumChannels(int numChannels);
44 
45 		void setSampleFormat(SampleDataFormat format, bool interleaved = true);
46 		void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true);
47 
48 		void setSuggestedLatency(PaTime latency);
49 
50 		void setHostApiSpecificStreamInfo(void *streamInfo);
51 
52 		// Accessor methods:
53 		PaStreamParameters *paStreamParameters();
54 		const PaStreamParameters *paStreamParameters() const;
55 
56 		Device &device() const;
57 		int numChannels() const;
58 
59 		SampleDataFormat sampleFormat() const;
60 		bool isSampleFormatInterleaved() const;
61 		bool isSampleFormatHostApiSpecific() const;
62 		PaSampleFormat hostApiSpecificSampleFormat() const;
63 
64 		PaTime suggestedLatency() const;
65 
66 		void *hostApiSpecificStreamInfo() const;
67 
68 	private:
69 		PaStreamParameters paStreamParameters_;
70 	};
71 
72 
73 } // namespace portaudio
74 
75 // ---------------------------------------------------------------------------------------
76 
77 #endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
78