1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 3 /* 4 Rosegarden 5 A sequencer and musical notation editor. 6 Copyright 2000-2021 the Rosegarden development team. 7 See the AUTHORS file for more details. 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License as 11 published by the Free Software Foundation; either version 2 of the 12 License, or (at your option) any later version. See the file 13 COPYING included with this distribution for more information. 14 */ 15 16 #ifndef NOTATION_QUANTIZER_H_ 17 #define NOTATION_QUANTIZER_H_ 18 19 #include "Quantizer.h" 20 21 namespace Rosegarden { 22 23 class NotationQuantizer : public Quantizer 24 { 25 public: 26 NotationQuantizer(); 27 NotationQuantizer(std::string source, std::string target); 28 NotationQuantizer(const NotationQuantizer &); 29 ~NotationQuantizer() override; 30 31 /** 32 * Set the absolute time minimum unit. Default is demisemiquaver. 33 */ 34 void setUnit(timeT); 35 timeT getUnit() const; 36 37 /** 38 * Set the simplicity factor. This controls the relative "pull" 39 * towards larger units and more obvious beats in placing notes. 40 * The value 10 means no pull to larger units, lower values mean 41 * an active pull away from them. Default is 13. 42 */ 43 void setSimplicityFactor(int); 44 int getSimplicityFactor() const; 45 46 /** 47 * Set the maximum size of tuplet group. 2 = two-in-the-time-of-three 48 * groupings, 3 = triplets, etc. Default is 3. Set <2 to switch off 49 * tuplets altogether. 50 */ 51 void setMaxTuplet(int); 52 int getMaxTuplet() const; 53 54 /** 55 * Set whether we assume the music may be contrapuntal -- that is, 56 * may have notes that overlap rather than simply a sequence of 57 * individual notes and chords. 58 */ 59 void setContrapuntal(bool); 60 bool getContrapuntal() const; 61 62 /** 63 * Set whether to add articulations (staccato, tenuto, slurs). 64 * Default is true. Doesn't affect quantization, only the marks 65 * that are added to quantized notes. 66 */ 67 void setArticulate(bool); 68 bool getArticulate() const; 69 70 protected: 71 void quantizeRange(Segment *, 72 Segment::iterator, 73 Segment::iterator) const override; 74 75 protected: 76 // avoid having to rebuild absolutely everything each time we 77 // tweak the implementation 78 class Impl; 79 Impl *m_impl; 80 81 private: 82 NotationQuantizer &operator=(const NotationQuantizer &); // not provided 83 }; 84 85 } 86 87 #endif 88