19 #ifndef DRUMSTICK_ALSATIMER_H 20 #define DRUMSTICK_ALSATIMER_H 25 #include <QReadWriteLock> 39 class TimerGlobalInfo;
57 int getSizeOfInfo()
const;
67 long getTicks() __attribute__((deprecated));
70 snd_timer_info_t *m_Info;
87 TimerId(
const snd_timer_id_t *other);
88 TimerId(
int cls,
int scls,
int card,
int dev,
int sdev);
92 int getSizeOfInfo()
const;
94 void setClass(
int devclass);
96 void setSlaveClass(
int devsclass);
98 void setCard(
int card);
100 void setDevice(
int device);
102 void setSubdevice(
int subdevice);
106 snd_timer_id_t *m_Info;
130 int getSizeOfInfo()
const;
132 void setTimerId(
const TimerId& tid);
134 unsigned int getFlags();
138 unsigned long getResolution();
139 unsigned long getMinResolution();
140 unsigned long getMaxResolution();
141 unsigned int getClients();
144 snd_timer_ginfo_t* m_Info;
156 TimerQuery(
const QString& deviceName,
int openMode);
157 TimerQuery(
const QString& deviceName,
int openMode, snd_config_t* conf);
165 void setGlobalParams(snd_timer_gparams_t* params);
166 void getGlobalParams(snd_timer_gparams_t* params);
167 void getGlobalStatus(snd_timer_gstatus_t* status);
174 snd_timer_query_t *m_Info;
175 TimerIdList m_timers;
195 int getSizeOfInfo()
const;
197 void setAutoStart(
bool auto_start);
199 void setExclusive(
bool exclusive);
201 void setEarlyEvent(
bool early_event);
202 bool getEarlyEvent();
203 void setTicks(
long ticks);
205 void setQueueSize(
long queue_size);
207 void setFilter(
unsigned int filter);
208 unsigned int getFilter();
211 snd_timer_params_t* m_Info;
230 int getSizeOfInfo()
const;
232 snd_htimestamp_t getTimestamp();
233 long getResolution();
239 snd_timer_status_t* m_Info;
258 virtual void handleTimerEvent(
int ticks,
int msecs) = 0;
274 class TimerInputThread :
public QThread 278 TimerInputThread(
Timer* t,
int timeout)
284 virtual ~TimerInputThread() {}
292 QReadWriteLock m_mutex;
296 Timer(
int cls,
int scls,
int card,
int dev,
int sdev,
int openMode,
QObject* parent = 0);
297 Timer(
const QString& deviceName,
int openMode,
QObject* parent = 0);
298 Timer(
const QString& deviceName,
int openMode, snd_config_t* config,
QObject* parent = 0);
302 static TimerId bestGlobalTimerId();
303 static Timer* bestGlobalTimer(
int openMode,
QObject* parent = 0);
315 void continueRunning();
317 void addAsyncTimerHandler(snd_async_callback_t callback,
void *private_data);
318 int getPollDescriptorsCount();
319 void pollDescriptors(
struct pollfd *pfds,
unsigned int space);
320 void pollDescriptorsRevents(
struct pollfd *pfds,
unsigned int nfds,
unsigned short *revents);
321 ssize_t read(
void *buffer,
size_t size);
322 snd_timer_t* getTimerHandle();
342 void timerExpired(
int ticks,
int msecs);
346 snd_async_handler_t *m_asyncHandler;
348 QPointer<TimerInputThread> m_thread;
351 QString m_deviceName;
352 snd_htimestamp_t m_last_time;
TimerIdList getTimers() const
Gets the list of available timers.
virtual ~TimerEventHandler()
Destructor.
The QObject class is the base class of all Qt objects.
void setHandler(TimerEventHandler *h)
Sets an event handler providing a method to be called when a timer expires.
snd_timer_t * getHandle()
Gets the ALSA timer object.
ALSA Timer information container.
ALSA Timer status container.
ALSA Timer parameters container.
Global timer information container.
ALSA Timer events handler.
QList< TimerId > TimerIdList
List of timer identifiers.
ALSA Timer inquiry helper.
The QThread class provides platform-independent threads.
ALSA Timer identifier container.