20 #ifndef DRUMSTICK_ALSACLIENT_H 21 #define DRUMSTICK_ALSACLIENT_H 26 #include <QReadWriteLock> 41 class SequencerInputThread;
62 int getSizeOfInfo()
const;
65 snd_seq_client_type_t getClientType();
67 bool getBroadcastFilter();
68 bool getErrorBounce();
71 void setClient(
int client);
72 void setName(QString name);
73 void setBroadcastFilter(
bool val);
74 void setErrorBounce(
bool val);
77 #if SND_LIB_VERSION > 0x010010 78 void addFilter(
int eventType);
79 bool isFiltered(
int eventType);
81 void removeFilter(
int eventType);
88 const unsigned char* getEventFilter() __attribute__((deprecated));
89 void setEventFilter(
unsigned char* filter) __attribute__((deprecated));
92 snd_seq_client_info_t* m_Info;
119 int getSizeOfInfo()
const;
124 int getMaxChannels();
125 int getCurrentQueues();
126 int getCurrentClients();
129 snd_seq_system_info_t* m_Info;
145 PoolInfo(snd_seq_client_pool_t* other);
150 int getSizeOfInfo()
const;
158 void setInputPool(
int size);
159 void setOutputPool(
int size);
160 void setOutputRoom(
int size);
163 snd_seq_client_pool_t* m_Info;
205 void open(
const QString deviceName =
"default",
206 const int openMode = SND_SEQ_OPEN_DUPLEX,
207 const bool blockMode =
false );
208 void open( snd_config_t* conf,
209 const QString deviceName =
"default",
210 const int openMode = SND_SEQ_OPEN_DUPLEX,
211 const bool blockMode =
false );
213 void startSequencerInput();
214 void stopSequencerInput();
217 MidiQueue* createQueue(QString
const& name);
220 MidiQueue* useQueue(
const QString& name);
224 void detachAllPorts();
225 void addEventFilter(
int evtype);
226 void output(
SequencerEvent* ev,
bool async =
false,
int timeout = -1);
227 void outputDirect(
SequencerEvent* ev,
bool async =
false,
int timeout = -1);
229 void drainOutput(
bool async =
false,
int timeout = -1);
230 void synchronizeOutput();
233 snd_seq_type_t getSequencerType();
239 size_t getOutputBufferSize();
240 void setOutputBufferSize(
size_t newSize);
241 size_t getInputBufferSize();
242 void setInputBufferSize(
size_t newSize);
249 void setBlockMode(
bool newValue);
250 QString getClientName();
251 QString getClientName(
const int clientId);
252 void setClientName(QString
const& newName);
253 bool getBroadcastFilter();
254 void setBroadcastFilter(
bool newValue);
255 bool getErrorBounce();
256 void setErrorBounce(
bool newValue);
259 void setThisClientInfo(
const ClientInfo& val);
265 QList<int> getAvailableQueues();
268 void setPoolInfo(
const PoolInfo& info);
269 void setPoolInput(
int size);
270 void setPoolOutput(
int size);
271 void setPoolOutputRoom(
int size);
272 void resetPoolInput();
273 void resetPoolOutput();
275 void dropInputBuffer();
277 void dropOutputBuffer();
281 int inputPending(
bool fetch);
282 int getQueueId(
const QString& name);
284 void addListener(
QObject* listener);
285 void removeListener(
QObject* listener);
286 void setEventsEnabled(
const bool bEnabled);
291 bool parseAddress(
const QString& straddr, snd_seq_addr& result );
292 void setRealTimeInput(
bool enabled);
293 bool realTimeInputEnabled();
301 void applyClientInfo();
304 void updateAvailablePorts();
308 const char * _getDeviceName();
309 int getPollDescriptorsCount(
short events);
310 int pollDescriptors(
struct pollfd *pfds,
unsigned int space,
short events);
311 unsigned short pollDescriptorsRevents(
struct pollfd *pfds,
unsigned int nfds);
314 void _setClientName(
const char *name );
315 int createSimplePort(
const char *name,
318 void deleteSimplePort(
int port );
319 void connectFrom(
int myport,
int client,
int port);
320 void connectTo(
int myport,
int client,
int port);
321 void disconnectFrom(
int myport,
int client,
int port);
322 void disconnectTo(
int myport,
int client,
int port);
325 class SequencerInputThread;
326 bool m_eventsEnabled;
328 bool m_NeedRefreshClientList;
330 QString m_DeviceName;
331 snd_seq_t* m_SeqHandle;
332 QPointer<SequencerInputThread> m_Thread;
333 QPointer<MidiQueue> m_Queue;
341 QObjectList m_listeners;
346 #if SND_LIB_VERSION > 0x010004 347 DRUMSTICK_EXPORT QString getRuntimeALSALibraryVersion();
348 DRUMSTICK_EXPORT
int getRuntimeALSALibraryNumber();
350 DRUMSTICK_EXPORT QString getRuntimeALSADriverVersion();
351 DRUMSTICK_EXPORT
int getRuntimeALSADriverNumber();
357 #endif // DRUMSTICK_ALSACLIENT_H QList< ClientInfo > ClientInfoList
List of sequencer client information.
bool isOpened()
Returns true if the sequencer is opened.
bool getBlockMode()
Returns the last block mode used in open()
The QObject class is the base class of all Qt objects.
Base class for the event's hierarchy.
QList< PortInfo > PortInfoList
List of port information objects.
void setHandler(SequencerEventHandler *handler)
Sets a sequencer event handler enabling the callback delivery mode.
Sequencer Pool information.
snd_seq_t * getHandle()
Returns the sequencer handler managed by ALSA.
Classes managing ALSA Sequencer ports.
Sequencer events handler.
Auxiliary class to remove events from an ALSA queue.
int getOpenMode()
Returns the last open mode used in open()
bool getEventsEnabled() const
Returns true if the events mode of delivery has been enabled.
virtual ~SequencerEventHandler()
Destructor.
QString getDeviceName()
Returns the name of the sequencer device.
QList< MidiPort * > MidiPortList
List of Ports instances.