XT-Audio
Structs.hpp
Go to the documentation of this file.
1 #ifndef XT_API_STRUCTS_HPP
2 #define XT_API_STRUCTS_HPP
3 
6 #include <xt/api/Enums.hpp>
7 #include <xt/api/Callbacks.hpp>
8 
9 #include <string>
10 #include <cstdint>
13 namespace Xt {
14 
15 struct Buffer final
16 {
17  void const* input;
18  void* output;
19  double time;
20  uint64_t position;
21  int32_t frames;
22  bool timeValid;
23 };
24 
25 struct Latency final
26 {
27  double input;
28  double output;
29 };
30 
31 struct Version final
32 {
33  int32_t major;
34  int32_t minor;
35 };
36 
37 struct ServiceError final
38 {
40  std::string text;
41 };
42 
43 struct ErrorInfo final
44 {
45  uint32_t fault;
48 };
49 
50 struct BufferSize final
51 {
52  double min;
53  double max;
54  double current;
55 };
56 
57 struct Attributes final
58 {
59  int32_t size;
60  int32_t count;
61  bool isFloat;
62  bool isSigned;
63 };
64 
65 struct Mix final
66 {
67  int32_t rate;
69  Mix() = default;
70  Mix(int32_t rate, Sample sample):
71  rate(rate), sample(sample) {}
72 };
73 
74 struct Channels final
75 {
76  int32_t inputs;
77  uint64_t inMask;
78  int32_t outputs;
79  uint64_t outMask;
80  Channels() = default;
81  Channels(int32_t inputs, uint64_t inMask, int32_t outputs, uint64_t outMask):
82  inputs(inputs), inMask(inMask), outputs(outputs), outMask(outMask) {}
83 };
84 
85 struct Format final
86 {
89  Format() = default;
90  Format(Mix const& mix, Channels const& channels):
91  mix(mix), channels(channels) {}
92 };
93 
94 struct StreamParams final
95 {
100  StreamParams() = default;
101  StreamParams(bool interleaved, OnBuffer onBuffer, OnXRun onXRun, OnRunning onRunning):
102  interleaved(interleaved), onBuffer(onBuffer), onXRun(onXRun), onRunning(onRunning) {}
103 };
104 
105 struct DeviceStreamParams final
106 {
109  double bufferSize;
110  DeviceStreamParams() = default;
111  DeviceStreamParams(StreamParams const& stream, Format const& format, double bufferSize):
112  stream(stream), format(format), bufferSize(bufferSize) {}
113 };
114 
116 {
117  class Device* device;
119  double bufferSize;
120  AggregateDeviceParams() = default;
121  AggregateDeviceParams(class Device* device, Channels const& channels, double bufferSize):
122  device(device), channels(channels), bufferSize(bufferSize) {}
123 };
124 
126 {
129  int32_t count;
131  Device const* master;
132  AggregateStreamParams() = default;
133  AggregateStreamParams(StreamParams const& stream, AggregateDeviceParams* devices, int32_t count, Mix const& mix, Device const* master):
134  stream(stream), devices(devices), count(count), mix(mix), master(master) {}
135 };
136 
137 } // namespace Xt
138 #endif // XT_API_STRUCTS_HPP
ServiceError service
Definition: Structs.hpp:47
std::string text
Definition: Structs.hpp:40
Mix mix
Definition: Structs.hpp:130
Definition: Structs.hpp:125
Cause cause
Definition: Structs.hpp:39
Mix(int32_t rate, Sample sample)
Definition: Structs.hpp:70
Definition: Structs.hpp:31
double current
Definition: Structs.hpp:54
DeviceStreamParams()=default
AggregateStreamParams(StreamParams const &stream, AggregateDeviceParams *devices, int32_t count, Mix const &mix, Device const *master)
Definition: Structs.hpp:133
Cause
Definition: Enums.hpp:10
Mix()=default
Channels()=default
Mix mix
Definition: Structs.hpp:87
int32_t outputs
Definition: Structs.hpp:78
int32_t major
Definition: Structs.hpp:33
Definition: Structs.hpp:15
Definition: Structs.hpp:85
uint32_t(* OnBuffer)(class Stream const &stream, struct Buffer const &buffer, void *user)
Definition: Callbacks.hpp:17
bool timeValid
Definition: Structs.hpp:22
void const * input
Definition: Structs.hpp:17
class Device * device
Definition: Structs.hpp:117
System system
Definition: Structs.hpp:46
int32_t size
Definition: Structs.hpp:59
Definition: Structs.hpp:25
Definition: Structs.hpp:50
Channels channels
Definition: Structs.hpp:118
void(* OnXRun)(class Stream const &stream, int32_t index, void *user)
Definition: Callbacks.hpp:15
Format format
Definition: Structs.hpp:108
int32_t minor
Definition: Structs.hpp:34
StreamParams stream
Definition: Structs.hpp:127
Definition: Structs.hpp:57
Definition: Structs.hpp:105
void(* OnRunning)(class Stream const &stream, bool running, uint64_t error, void *user)
Definition: Callbacks.hpp:19
Format()=default
AggregateDeviceParams * devices
Definition: Structs.hpp:128
OnXRun onXRun
Definition: Structs.hpp:98
int32_t count
Definition: Structs.hpp:60
double bufferSize
Definition: Structs.hpp:119
int32_t inputs
Definition: Structs.hpp:76
double input
Definition: Structs.hpp:27
Definition: Structs.hpp:74
Channels(int32_t inputs, uint64_t inMask, int32_t outputs, uint64_t outMask)
Definition: Structs.hpp:81
int32_t frames
Definition: Structs.hpp:21
AggregateDeviceParams(class Device *device, Channels const &channels, double bufferSize)
Definition: Structs.hpp:121
bool isSigned
Definition: Structs.hpp:62
uint64_t position
Definition: Structs.hpp:20
Channels channels
Definition: Structs.hpp:88
OnBuffer onBuffer
Definition: Structs.hpp:97
int32_t rate
Definition: Structs.hpp:67
uint64_t outMask
Definition: Structs.hpp:79
int32_t count
Definition: Structs.hpp:129
Sample sample
Definition: Structs.hpp:68
bool isFloat
Definition: Structs.hpp:61
StreamParams(bool interleaved, OnBuffer onBuffer, OnXRun onXRun, OnRunning onRunning)
Definition: Structs.hpp:101
double time
Definition: Structs.hpp:19
StreamParams stream
Definition: Structs.hpp:107
Definition: Structs.hpp:43
bool interleaved
Definition: Structs.hpp:96
Definition: Structs.hpp:37
Device const * master
Definition: Structs.hpp:131
StreamParams()=default
void * output
Definition: Structs.hpp:18
double bufferSize
Definition: Structs.hpp:109
Format(Mix const &mix, Channels const &channels)
Definition: Structs.hpp:90
Definition: Callbacks.hpp:10
Sample
Definition: Enums.hpp:9
System
Definition: Enums.hpp:11
OnRunning onRunning
Definition: Structs.hpp:99
DeviceStreamParams(StreamParams const &stream, Format const &format, double bufferSize)
Definition: Structs.hpp:111
uint32_t fault
Definition: Structs.hpp:45
double max
Definition: Structs.hpp:53
Definition: Structs.hpp:115
Definition: XtDevice.hpp:20
double output
Definition: Structs.hpp:28
Definition: Structs.hpp:94
uint64_t inMask
Definition: Structs.hpp:77
double min
Definition: Structs.hpp:52
Definition: Structs.hpp:65