/usr/include/drumstick/playthread.h is in libdrumstick-dev 0.5.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | /*
MIDI Sequencer C++ library
Copyright (C) 2006-2010, Pedro Lopez-Cabanillas <plcl@users.sf.net>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DRUMSTICK_PLAYTHREAD_H
#define DRUMSTICK_PLAYTHREAD_H
#include "alsaevent.h"
#include <QThread>
#include <QReadWriteLock>
/**
* @file playthread.h
* Sequencer output thread
* @defgroup PlayThread Sequencer Output
* @{
*/
namespace drumstick {
class MidiClient;
class MidiQueue;
/**
* Sequence player auxiliary class
*
* This class is used to implement an asynchronous sequence player using
* ALSA sequencer scheduling
*
* Examples: guiplayer.cpp and playsmf.cpp
*/
class DRUMSTICK_EXPORT SequencerOutputThread : public QThread
{
Q_OBJECT
public:
SequencerOutputThread(MidiClient *seq, int portId);
virtual void run();
/**
* Gets the initial position in ticks of the sequence
* @return Initial position (ticks)
*/
virtual unsigned int getInitialPosition() { return 0; }
/**
* Gets the echo event resolution in ticks. This is the time
* between echo events interleaved with the MIDI sequence. The default
* value zero means that not echo events are sent at all.
* @return Echo resolution (ticks)
*/
virtual unsigned int getEchoResolution() { return 0; }
/**
* Check if there is one more event in the sequence.
* This is a pure virtual method that must be overridden in the derived
* class.
* @return True if the sequence has another event.
*/
virtual bool hasNext() = 0;
/**
* Gets the next event in the sequence.
* This is a pure virtual function that must be overridden in the derived
* class.
* @return Pointer to the next SequencerEvent to be played.
*/
virtual SequencerEvent* nextEvent() = 0;
/**
* Stops playing the current sequence.
*/
virtual void stop();
signals:
/**
* Signal emitted when the sequence play-back has finished.
*/
void finished();
/**
* Signal emitted when the play-back has stopped.
* @since 0.2.0
*/
void stopped();
public slots:
void start( Priority priority = InheritPriority );
protected:
virtual void sendEchoEvent(int tick);
virtual void sendSongEvent(SequencerEvent* ev);
virtual void drainOutput();
virtual void syncOutput();
virtual bool stopRequested();
MidiClient *m_MidiClient; /**< MidiClient instance pointer */
MidiQueue *m_Queue; /**< MidiQueue instance pointer */
int m_PortId; /**< MidiPort numeric identifier */
bool m_Stopped; /**< Stopped status */
int m_QueueId; /**< MidiQueue numeric identifier */
int m_npfds; /**< Number of pollfd pointers */
pollfd* m_pfds; /**< Array of pollfd pointers */
QReadWriteLock m_mutex; /**< Mutex object used for synchronization */
};
} /* namespace drumstick */
/** @} */
#endif /*DRUMSTICK_PLAYTHREAD_H*/
|