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