| 1 |
#ifndef IMPORTMIDI_TIE_H |
| 2 |
#define IMPORTMIDI_TIE_H |
| 3 |
|
| 4 |
#include <set> |
| 5 |
|
| 6 |
|
| 7 |
namespace Ms { |
| 8 |
|
| 9 |
class Segment; |
| 10 |
class ChordRest; |
| 11 |
class Staff; |
| 12 |
|
| 13 |
namespace MidiTie { |
| 14 |
|
| 15 |
|
| 16 |
bool isTiedFor(const Segment *seg, int strack, int voice); |
| 17 |
bool isTiedBack(const Segment *seg, int strack, int voice); |
| 18 |
|
| 19 |
|
| 20 |
class TieStateMachine |
| 21 |
{ |
| 22 |
public: |
| 23 |
enum class State : char |
| 24 |
{ |
| 25 |
UNTIED, TIED_FOR, TIED_BOTH, TIED_BACK |
| 26 |
}; |
| 27 |
|
| 28 |
void addSeg(const Segment *seg, int strack); |
| 29 |
State state() const { return state_; } |
| 30 |
|
| 31 |
private: |
| 32 |
std::set<int> tiedVoices; |
| 33 |
State state_ = State::UNTIED; |
| 34 |
}; |
| 35 |
|
| 36 |
|
| •37 |
#ifdef IMPORTMIDI_DEBUG |
| 38 |
bool areTiesConsistent(const Staff *staff); |
| 39 |
#endif |
| 40 |
|
| 41 |
|
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
#endif |