23 #include <QReadLocker> 24 #include <QWriteLocker> 56 const int TIMEOUT = 100;
167 unsigned int last_tick;
174 if (last_tick == 0) {
204 qWarning(
"exception in output thread");
219 QThread::start( priority );
snd_seq_event_t * getHandle()
Gets the handle of the event.
MidiQueue * m_Queue
MidiQueue instance pointer.
void setTickPosition(snd_seq_tick_time_t pos)
Sets the queue position in musical time (ticks).
virtual unsigned int getEchoResolution()
Gets the echo event resolution in ticks.
Classes managing ALSA Sequencer clients.
virtual void drainOutput()
Flush the ALSA output buffer.
void continueRunning()
Start the queue without resetting the last position.
void clear()
Clear the queue, dropping any scheduled events.
void start()
Start the queue.
virtual unsigned int getInitialPosition()
Gets the initial position in ticks of the sequence.
void stop()
Stop the queue.
virtual SequencerEvent * nextEvent()=0
Gets the next event in the sequence.
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event's type is of type connection change.
QueueStatus & getStatus()
Gets a QueueStatus object reference.
Base class for the event's hierarchy.
virtual void syncOutput()
Waits until the ALSA output queue is empty (all the events have been played.)
int getEvents()
Gets the number of queued events.
SequencerOutputThread(MidiClient *seq, int portId)
Constructor.
int m_npfds
Number of pollfd pointers.
snd_seq_t * getHandle()
Returns the sequencer handler managed by ALSA.
virtual void run()
Thread process loop.
void start(Priority priority=InheritPriority)
Starts the playback thread.
void scheduleTick(const int queue, const int tick, const bool relative)
Sets the event to be scheduled in musical time (ticks) units.
int m_QueueId
MidiQueue numeric identifier.
void setSource(const unsigned char port)
Sets the event's source port ID.
bool m_Stopped
Stopped status.
virtual void sendEchoEvent(int tick)
Sends an echo event, with the same PortId as sender and destination.
MidiQueue * getQueue()
Get the MidiQueue instance associated to this client.
pollfd * m_pfds
Array of pollfd pointers.
void stopped()
Signal emitted when the play-back has stopped.
virtual void stop()
Stops playing the current sequence.
MidiClient * m_MidiClient
MidiClient instance pointer.
virtual bool hasNext()=0
Check if there is one more event in the sequence.
Classes managing ALSA Sequencer queues.
int getClientId()
Gets the client ID.
The QThread class provides platform-independent threads.
virtual void sendSongEvent(SequencerEvent *ev)
Sends a SequencerEvent.
int m_PortId
MidiPort numeric identifier.
QReadWriteLock m_mutex
Mutex object used for synchronization.
void finished()
Signal emitted when the sequence play-back has finished.
virtual bool stopRequested()
Checks if stop has been requested.
void setDestination(const unsigned char client, const unsigned char port)
Sets the client:port destination of the event.