drumstick  1.1.3
subscription.h
Go to the documentation of this file.
1 /*
2  MIDI Sequencer C++ library
3  Copyright (C) 2006-2019, 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 2 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 
20 #ifndef DRUMSTICK_SUBSCRIPTION_H
21 #define DRUMSTICK_SUBSCRIPTION_H
22 
23 #include "drumstickcommon.h"
24 #include <QList>
25 
33 namespace drumstick {
34 
35 class MidiClient;
36 
42 class DRUMSTICK_EXPORT Subscriber
43 {
44  friend class PortInfo;
45 public:
46  Subscriber();
47  Subscriber(const Subscriber& other);
48  Subscriber(snd_seq_query_subscribe_t* other);
49  virtual ~Subscriber();
50  Subscriber* clone();
51  int getSizeOfInfo() const;
52 
53  int getClient();
54  int getPort();
55  const snd_seq_addr_t* getRoot();
56  snd_seq_query_subs_type_t getType();
57  int getIndex();
58  int getNumSubs();
59  const snd_seq_addr_t* getAddr();
60  int getQueue();
61  bool getExclusive();
62  bool getTimeUpdate();
63  bool getTimeReal();
64  void setClient(int client);
65  void setPort(int port);
66  void setRoot(snd_seq_addr_t* addr);
67  void setType(snd_seq_query_subs_type_t type);
68  void setIndex(int index);
69  Subscriber& operator=(const Subscriber& other);
70 
71 private:
72  snd_seq_query_subscribe_t* m_Info;
73 
74 };
75 
81 class DRUMSTICK_EXPORT Subscription
82 {
83 public:
84  Subscription();
85  Subscription(const Subscription& other);
86  Subscription(snd_seq_port_subscribe_t* other);
88  virtual ~Subscription();
89  Subscription* clone();
90  int getSizeOfInfo() const;
91 
92  void setSender(unsigned char client, unsigned char port);
93  void setDest(unsigned char client, unsigned char port);
94  void subscribe(MidiClient* seq);
95  void unsubscribe(MidiClient* seq);
96 
97  const snd_seq_addr_t* getSender();
98  const snd_seq_addr_t* getDest();
99  int getQueue();
100  bool getExclusive();
101  bool getTimeUpdate();
102  bool getTimeReal();
103  void setSender(const snd_seq_addr_t* addr);
104  void setDest(const snd_seq_addr_t* addr);
105  void setQueue(int queue);
106  void setExclusive(bool val);
107  void setTimeUpdate(bool val);
108  void setTimeReal(bool val);
109  Subscription& operator=(const Subscription& other);
110 
111 private:
112  snd_seq_port_subscribe_t* m_Info;
113 };
114 
118 typedef QList<Subscription> SubscriptionsList;
119 
123 typedef QList<Subscriber> SubscribersList;
124 
125 }
126 
129 #endif //DRUMSTICK_SUBSCRIPTION_H
drumstick::Subscriber
Subscriber container class.
Definition: subscription.h:42
drumstick::MidiClient
Client management.
Definition: alsaclient.h:197
drumstick::SubscriptionsList
QList< Subscription > SubscriptionsList
List of subscriptions.
Definition: subscription.h:118
drumstick::Subscription
Subscription management.
Definition: subscription.h:81
drumstick::PortInfo
Port information container.
Definition: alsaport.h:39
drumstick::SubscribersList
QList< Subscriber > SubscribersList
List of subscribers.
Definition: subscription.h:123
drumstickcommon.h