20 #ifndef DRUMSTICK_DRUMSTICKCOMMON_H
21 #define DRUMSTICK_DRUMSTICKCOMMON_H
26 #include <QCoreApplication>
30 #include <alsa/asoundlib.h>
46 typedef quint8 MidiByte;
63 m_location(s), m_errCode(rc) {}
76 return QString(snd_strerror(m_errCode));
110 inline int checkErrorAndThrow(
int rc,
const char *where)
113 qDebug() <<
"Error code:" << rc <<
"(" << snd_strerror(rc) <<
")";
114 qDebug() <<
"Location:" << where;
115 throw SequencerError(QString(where), rc);
127 inline int checkWarning(
int rc,
const char *where)
130 qWarning() <<
"Exception code:" << rc <<
"(" << snd_strerror(rc) <<
")";
131 qWarning() <<
"Location:" << where;
140 #define CHECK_ERROR(x) (checkErrorAndThrow((x),__PRETTY_FUNCTION__))
146 #define CHECK_WARNING(x) (checkWarning((x),__PRETTY_FUNCTION__))
155 const QString LIBRARY_VERSION(SND_LIB_VERSION_STR);
const QString qstrError() const
Gets the human readable error message from the error code.
int code() const
Gets the numeric error code.
const QString & location() const
Gets the location of the error code as provided in the constructor.
Drumstick visibility macros.
Class used to report errors from the ALSA sequencer.
SequencerError(QString const &s, int rc)
Constructor.
virtual ~SequencerError()
Destructor.