drumstick  2.7.2
subscription.h
Go to the documentation of this file.
1 /*
2  MIDI Sequencer C++ library
3  Copyright (C) 2006-2022, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef DRUMSTICK_SUBSCRIPTION_H
20 #define DRUMSTICK_SUBSCRIPTION_H
21 
22 extern "C" {
23  #include <alsa/asoundlib.h>
24 }
25 
26 #include <QList>
27 #include "macros.h"
28 
29 namespace drumstick { namespace ALSA {
30 
36 class MidiClient;
37 
47 class DRUMSTICK_EXPORT Subscriber
48 {
49  friend class PortInfo;
50 public:
51  Subscriber();
52  Subscriber(const Subscriber& other);
53  explicit Subscriber(snd_seq_query_subscribe_t* other);
54  virtual ~Subscriber();
55  Subscriber* clone();
56  int getSizeOfInfo() const;
57 
58  int getClient();
59  int getPort();
60  const snd_seq_addr_t* getRoot();
61  snd_seq_query_subs_type_t getType();
62  int getIndex();
63  int getNumSubs();
64  const snd_seq_addr_t* getAddr();
65  int getQueue();
66  bool getExclusive();
67  bool getTimeUpdate();
68  bool getTimeReal();
69  void setClient(int client);
70  void setPort(int port);
71  void setRoot(snd_seq_addr_t* addr);
72  void setType(snd_seq_query_subs_type_t type);
73  void setIndex(int index);
74  Subscriber& operator=(const Subscriber& other);
75 
76 private:
77  snd_seq_query_subscribe_t* m_Info;
78 
79 };
80 
86 class DRUMSTICK_EXPORT Subscription
87 {
88 public:
89  Subscription();
90  Subscription(const Subscription& other);
91  explicit Subscription(snd_seq_port_subscribe_t* other);
92  explicit Subscription(MidiClient* seq);
93  virtual ~Subscription();
94  Subscription* clone();
95  int getSizeOfInfo() const;
96 
97  void setSender(unsigned char client, unsigned char port);
98  void setDest(unsigned char client, unsigned char port);
99  void subscribe(MidiClient* seq);
100  void unsubscribe(MidiClient* seq);
101 
102  const snd_seq_addr_t* getSender();
103  const snd_seq_addr_t* getDest();
104  int getQueue();
105  bool getExclusive();
106  bool getTimeUpdate();
107  bool getTimeReal();
108  void setSender(const snd_seq_addr_t* addr);
109  void setDest(const snd_seq_addr_t* addr);
110  void setQueue(int queue);
111  void setExclusive(bool val);
112  void setTimeUpdate(bool val);
113  void setTimeReal(bool val);
114  Subscription& operator=(const Subscription& other);
115 
116 private:
117  snd_seq_port_subscribe_t* m_Info;
118 };
119 
123 typedef QList<Subscription> SubscriptionsList;
124 
128 typedef QList<Subscriber> SubscribersList;
129 
132 }} /* namespace drumstick::ALSA */
133 
134 #endif //DRUMSTICK_SUBSCRIPTION_H
Subscription management.
Definition: subscription.h:86
Subscriber container class.
Definition: subscription.h:47
Drumstick visibility macros.
Drumstick common.
Definition: alsaclient.cpp:68
Port information container.
Definition: alsaport.h:41
QList< Subscription > SubscriptionsList
List of subscriptions.
Definition: subscription.h:123
QList< Subscriber > SubscribersList
List of subscribers.
Definition: subscription.h:128
Client management.
Definition: alsaclient.h:208