annotate src/portaudio_20140130/bindings/cpp/include/portaudiocpp/Stream.hxx @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents e3d5853d5918
children
rev   line source
cannam@124 1 #ifndef INCLUDED_PORTAUDIO_STREAM_HXX
cannam@124 2 #define INCLUDED_PORTAUDIO_STREAM_HXX
cannam@124 3
cannam@124 4 #include "portaudio.h"
cannam@124 5
cannam@124 6 // ---------------------------------------------------------------------------------------
cannam@124 7
cannam@124 8 // Forward declaration(s):
cannam@124 9 namespace portaudio
cannam@124 10 {
cannam@124 11 class StreamParameters;
cannam@124 12 }
cannam@124 13
cannam@124 14 // ---------------------------------------------------------------------------------------
cannam@124 15
cannam@124 16 // Declaration(s):
cannam@124 17 namespace portaudio
cannam@124 18 {
cannam@124 19
cannam@124 20
cannam@124 21 //////
cannam@124 22 /// @brief A Stream represents an active or inactive input and/or output data
cannam@124 23 /// stream in the System.
cannam@124 24 ///
cannam@124 25 /// Concrete Stream classes should ensure themselves being in a closed state at
cannam@124 26 /// destruction (i.e. by calling their own close() method in their deconstructor).
cannam@124 27 /// Following good C++ programming practices, care must be taken to ensure no
cannam@124 28 /// exceptions are thrown by the deconstructor of these classes. As a consequence,
cannam@124 29 /// clients need to explicitly call close() to ensure the stream closed successfully.
cannam@124 30 ///
cannam@124 31 /// The Stream object can be used to manipulate the Stream's state. Also, time-constant
cannam@124 32 /// and time-varying information about the Stream can be retreived.
cannam@124 33 //////
cannam@124 34 class Stream
cannam@124 35 {
cannam@124 36 public:
cannam@124 37 // Opening/closing:
cannam@124 38 virtual ~Stream();
cannam@124 39
cannam@124 40 virtual void close();
cannam@124 41 bool isOpen() const;
cannam@124 42
cannam@124 43 // Additional set up:
cannam@124 44 void setStreamFinishedCallback(PaStreamFinishedCallback *callback);
cannam@124 45
cannam@124 46 // State management:
cannam@124 47 void start();
cannam@124 48 void stop();
cannam@124 49 void abort();
cannam@124 50
cannam@124 51 bool isStopped() const;
cannam@124 52 bool isActive() const;
cannam@124 53
cannam@124 54 // Stream info (time-constant, but might become time-variant soon):
cannam@124 55 PaTime inputLatency() const;
cannam@124 56 PaTime outputLatency() const;
cannam@124 57 double sampleRate() const;
cannam@124 58
cannam@124 59 // Stream info (time-varying):
cannam@124 60 PaTime time() const;
cannam@124 61
cannam@124 62 // Accessors for PortAudio PaStream, useful for interfacing
cannam@124 63 // with PortAudio add-ons (such as PortMixer) for instance:
cannam@124 64 const PaStream *paStream() const;
cannam@124 65 PaStream *paStream();
cannam@124 66
cannam@124 67 protected:
cannam@124 68 Stream(); // abstract class
cannam@124 69
cannam@124 70 PaStream *stream_;
cannam@124 71
cannam@124 72 private:
cannam@124 73 Stream(const Stream &); // non-copyable
cannam@124 74 Stream &operator=(const Stream &); // non-copyable
cannam@124 75 };
cannam@124 76
cannam@124 77
cannam@124 78 } // namespace portaudio
cannam@124 79
cannam@124 80
cannam@124 81 #endif // INCLUDED_PORTAUDIO_STREAM_HXX
cannam@124 82