drumstick  0.5.0
drumstickcommon.h File Reference

Common functionality. More...

#include "macros.h"
#include <qglobal.h>
#include <QString>
#include <QApplication>
#include <QtDebug>
#include <alsa/asoundlib.h>
Include dependency graph for drumstickcommon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SequencerError
 Class used to report errors from the ALSA sequencer. More...
 

Macros

#define CHECK_ERROR(x)   (checkErrorAndThrow((x),__PRETTY_FUNCTION__))
 This macro calls the check error function. More...
 
#define CHECK_WARNING(x)   (checkWarning((x),__PRETTY_FUNCTION__))
 This macro calls the check warning function. More...
 

Typedefs

typedef quint8 MidiByte
 8-bit unsigned number to be used as a MIDI message parameter
 

Functions

int checkErrorAndThrow (int rc, const char *where)
 Checks the error code for severe errors. More...
 
int checkWarning (int rc, const char *where)
 Check the error code for warning errors. More...
 
const QString LIBRARY_VERSION (SND_LIB_VERSION_STR)
 ALSA library version as a constant string. More...
 

Detailed Description

Common functionality.

Definition in file drumstickcommon.h.

Macro Definition Documentation

◆ CHECK_ERROR

#define CHECK_ERROR (   x)    (checkErrorAndThrow((x),__PRETTY_FUNCTION__))

This macro calls the check error function.

Parameters
xError code

Definition at line 140 of file drumstickcommon.h.

Referenced by MidiClient::detachAllPorts(), MidiCodec::MidiCodec(), MidiQueue::MidiQueue(), MidiClient::open(), MidiClient::portAttach(), MidiClient::portDetach(), Timer::Timer(), and MidiQueue::~MidiQueue().

◆ CHECK_WARNING

#define CHECK_WARNING (   x)    (checkWarning((x),__PRETTY_FUNCTION__))

This macro calls the check warning function.

Parameters
xError code

Definition at line 146 of file drumstickcommon.h.

Referenced by MidiClient::_setClientName(), Timer::addAsyncTimerHandler(), MidiPort::applyPortInfo(), MidiClient::close(), MidiClient::connectFrom(), MidiClient::connectTo(), MidiQueue::continueRunning(), Timer::continueRunning(), MidiClient::createSimplePort(), MidiCodec::decode(), MidiClient::deleteSimplePort(), MidiClient::disconnectFrom(), MidiClient::disconnectTo(), MidiClient::drainOutput(), MidiClient::dropInput(), MidiClient::dropInputBuffer(), MidiClient::dropOutput(), MidiClient::dropOutputBuffer(), MidiCodec::encode(), MidiClient::extractOutput(), MidiClient::getClientId(), MidiQueue::getInfo(), MidiQueue::getStatus(), MidiQueue::getTempo(), MidiQueue::getTimer(), Timer::getTimerStatus(), MidiQueue::getUsage(), MidiClient::open(), MidiClient::output(), MidiClient::outputBuffer(), MidiClient::outputDirect(), Timer::pollDescriptors(), MidiClient::pollDescriptorsRevents(), Timer::pollDescriptorsRevents(), PortInfo::PortInfo(), MidiClient::removeEvents(), MidiClient::resetPoolInput(), MidiClient::resetPoolOutput(), MidiCodec::resizeBuffer(), MidiClient::setBlockMode(), MidiQueue::setInfo(), MidiClient::setInputBufferSize(), MidiClient::setOutputBufferSize(), MidiClient::setPoolInfo(), MidiClient::setPoolInput(), MidiClient::setPoolOutput(), MidiClient::setPoolOutputRoom(), MidiQueue::setTempo(), MidiQueue::setTimer(), Timer::setTimerParams(), MidiQueue::setUsage(), MidiQueue::start(), Timer::start(), MidiQueue::stop(), Timer::stop(), Subscription::subscribe(), Subscription::Subscription(), TimerQuery::TimerQuery(), Subscription::unsubscribe(), and Timer::~Timer().

Function Documentation

◆ checkErrorAndThrow()

int drumstick::checkErrorAndThrow ( int  rc,
const char *  where 
)
inline

Checks the error code for severe errors.

If the provided error code is less than zero an exception is thrown, containing both the error code and the location.

Parameters
rcError code
whereLocation
Returns
Error code

Definition at line 110 of file drumstickcommon.h.

References drumstick::checkErrorAndThrow().

Referenced by drumstick::checkErrorAndThrow().

◆ checkWarning()

int drumstick::checkWarning ( int  rc,
const char *  where 
)
inline

Check the error code for warning errors.

This method doesn't throw an exception.

Parameters
rcError code
whereLocation
Returns
Error code

Definition at line 127 of file drumstickcommon.h.

References drumstick::checkWarning().

Referenced by drumstick::checkWarning().

◆ LIBRARY_VERSION()

const QString drumstick::LIBRARY_VERSION ( SND_LIB_VERSION_STR  )

ALSA library version as a constant string.

This string corresponds to the compilation library, which may be different to the runtime library.

See also
getRuntimeALSALibraryVersion
Examples:
sysinfo.cpp.