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