drumstick 1.1.3
alsaqueue.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#ifndef DRUMSTICK_ALSAQUEUE_H
20#define DRUMSTICK_ALSAQUEUE_H
21
22#include "drumstickcommon.h"
30namespace drumstick {
31
36#define SKEW_BASE 0x10000
37
38class MidiClient;
39class TimerId;
40
46class DRUMSTICK_EXPORT QueueInfo
47{
48 friend class MidiQueue;
49
50public:
51 QueueInfo();
52 QueueInfo(const QueueInfo& other);
53 QueueInfo(snd_seq_queue_info_t* other);
54 virtual ~QueueInfo();
55 QueueInfo* clone();
56 QueueInfo& operator=(const QueueInfo& other);
57 int getInfoSize() const;
58
59 int getId();
60 QString getName();
61 int getOwner();
62 bool isLocked();
63 unsigned int getFlags();
64
65 void setName(QString value);
66 void setOwner(int value);
67 void setLocked(bool locked);
68 void setFlags(unsigned int value);
69
70private:
71 snd_seq_queue_info_t* m_Info;
72};
73
79class DRUMSTICK_EXPORT QueueStatus
80{
81 friend class MidiQueue;
82
83public:
85 QueueStatus(const QueueStatus& other);
86 QueueStatus(snd_seq_queue_status_t* other);
87 virtual ~QueueStatus();
88 QueueStatus* clone();
89 QueueStatus& operator=(const QueueStatus& other);
90 int getInfoSize() const;
91
92 int getId();
93 int getEvents();
94 const snd_seq_real_time_t* getRealtime();
95 unsigned int getStatusBits();
96 bool isRunning();
97 double getClockTime();
98 snd_seq_tick_time_t getTickTime();
99
100private:
101 snd_seq_queue_status_t* m_Info;
102};
103
116class DRUMSTICK_EXPORT QueueTempo
117{
118 friend class MidiQueue;
119
120public:
121 QueueTempo();
122 QueueTempo(const QueueTempo& other);
123 QueueTempo(snd_seq_queue_tempo_t* other);
124 virtual ~QueueTempo();
125 QueueTempo* clone();
126 QueueTempo& operator=(const QueueTempo& other);
127 int getInfoSize() const;
128
129 int getId();
130 int getPPQ();
131 unsigned int getSkewValue();
132 unsigned int getSkewBase();
133 unsigned int getTempo();
134 void setPPQ(int value);
135 void setSkewValue(unsigned int value);
136 void setTempo(unsigned int value);
137
138 float getNominalBPM();
139 float getRealBPM();
140 void setTempoFactor(float value);
141 void setNominalBPM(float value);
142
143protected:
144 void setSkewBase(unsigned int value);
145
146private:
147 snd_seq_queue_tempo_t* m_Info;
148};
149
156class DRUMSTICK_EXPORT QueueTimer
157{
158 friend class MidiQueue;
159
160public:
161 QueueTimer();
162 QueueTimer(const QueueTimer& other);
163 QueueTimer(snd_seq_queue_timer_t* other);
164 virtual ~QueueTimer();
165 QueueTimer* clone();
166 QueueTimer& operator=(const QueueTimer& other);
167 int getInfoSize() const;
168
169 int getQueueId();
170 snd_seq_queue_timer_type_t getType();
171 const snd_timer_id_t* getId();
172 unsigned int getResolution();
173 void setType(snd_seq_queue_timer_type_t value);
174 void setId(snd_timer_id_t* value);
175 void setId(const TimerId& id);
176 void setResolution(unsigned int value);
177
178private:
179 snd_seq_queue_timer_t* m_Info;
180};
181
187class DRUMSTICK_EXPORT MidiQueue : public QObject
188{
189 Q_OBJECT
190public:
191 explicit MidiQueue(MidiClient* seq, QObject* parent = 0);
192 MidiQueue(MidiClient* seq, const QueueInfo& info, QObject* parent = 0);
193 MidiQueue(MidiClient* seq, const QString name, QObject* parent = 0);
194 MidiQueue(MidiClient* seq, const int queue_id, QObject* parent = 0);
195 virtual ~MidiQueue();
196
197 int getId() const { return m_Id; }
198 void start();
199 void stop();
200 void continueRunning();
201 void clear();
202 void setTickPosition(snd_seq_tick_time_t pos);
203 void setRealTimePosition(snd_seq_real_time_t* pos);
204 QueueInfo& getInfo();
205 QueueStatus& getStatus();
206 QueueTempo& getTempo();
207 QueueTimer& getTimer();
208 int getUsage();
209 void setInfo(const QueueInfo& value);
210 void setTempo(const QueueTempo& value);
211 void setTimer(const QueueTimer& value);
212 void setUsage(int used);
213
214private:
215 bool m_allocated;
216 int m_Id;
217 MidiClient* m_MidiClient;
218 QueueInfo m_Info;
219 QueueTempo m_Tempo;
220 QueueTimer m_Timer;
221 QueueStatus m_Status;
222};
223
224} /* namespace drumstick */
225
228#endif //DRUMSTICK_ALSAQUEUE_H
The QObject class is the base class of all Qt objects.
Client management.
Definition alsaclient.h:198
Queue management.
Definition alsaqueue.h:188
Queue information container.
Definition alsaqueue.h:47
Queue status container.
Definition alsaqueue.h:80
Queue tempo container.
Definition alsaqueue.h:117
Queue timer container.
Definition alsaqueue.h:157
ALSA Timer identifier container.
Definition alsatimer.h:79
Common functionality.