/usr/include/tse3/Metronome.h is in libtse3-dev 0.3.1-4.3ubuntu1.
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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | /*
* @(#)Metronome.h 3.00 25 May 1999
*
* Copyright (c) 2000 Pete Goodliffe (pete@cthree.org)
*
* This file is part of TSE3 - the Trax Sequencer Engine version 3.00.
*
* This library is modifiable/redistributable under the terms of the GNU
* General Public License.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING. If not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef TSE3_METRONOME_H
#define TSE3_METRONOME_H
#include "tse3/listen/Metronome.h"
#include "tse3/Notifier.h"
#include "tse3/Playable.h"
namespace TSE3
{
/**
* This class provides the functionality of a metronome.
*
* The metronome remembers whether it should be produced in playing and
* recording modes, but it doesn't enforce this itself - it is the
* responsibility of the @ref Transport playback routines.
*
* There are two different metronome ticks that are produced, for bars
* and beats. They must have the same MIDI channel, port, and duration, but
* can have different notes and velocities.
*
* To determine the point at which clocks bar ticks are produced, a bar
* reference exists.
*
* @short Metronome tick object
* @author Pete Goodliffe
* @version 3.00
* @see Playable
*/
class Metronome : public Playable,
public Notifier<MetronomeListener>
{
public:
/**
* Constructs a Metronome with default tick.
*/
Metronome();
virtual ~Metronome();
/**
* Returns the metronome MIDI channel.
*
* @return Metronome MIDI channel
* @see setChannel
*/
int channel() const { return _channel; }
/**
* Sets the metronome MIDI channel.
*
* @param c New metronome MIDI channel
* @see channel
*/
void setChannel(int c);
/**
* Returns the metronome MIDI port.
*
* @return Metronome MIDI port
* @see setPort
*/
int port() const { return _port; }
/**
* Sets the metronome MIDI port.
*
* @param p New metronome MIDI port
* @see port
*/
void setPort(int p);
/**
* Returns the metronome duration.
*
* @return Metronome tick duration
* @see setDuration
*/
int duration() const { return _duration; }
/**
* Sets the metronome duration.
*
* @param p New metronome tick duration
* @see duration
*/
void setDuration(int d);
/**
* Returns the metronome bar note. This is the note that is played
* on a metronome tick that occurs at the start of a bar.
*
* @return Metronome bar note
* @see setBarNote
* @see setBeatNote
* @see setBarVelocity
*/
int barNote() const { return _barNote; }
/**
* Sets the metronome bar note.
*
* @param n New metronome bar note
* @see barNote
* @see beatNote
* @see barVelocity
*/
void setBarNote(int n);
/**
* Returns the metronome bar velocity.
*
* @return Metronome bar velocity
* @see setBarVelocity
* @see setBeatVelocity
* @see setBarNote
*/
int barVelocity() const { return _barVelocity; }
/**
* Sets the metronome bar velocity.
*
* @param v New metronome bar velocity
* @see barVelocity
* @see beatVelocity
* @see barNote
*/
void setBarVelocity(int v);
/**
* Returns the metronome beat note. This is the note that is played
* on a metronome tick that does not occur at the start of a bar.
*
* @return Metronome beat note
* @see setBeatNote
* @see setBarNote
* @see setBeatVelocity
*/
int beatNote() const { return _beatNote; }
/**
* Sets the metronome beat note.
*
* @param n New metronome beat note
* @see beatNote
* @see barNote
* @see beatVelocity
*/
void setBeatNote(int n);
/**
* Returns the metronome beat velocity.
*
* @return Metronome beat velocity
* @see setBeatVelocity
* @see setBarVelocity
* @see setBeatNote
*/
int beatVelocity() const { return _beatVelocity; }
/**
* Sets the metronome bar velocity.
*
* @param v New metronome bar velocity
* @see beatrVelocity
* @see barVelocity
* @see beatNote
*/
void setBeatVelocity(int v);
/**
* Returns the metronome playing status for a given @ref Transport
* object status mode.
*
* @param mode @ref Transport object status mode
* @return Whether metronome is produced in this mode
* @see setStatus
*/
bool status(int mode) const
{
return _status & (1<<mode);
}
/**
* Sets the metronome playing status for a given transport mode.
*
* @param mode @ref Transport object status mode
* @param s New metronome playing status
* @see status
*/
void setStatus(int mode, bool s);
/**
* Returns the metronome beats per bar value.
*
* A normal TSE3 library user need not worry about this method.
*
* The @ref Transport object uses this value to tell the metronome
* the current time signtaure information. The value represents
* the number of quarter notes in a bar. It is used in conjuction
* with the barReference to determine which metronome ticks are
* 'bar' and which are 'beat'.
*
* @internal
* @return Metronome beats per bar value
* @see setBeatsPerBar
*/
int beatsPerBar() const { return _beatsPerBar; }
/**
* Sets the metronome beats per bar value.
*
* A normal TSE3 library user need not worry about this method.
*
* @internal
* @param bpb New beats per bar value
* @see beatsPerBar
*/
void setBeatsPerBar(int bpb);
/**
* Returns the metronome bar reference clock.
*
* A normal TSE3 library user need not worry about this method.
*
* This is the time value of some accented 'bar' note. This
* tells the Metronome object when to create a 'bat' tick and
* when to create a 'beat' tick when used in conjuction with the
* @ref beatsPerBar method.
*
* @internal
* @return A bar tick reference time
* @see setBarReference
* @see beatsPerBar
*
*/
Clock barReference() const { return _barReference; }
/**
* Sets the metronome bar reference clock.
*
* A normal TSE3 library user need not worry about this method.
*
* @internal
* @param br New bar tick reference time
* @see barReferenceTime
*/
void setBarReference(Clock br);
/**
* @reimplemented
*/
virtual PlayableIterator *iterator(Clock index);
/**
* @reimplemented
*/
virtual Clock lastClock() const;
friend class MetronomeIterator;
private:
Metronome &operator=(const Metronome &);
Metronome(const Metronome &);
void calculateCommands();
int _channel, _port;
int _status;
Clock _duration;
int _barNote, _barVelocity;
int _beatNote, _beatVelocity;
int _beatsPerBar;
Clock _barReference;
MidiCommand barNoteOn, barNoteOff; // Cached commands calculated
MidiCommand beatNoteOn, beatNoteOff; // by calculateCommands
Clock pos; // Playable support
};
}
#endif
|