Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
pulseaudio_sink.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roc Streaming authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_sndio/target_pulseaudio/roc_sndio/pulseaudio_sink.h
10 //! @brief PulseAudio sink.
11 
12 #ifndef ROC_SNDIO_PULSEAUDIO_SINK_H_
13 #define ROC_SNDIO_PULSEAUDIO_SINK_H_
14 
15 #include "roc_sndio/isink.h"
17 
18 namespace roc {
19 namespace sndio {
20 
21 //! PulseAudio sink,
22 class PulseaudioSink : public ISink, public PulseaudioDevice {
23 public:
24  //! Initialize.
25  PulseaudioSink(const Config& config);
26 
27  ~PulseaudioSink();
28 
29  //! Get device type.
30  virtual DeviceType type() const;
31 
32  //! Get device state.
33  virtual DeviceState state() const;
34 
35  //! Pause reading.
36  virtual void pause();
37 
38  //! Resume paused reading.
39  virtual bool resume();
40 
41  //! Restart reading from the beginning.
42  virtual bool restart();
43 
44  //! Get sample specification of the sink.
45  virtual audio::SampleSpec sample_spec() const;
46 
47  //! Get latency of the sink.
48  virtual core::nanoseconds_t latency() const;
49 
50  //! Check if the sink supports latency reports.
51  virtual bool has_latency() const;
52 
53  //! Check if the sink has own clock.
54  virtual bool has_clock() const;
55 
56  //! Write audio frame.
57  virtual void write(audio::Frame& frame);
58 };
59 
60 } // namespace sndio
61 } // namespace roc
62 
63 #endif // ROC_SNDIO_PULSEAUDIO_SINK_H_
Audio frame.
Definition: frame.h:25
Sample specification. Describes sample rate and channels.
Definition: sample_spec.h:26
Sink interface.
Definition: isink.h:22
PulseAudio device. Base class for PulseAudio source and sink.
virtual DeviceState state() const
Get device state.
virtual core::nanoseconds_t latency() const
Get latency of the sink.
virtual bool has_clock() const
Check if the sink has own clock.
PulseaudioSink(const Config &config)
Initialize.
virtual void pause()
Pause reading.
virtual bool has_latency() const
Check if the sink supports latency reports.
virtual void write(audio::Frame &frame)
Write audio frame.
virtual bool resume()
Resume paused reading.
virtual audio::SampleSpec sample_spec() const
Get sample specification of the sink.
virtual DeviceType type() const
Get device type.
virtual bool restart()
Restart reading from the beginning.
Sink interface.
int64_t nanoseconds_t
Nanoseconds.
Definition: time.h:58
DeviceType
Device type.
Definition: device_type.h:19
DeviceState
Device state.
Definition: device_state.h:19
Root namespace.
PulseAudio device.
Sink and source config.
Definition: config.h:29