annotate src/portaudio_20161030/bindings/cpp/include/portaudiocpp/Stream.hxx @ 56:af97cad61ff0

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