Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
idevice.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022 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/idevice.h
10
//! @brief Device interface.
11
12
#ifndef ROC_SNDIO_IDEVICE_H_
13
#define ROC_SNDIO_IDEVICE_H_
14
15
#include "
roc_audio/sample_spec.h
"
16
#include "
roc_core/stddefs.h
"
17
#include "
roc_core/time.h
"
18
#include "
roc_sndio/device_state.h
"
19
#include "
roc_sndio/device_type.h
"
20
21
namespace
roc
{
22
namespace
sndio
{
23
24
class
ISink
;
25
class
ISource
;
26
27
//! Base interface for sinks and sources.
28
class
IDevice
{
29
public
:
30
virtual
~IDevice
();
31
32
//! Cast IDevice to ISink.
33
virtual
ISink
*
to_sink
() = 0;
34
35
//! Cast IDevice to ISink.
36
virtual
ISource
*
to_source
() = 0;
37
38
//! Get device type.
39
virtual
DeviceType
type
()
const
= 0;
40
41
//! Get device state.
42
virtual
DeviceState
state
()
const
= 0;
43
44
//! Pause device.
45
virtual
void
pause
() = 0;
46
47
//! Resume device after pause.
48
//! @returns
49
//! false if an error occurred.
50
virtual
bool
resume
() = 0;
51
52
//! Restart device.
53
//! @remarks
54
//! If device was paused, it's automatically resumed.
55
//! @returns
56
//! false if an error occurred.
57
virtual
bool
restart
() = 0;
58
59
//! Get sample specification of the device.
60
virtual
audio::SampleSpec
sample_spec
()
const
= 0;
61
62
//! Get latency of the device.
63
virtual
core::nanoseconds_t
latency
()
const
= 0;
64
65
//! Check if the device supports latency reports.
66
virtual
bool
has_latency
()
const
= 0;
67
68
//! Check if the device has own clock.
69
virtual
bool
has_clock
()
const
= 0;
70
};
71
72
}
// namespace sndio
73
}
// namespace roc
74
75
#endif
// ROC_SNDIO_IDEVICE_H_
roc::audio::SampleSpec
Sample specification. Describes sample rate and channels.
Definition
sample_spec.h:30
roc::sndio::IDevice
Base interface for sinks and sources.
Definition
idevice.h:28
roc::sndio::IDevice::sample_spec
virtual audio::SampleSpec sample_spec() const =0
Get sample specification of the device.
roc::sndio::IDevice::has_clock
virtual bool has_clock() const =0
Check if the device has own clock.
roc::sndio::IDevice::pause
virtual void pause()=0
Pause device.
roc::sndio::IDevice::restart
virtual bool restart()=0
Restart device.
roc::sndio::IDevice::latency
virtual core::nanoseconds_t latency() const =0
Get latency of the device.
roc::sndio::IDevice::state
virtual DeviceState state() const =0
Get device state.
roc::sndio::IDevice::type
virtual DeviceType type() const =0
Get device type.
roc::sndio::IDevice::to_source
virtual ISource * to_source()=0
Cast IDevice to ISink.
roc::sndio::IDevice::has_latency
virtual bool has_latency() const =0
Check if the device supports latency reports.
roc::sndio::IDevice::resume
virtual bool resume()=0
Resume device after pause.
roc::sndio::IDevice::to_sink
virtual ISink * to_sink()=0
Cast IDevice to ISink.
roc::sndio::ISink
Sink interface.
Definition
isink.h:22
roc::sndio::ISource
Source interface.
Definition
isource.h:23
device_state.h
Device state.
device_type.h
Device type.
roc::core::nanoseconds_t
int64_t nanoseconds_t
Nanoseconds.
Definition
time.h:58
roc::sndio
Sound I/O.
roc::sndio::DeviceType
DeviceType
Device type.
Definition
device_type.h:19
roc::sndio::DeviceState
DeviceState
Device state.
Definition
device_state.h:19
roc
Root namespace.
sample_spec.h
Sample specifications.
stddefs.h
Commonly used types and functions.
time.h
Time definitions.
roc_sndio
idevice.h
Generated by
1.17.0