audioTypes.h
Go to the documentation of this file.
1 
4 
8 #pragma once
9 
10 #include <string>
11 #include <list>
12 #include <boost/function.hpp>
13 #include "audioConfig.h"
14 
15 namespace dpyAudio
16 {
17 
21  enum PortType
22  {
23  NA_TYPE = 0,
24  INPUT = 1,
25  OUTPUT = 2
26  };
27 
32  {
33  PORT_ADDED = 0,
35  };
36 
41  {
44  };
45 
46 
51  {
54  };
55 
60  {
61  ENABLED = 0,
62  DISABLED = 1,
63  UPDATED = 2
64  };
65 
69  enum TaskType
70  {
71  PLAY = 0,
72  RECORD = 1
73  };
74 
79  struct Port
80  {
81  std::string client = "user";
82  std::string name = "";
84 
91  Port(std::string c = "user", std::string n = "", PortType t = dpyAudio::NA_TYPE) : client(c), name(n), type(t)
92  {
93  }
94 
99  inline std::string getPortFullName() const
100  {
101  return (client + ":" + name);
102  }
103 
110  friend bool operator==(const Port &lhs, const Port &rhs)
111  {
112  return ((lhs.client == rhs.client && lhs.name == rhs.name) ? true : false);
113  }
114 
120  bool operator<(const Port &rhs) const
121  {
122  // Client and name is enough
123  return client < rhs.client || (client == rhs.client && name < rhs.name);
124  }
125  };
126 
130  struct Connection
131  {
132  std::string id;
135  bool isActive;
136  int priority;
137  std::list<std::string> blockedBy;
140  };
141 
145  struct PortGpio
146  {
148  std::string gpio;
149  };
150 
151  typedef boost::function<void(const PortEventType &event, const Port &port)> PortEventFunction;
152 
153 
154 
155 }
GPIO sink is assigned.
Definition: audioTypes.h:42
Struct defining a port.
Definition: audioTypes.h:79
A connection is updated.
Definition: audioTypes.h:63
Port port
Port.
Definition: audioTypes.h:147
friend bool operator==(const Port &lhs, const Port &rhs)
Overload of == operator used for Port struct.
Definition: audioTypes.h:110
PortType
Enumeration defining the different kinds of ports.
Definition: audioTypes.h:21
const int DEF_CONNECTION_VOLUME
Default value for connection volume if not defined.
Definition: audioConfig.h:19
std::string id
Unique id used to identify a connection.
Definition: audioTypes.h:132
std::string client
Client name, "user" will be the default one for user-created ports.
Definition: audioTypes.h:81
Port originPort
Origin port (generally a input port)
Definition: audioTypes.h:133
A connection is added.
Definition: audioTypes.h:52
OUTPUT.
Definition: audioTypes.h:25
Port(std::string c="user", std::string n="", PortType t=dpyAudio::NA_TYPE)
Port constructor with parameters.
Definition: audioTypes.h:91
Port destinationPort
Destination port (generally a output port)
Definition: audioTypes.h:134
std::string getPortFullName() const
Used to obtain port full name , which will be used for different operations.
Definition: audioTypes.h:99
Deepsy Audio namespace that includes the different enums, structs or method signatures that should be...
std::string gpio
Gpio assigned.
Definition: audioTypes.h:148
TaskType
Enumeration defining the different type of audio tasks.
Definition: audioTypes.h:69
bool operator<(const Port &rhs) const
Overload < operator to use a Port object as a key in a std::map.
Definition: audioTypes.h:120
std::list< std::string > blockedBy
list of connections id&#39;s that block the current connection (orderer by priority)
Definition: audioTypes.h:137
A port is added.
Definition: audioTypes.h:33
GPIO sink is released.
Definition: audioTypes.h:43
A port is removed.
Definition: audioTypes.h:34
A connection is removed.
Definition: audioTypes.h:53
Struct defining a connection between two ports.
Definition: audioTypes.h:130
std::string name
Port identifier.
Definition: audioTypes.h:82
bool isActive
Specify if the connection is currently active.
Definition: audioTypes.h:135
A connection is enabled.
Definition: audioTypes.h:61
ConnectionListEventType
Definition: audioTypes.h:50
PLAY.
Definition: audioTypes.h:71
PortGpioEventType
Definition: audioTypes.h:40
NA_TYPE.
Definition: audioTypes.h:23
Struct defining an assignment between a port and a gpio.
Definition: audioTypes.h:145
int priority
priority for the connection higher is moire priority
Definition: audioTypes.h:136
boost::function< void(const PortEventType &event, const Port &port)> PortEventFunction
Port event handler function.
Definition: audioTypes.h:151
PortEventType
Definition: audioTypes.h:31
RECORD.
Definition: audioTypes.h:72
ConnectionStatusEventType
Definition: audioTypes.h:59
A connection is disabled.
Definition: audioTypes.h:62
const int DEF_CONNECTION_GAIN
Default value for connection gain if not defined.
Definition: audioConfig.h:23
PortType type
Port type.
Definition: audioTypes.h:83
INPUT.
Definition: audioTypes.h:24