/usr/include/tse3/MidiFilter.h is in libtse3-dev 0.3.1-5.
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 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | /*
* @(#)MidiFilter.h 3.00 8 June 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_EVENTFILTER_H
#define TSE3_EVENTFILTER_H
#include "tse3/listen/MidiFilter.h"
#include "tse3/Notifier.h"
#include "tse3/Filter.h"
#include "tse3/Serializable.h"
#include "tse3/Midi.h"
namespace TSE3
{
/**
* This the a standard (and comprehensive) @ref Filter object type that is
* used by the TSE3 library.
*
* There is provision for the following features:
* @li enable/disable all events
* @li incomming MIDI channel filter
* @li forcing to a MIDI channel/port
* @li time shift
* @li time scaling
* @li linear quantise
* @li transposition
* @li velocity window clipping
* @li velocity scaling
*
* @sect Command classes
*
* Use the following command classes to manipute this object in a undo/redo
* environment.
*
* @li @ref TSE3::Cmd::Part_SetInfo
* @li @ref TSE3::Cmd::Track_SetInfo
*
* @short Simple @ref MidiEvent filter
* @author Pete Goodliffe
* @version 3.00
* @see Filter
*/
class MidiFilter : public Filter,
public Serializable,
public Notifier<MidiFilterListener>
{
public:
/**
* Creates a MidiFilter with the default parameters
* which leave @ref MidiEvents unchanged.
*/
MidiFilter();
MidiFilter(const MidiFilter &);
virtual ~MidiFilter();
MidiFilter &operator=(const MidiFilter &);
/**
* Returns the status value.
*
* A value of false means the filter blocks all output, returning
* @ref MidiCommand_Invalid instead of output
*
* @return The status value
* @see setStatus
*/
bool status() const { return _status; }
/**
* Set the status value.
*
* @param s The new status value to set
* @see status
*/
void setStatus(bool s);
/**
* Returns the value of a MIDI channel filter.
*
* If true then events on this MIDI channel are allowed to pass
* through filter. If false, events are not passed through filter.
*
* @param c MIDI channel to find channel filter status of
* @return The status of the MIDI channel's filter
* @see setChannelFilter
*/
bool channelFilter(int c) const { return _channelFilter & (1<<c); }
/**
* Sets the value of a channel filter.
*
* @param c MIDI channel to set filter status of
* @param val New MIDI channel filter status value
* @see channelFilter
*/
void setChannelFilter(int c, bool val);
/**
* Returns the MIDI channel value.
*
* A value of @ref MidiCommand::SameChannel means do not force to a
* particular channel.
*
* @return MIDI channel events will be forced to
* @see setChannel
*/
int channel() const { return _channel; }
/**
* Set the channel value.
*
* @param c New MIDI channel events will be forced to
* @see channel
*/
void setChannel(int c);
/**
* Returns the MIDI port value.
*
* A value of @ref MidiCommand::SamePort means do not force to a
* particular port.
*
* @return MIDI port number events will be forced to
* @see setPort
*/
int port() const { return _port; }
/**
* Set the port value.
*
* @param p New MIDI port number events will be forced to
* @see port
*/
void setPort(int p);
/**
* Returns the time offset value.
*
* @return @ref Clock value added to each @ref MidiEvent
* @see setOffset
*/
Clock offset() const { return _offset; }
/**
* Sets the time offset value.
*
* @param o New @ref Clock value added to each @ref MidiEvent
* @see offset
*/
void setOffset(Clock o);
/**
* Returns the time scale value.
*
* A value of 100 will have no effect.
* The value is a percentage that ranges from 1 to 500.
*
* @return The time scale value
* @see setTimeScale
*/
int timeScale() const { return _timeScale; }
/**
* Set the time scale value.
*
* @param t New time scale value
* @see timeScale
*/
void setTimeScale(int t);
/**
* Returns the quantise value. This is a linear quantise resolution
* that @ref MidiEvent times will be 'snapped' to.
*
* A value of zero means do not quantise.
*
* @return The quantise resolution value
* @see setQuantise
*/
Clock quantise() const { return _quantise; }
/**
* Set the quantise value.
*
* @param q New quantise resolution value
* @see quantise
*/
void setQuantise(Clock q);
/**
* Returns the minimum note length. This is applied to @ref
* MidiCommand_NoteOn events to ensure that they are of at least
* a certain duration.
*
* A value of 0 represents no minimum length.
*
* @return The minimum note length
* @see setMinLength
*/
Clock minLength() const { return _minLength; }
/**
* Set the minimum length value.
*
* @param q New minimum length value
* @see minLength
*/
void setMinLength(Clock ml);
/**
* Returns the minimum note length. This is applied to @ref
* MidiCommand_NoteOn events to ensure that they are of at least
* a certain duration.
*
* A value of -1 represents to maximum length.
*
* @return The maximum note length
* @see setMaxLength
*/
Clock maxLength() const { return _maxLength; }
/**
* Set the maximum length value.
*
* @param lm New maximum length value
* @see minLength
*/
void setMaxLength(Clock ml);
/**
* Returns the transpose value. This is an integer number that is
* added to the value of notes in any note-related @ref MidiEvent.
*
* This can range between -127 to +127
*
* @return The transpose value
* @see setTranspose
*/
int transpose() const { return _transpose; }
/**
* Set the transport value.
*
* @param t New transport value
* @see transpose
*/
void setTranspose(int t);
/**
* Returns the minimum velocity window value. Note @ref MidiEvents
* with veloicties below this value will have their velocity set
* to this value. This is useful to prevent quiet notes from
* not being heard, for example.
*
* A value of 0 will have no effect, and is considered 'off'.
*
* @return Minimum velocity window value
* @see setMinVelocity
*/
int minVelocity() const { return _minVelocity; }
/**
* Set the minimum velocity window value.
*
* @param v New minimum velocity window value
* @see minVelocity
*/
void setMinVelocity(int v);
/**
* Returns the maximum velocity window value. Note @ref MidiEvents
* with velocities above this value will have their veolcity set
* to this value. This is useful to prevent loud notes from drowning
* out other notes, for example.
*
* A value of 127 will have no effect, and is considered 'off'.
*
* @return Maximum velocity window value
* @see setMaxVelocity
*/
int maxVelocity() const { return _maxVelocity; }
/**
* Set the maximum velocity window value.
*
* @param v New maximum velocity window value.
* @see maxVelocity
*/
void setMaxVelocity(int v);
/**
* Returns the velocity scale value. This value scales the time
* value of a @ref MidiEvent.
*
* A value of 100 will have no effect.
* The value is a percentage that ranges from 1 to 200.
*
* @return Velocity scale value
* @see setVelocityScale
*/
Clock velocityScale() const { return _velocityScale; }
/**
* Set the velocity scale value.
*
* @param v New velocity scale value
* @see velocityScale
*/
void setVelocityScale(int v);
/**
* @reimplemented
*/
virtual MidiEvent filter(const MidiEvent &e) const;
/**
* @reimplemented
*/
virtual void save(std::ostream &o, int i) const;
/**
* @reimplemented
*/
virtual void load(std::istream &i, SerializableLoadInfo &info);
private:
void setChannelFilter(int c) { _channelFilter = c; }
bool _status;
unsigned int _channelFilter;
int _channel;
int _port;
Clock _offset;
int _timeScale;
Clock _quantise;
Clock _minLength;
Clock _maxLength;
int _transpose;
int _minVelocity;
int _maxVelocity;
int _velocityScale;
};
}
#endif
|