drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
|
ALSA Timer management. More...
#include <alsatimer.h>
Signals | |
void | timerExpired (int ticks, int msecs) |
This signal is emitted when the timer has expired, if there is not an event hander installed. More... | |
Public Member Functions | |
Timer (int cls, int scls, int card, int dev, int sdev, int openMode, QObject *parent=nullptr) | |
Constructor. More... | |
Timer (const QString &deviceName, int openMode, QObject *parent=nullptr) | |
Constructor. More... | |
Timer (const QString &deviceName, int openMode, snd_config_t *config, QObject *parent=nullptr) | |
Constructor. More... | |
Timer (TimerId &id, int openMode, QObject *parent=nullptr) | |
Constructor Open flags can be a combination of the following constants: More... | |
virtual | ~Timer () |
Destructor. | |
snd_timer_t * | getHandle () |
Gets the ALSA timer object. More... | |
TimerInfo & | getTimerInfo () |
Gets the timer info object. More... | |
TimerStatus & | getTimerStatus () |
Gets the timer status. More... | |
void | setTimerParams (const TimerParams ¶ms) |
Sets the timer parameters. More... | |
void | start () |
Start rolling the timer. | |
void | stop () |
Stop rolling the timer. | |
void | continueRunning () |
Continue rolling the timer. | |
void | addAsyncTimerHandler (snd_async_callback_t callback, void *private_data) |
Adds an asynchronous timer handler function. More... | |
int | getPollDescriptorsCount () |
Gets the count of poll descriptors. More... | |
void | pollDescriptors (struct pollfd *pfds, unsigned int space) |
Gets poll descriptors. More... | |
void | pollDescriptorsRevents (struct pollfd *pfds, unsigned int nfds, unsigned short *revents) |
Gets returned events from poll descriptors. More... | |
ssize_t | read (void *buffer, size_t size) |
Read bytes from the timer handle. More... | |
snd_timer_t * | getTimerHandle () |
Gets the ALSA timer handle. More... | |
void | setHandler (TimerEventHandler *h) |
Sets an event handler providing a method to be called when a timer expires. More... | |
void | startEvents () |
Starts the events dispatching thread. | |
void | stopEvents () |
Stops the events dispatching thread. | |
Static Public Member Functions | |
static TimerId | bestGlobalTimerId () |
Check and return the best available global TimerId in the system, meaning the timer with higher frequency (or lesser period, resolution). More... | |
static Timer * | bestGlobalTimer (int openMode, QObject *parent=nullptr) |
Check and return the best available global Timer in the system, meaning the timer with higher frequency (or lesser period, resolution). More... | |
Protected Member Functions | |
void | doEvents () |
Internal function to deliver the timer events using one of the two available methods: More... | |
This class represents an ALSA timer object.
Definition at line 283 of file alsatimer.h.
Constructor.
Open flags can be a combination of the following constants:
cls | Class |
scls | Subclass |
card | Card |
dev | Device |
sdev | Subdevice |
openMode | Open mode flags bitmap |
parent | Optional parent object |
Definition at line 1121 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_ERROR.
Constructor.
Open flags can be a combination of the following constants:
deviceName | Name of the device |
openMode | Open mode flags bitmap |
parent | Optional parent object |
Definition at line 1042 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_ERROR.
Constructor.
Open flags can be a combination of the following constants:
deviceName | Name of the device |
openMode | Open mode flags bitmap |
conf | ALSA configuration object pointer |
parent | Optional parent object |
Definition at line 1065 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_ERROR.
Constructor Open flags can be a combination of the following constants:
id | TimerId object reference |
openMode | Open mode flags bitmap |
parent | Optional parent object |
Definition at line 1089 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_ERROR.
void addAsyncTimerHandler | ( | snd_async_callback_t | callback, |
void * | private_data | ||
) |
Adds an asynchronous timer handler function.
callback | Function handler |
private_data | Any data that will be passed to the callback |
Definition at line 1156 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_WARNING.
Check and return the best available global Timer in the system, meaning the timer with higher frequency (or lesser period, resolution).
openMode | Open mode flags |
parent | Optional parent object |
Definition at line 1398 of file alsatimer.cpp.
References Timer::bestGlobalTimerId().
|
static |
Check and return the best available global TimerId in the system, meaning the timer with higher frequency (or lesser period, resolution).
Definition at line 1335 of file alsatimer.cpp.
Referenced by Timer::bestGlobalTimer().
|
protected |
Internal function to deliver the timer events using one of the two available methods:
Definition at line 1284 of file alsatimer.cpp.
References TimerEventHandler::handleTimerEvent(), Timer::read(), and Timer::timerExpired().
|
inline |
Gets the ALSA timer object.
Definition at line 325 of file alsatimer.h.
int getPollDescriptorsCount | ( | ) |
Gets the count of poll descriptors.
Definition at line 1176 of file alsatimer.cpp.
snd_timer_t * getTimerHandle | ( | ) |
TimerInfo & getTimerInfo | ( | ) |
Gets the timer info object.
Definition at line 1209 of file alsatimer.cpp.
TimerStatus & getTimerStatus | ( | ) |
Gets the timer status.
Definition at line 1230 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_WARNING.
Referenced by Timer::startEvents().
void pollDescriptors | ( | struct pollfd * | pfds, |
unsigned int | space | ||
) |
Gets poll descriptors.
pfds | Pointer to a pollfd array |
space | Number of pollfd elements available |
Definition at line 1187 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_WARNING.
void pollDescriptorsRevents | ( | struct pollfd * | pfds, |
unsigned int | nfds, | ||
unsigned short * | revents | ||
) |
Gets returned events from poll descriptors.
pfds | Pointer to a pollfd array |
nfds | Number of pollfd elements available |
revents | Returned events |
Definition at line 1199 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_WARNING.
ssize_t read | ( | void * | buffer, |
size_t | size | ||
) |
Read bytes from the timer handle.
buffer | Buffer to store the input bytes |
size | Input buffer size in bytes |
Definition at line 1270 of file alsatimer.cpp.
Referenced by Timer::doEvents().
|
inline |
Sets an event handler providing a method to be called when a timer expires.
h | A TimerEventHandler instance. |
Definition at line 344 of file alsatimer.h.
void setTimerParams | ( | const TimerParams & | params | ) |
Sets the timer parameters.
params | TimerParams object reference |
Definition at line 1220 of file alsatimer.cpp.
References DRUMSTICK_ALSA_CHECK_WARNING.
|
signal |
This signal is emitted when the timer has expired, if there is not an event hander installed.
ticks | The time in ticks. |
msecs | The time in milliseconds. |
Referenced by Timer::doEvents().