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