annotate src/portaudio_20140130/bindings/cpp/include/portaudiocpp/Stream.hxx @ 39:7ddb4fc30dac

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