drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
subscription.h
Go to the documentation of this file.
1/*
2 MIDI Sequencer C++ library
3 Copyright (C) 2006-2023, 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
22extern "C" {
23 #include <alsa/asoundlib.h>
24}
25
26#include <QList>
27#include "macros.h"
28
29namespace drumstick { namespace ALSA {
30
36#if defined(DRUMSTICK_STATIC)
37#define DRUMSTICK_ALSA_EXPORT
38#else
39#if defined(drumstick_alsa_EXPORTS)
40#define DRUMSTICK_ALSA_EXPORT Q_DECL_EXPORT
41#else
42#define DRUMSTICK_ALSA_EXPORT Q_DECL_IMPORT
43#endif
44#endif
45
46class MidiClient;
47
57class DRUMSTICK_ALSA_EXPORT Subscriber
58{
59 friend class PortInfo;
60public:
61 Subscriber();
62 Subscriber(const Subscriber& other);
63 explicit Subscriber(snd_seq_query_subscribe_t* other);
64 virtual ~Subscriber();
65 Subscriber* clone();
66 int getSizeOfInfo() const;
67
68 int getClient();
69 int getPort();
70 const snd_seq_addr_t* getRoot();
71 snd_seq_query_subs_type_t getType();
72 int getIndex();
73 int getNumSubs();
74 const snd_seq_addr_t* getAddr();
75 int getQueue();
76 bool getExclusive();
77 bool getTimeUpdate();
78 bool getTimeReal();
79 void setClient(int client);
80 void setPort(int port);
81 void setRoot(snd_seq_addr_t* addr);
82 void setType(snd_seq_query_subs_type_t type);
83 void setIndex(int index);
84 Subscriber& operator=(const Subscriber& other);
85
86private:
87 snd_seq_query_subscribe_t* m_Info;
88
89};
90
96class DRUMSTICK_ALSA_EXPORT Subscription
97{
98public:
100 Subscription(const Subscription& other);
101 explicit Subscription(snd_seq_port_subscribe_t* other);
102 explicit Subscription(MidiClient* seq);
103 virtual ~Subscription();
104 Subscription* clone();
105 int getSizeOfInfo() const;
106
107 void setSender(unsigned char client, unsigned char port);
108 void setDest(unsigned char client, unsigned char port);
109 void subscribe(MidiClient* seq);
110 void unsubscribe(MidiClient* seq);
111
112 const snd_seq_addr_t* getSender();
113 const snd_seq_addr_t* getDest();
114 int getQueue();
115 bool getExclusive();
116 bool getTimeUpdate();
117 bool getTimeReal();
118 void setSender(const snd_seq_addr_t* addr);
119 void setDest(const snd_seq_addr_t* addr);
120 void setQueue(int queue);
121 void setExclusive(bool val);
122 void setTimeUpdate(bool val);
123 void setTimeReal(bool val);
124 Subscription& operator=(const Subscription& other);
125
126private:
127 snd_seq_port_subscribe_t* m_Info;
128};
129
133typedef QList<Subscription> SubscriptionsList;
134
138typedef QList<Subscriber> SubscribersList;
139
142}} /* namespace drumstick::ALSA */
143
144#endif //DRUMSTICK_SUBSCRIPTION_H
Client management.
Definition: alsaclient.h:219
Port information container.
Definition: alsaport.h:52
Subscriber container class.
Definition: subscription.h:58
Subscription management.
Definition: subscription.h:97
QList< Subscription > SubscriptionsList
List of subscriptions.
Definition: subscription.h:133
QList< Subscriber > SubscribersList
List of subscribers.
Definition: subscription.h:138
Drumstick common.
Definition: alsaclient.cpp:68