19#ifndef DRUMSTICK_ALSACLIENT_H
20#define DRUMSTICK_ALSACLIENT_H
24#include <QScopedPointer>
26#include <QReadWriteLock>
35#if defined(DRUMSTICK_STATIC)
36#define DRUMSTICK_ALSA_EXPORT
38#if defined(drumstick_alsa_EXPORTS)
39#define DRUMSTICK_ALSA_EXPORT Q_DECL_EXPORT
41#define DRUMSTICK_ALSA_EXPORT Q_DECL_IMPORT
77 explicit ClientInfo(snd_seq_client_info_t *other);
82 int getSizeOfInfo()
const;
85 snd_seq_client_type_t getClientType();
87 bool getBroadcastFilter();
88 bool getErrorBounce();
91 void setClient(
int client);
92 void setName(QString name);
93 void setBroadcastFilter(
bool val);
94 void setErrorBounce(
bool val);
97#if SND_LIB_VERSION > 0x010010
98 void addFilter(
int eventType);
99 bool isFiltered(
int eventType);
101 void removeFilter(
int eventType);
108 Q_DECL_DEPRECATED
const unsigned char* getEventFilter();
109 Q_DECL_DEPRECATED
void setEventFilter(
unsigned char* filter);
112 snd_seq_client_info_t* m_Info;
134 explicit SystemInfo(snd_seq_system_info_t* other);
139 int getSizeOfInfo()
const;
144 int getMaxChannels();
145 int getCurrentQueues();
146 int getCurrentClients();
149 snd_seq_system_info_t* m_Info;
165 explicit PoolInfo(snd_seq_client_pool_t* other);
170 int getSizeOfInfo()
const;
178 void setInputPool(
int size);
179 void setOutputPool(
int size);
180 void setOutputRoom(
int size);
183 snd_seq_client_pool_t* m_Info;
225 void open(
const QString deviceName =
"default",
226 const int openMode = SND_SEQ_OPEN_DUPLEX,
227 const bool blockMode =
false );
228 void open( snd_config_t* conf,
229 const QString deviceName =
"default",
230 const int openMode = SND_SEQ_OPEN_DUPLEX,
231 const bool blockMode =
false );
233 void startSequencerInput();
234 void stopSequencerInput();
237 MidiQueue* createQueue(QString
const& name);
240 MidiQueue* useQueue(
const QString& name);
244 void detachAllPorts();
245 void addEventFilter(
int evtype);
246 void output(
SequencerEvent* ev,
bool async =
false,
int timeout = -1);
247 void outputDirect(
SequencerEvent* ev,
bool async =
false,
int timeout = -1);
249 void drainOutput(
bool async =
false,
int timeout = -1);
250 void synchronizeOutput();
253 snd_seq_type_t getSequencerType();
254 snd_seq_t* getHandle();
257 size_t getOutputBufferSize();
258 void setOutputBufferSize(
size_t newSize);
259 size_t getInputBufferSize();
260 void setInputBufferSize(
size_t newSize);
261 QString getDeviceName();
264 void setBlockMode(
bool newValue);
265 QString getClientName();
266 QString getClientName(
const int clientId);
267 void setClientName(QString
const& newName);
268 bool getBroadcastFilter();
269 void setBroadcastFilter(
bool newValue);
270 bool getErrorBounce();
271 void setErrorBounce(
bool newValue);
274 void setThisClientInfo(
const ClientInfo& val);
280 QList<int> getAvailableQueues();
283 void setPoolInfo(
const PoolInfo& info);
284 void setPoolInput(
int size);
285 void setPoolOutput(
int size);
286 void setPoolOutputRoom(
int size);
287 void resetPoolInput();
288 void resetPoolOutput();
290 void dropInputBuffer();
292 void dropOutputBuffer();
296 int inputPending(
bool fetch);
297 int getQueueId(
const QString& name);
299 void addListener(
QObject* listener);
300 void removeListener(
QObject* listener);
301 void setEventsEnabled(
const bool bEnabled);
302 bool getEventsEnabled()
const;
304 bool parseAddress(
const QString& straddr, snd_seq_addr& result );
305 void setRealTimeInput(
bool enabled);
306 bool realTimeInputEnabled();
316 void applyClientInfo();
319 void updateAvailablePorts();
323 const char * _getDeviceName();
324 int getPollDescriptorsCount(
short events);
325 int pollDescriptors(
struct pollfd *pfds,
unsigned int space,
short events);
326 unsigned short pollDescriptorsRevents(
struct pollfd *pfds,
unsigned int nfds);
329 void _setClientName(
const char *name );
330 int createSimplePort(
const char *name,
333 void deleteSimplePort(
int port );
334 void connectFrom(
int myport,
int client,
int port);
335 void connectTo(
int myport,
int client,
int port);
336 void disconnectFrom(
int myport,
int client,
int port);
337 void disconnectTo(
int myport,
int client,
int port);
341 class MidiClientPrivate;
342 QScopedPointer<MidiClientPrivate> d;
345#if SND_LIB_VERSION > 0x010004
346DRUMSTICK_ALSA_EXPORT QString getRuntimeALSALibraryVersion();
347DRUMSTICK_ALSA_EXPORT
int getRuntimeALSALibraryNumber();
Classes managing ALSA Sequencer ports.
The QObject class is the base class of all Qt objects.
void eventReceived(drumstick::ALSA::SequencerEvent *ev)
Signal emitted when an event is received.
Sequencer Pool information.
Auxiliary class to remove events from an ALSA queue.
Sequencer events handler.
virtual ~SequencerEventHandler()=default
Destructor.
virtual void handleSequencerEvent(SequencerEvent *ev)=0
Callback function to be implemented by the derived class.
Base class for the event's hierarchy.
QString getDrumstickLibraryVersion()
getDrumstickLibraryVersion provides the Drumstick version as an edited QString
int getRuntimeALSADriverNumber()
Gets the runtime ALSA drivers version number.
QList< ClientInfo > ClientInfoList
List of sequencer client information.
QString getRuntimeALSADriverVersion()
Gets the runtime ALSA drivers version string.
QString getCompiledALSALibraryVersion()
ALSA library version at build time.
QList< MidiPort * > MidiPortList
List of Ports instances.
QList< PortInfo > PortInfoList
List of port information objects.