@@ -87,6 +87,12 @@ class SequencePerformer : public AbstractPerformer {
87
87
}
88
88
}
89
89
90
+ void prepareLocalState () {
91
+ createAvsHistoryFromScore ();
92
+ setLoopIndices (0 , (score.size () == 0 ) ? 0 : (score.size () - 1 ));
93
+ setCurrentIndex (0 );
94
+ }
95
+
90
96
void mergeAvsStates (
91
97
std::map<noteKey, std::uint8_t >& target,
92
98
const std::map<noteKey, std::uint8_t > source
@@ -138,22 +144,22 @@ class SequencePerformer : public AbstractPerformer {
138
144
return res; // will be empty if currentIndex == score.size()
139
145
}
140
146
141
- // set to Playing after call to getNextIndex which checks currentState value
142
- if (currentState == State::Armed) {
143
- currentState = State::Playing;
144
- }
145
-
146
147
auto activeNotes = avs.getTriggerCountMap ();
147
148
148
149
// if we are about to play first event in loop, we set avs to take upcoming
149
150
// note offs from unplayed note ons into account
150
- if (currentIndex == minIndex) {
151
+ if (currentIndex == minIndex || currentState == State::Armed ) {
151
152
// merge avs state snapshot with current avs state
152
153
auto avsState = avsHistory[currentIndex];
153
154
mergeAvsStates (avsState, activeNotes);
154
155
avs.setTriggerCountMap (avsState);
155
156
}
156
157
158
+ // set to Playing after call to getNextIndex which checks currentState value
159
+ if (currentState == State::Armed) {
160
+ currentState = State::Playing;
161
+ }
162
+
157
163
// if we are getting the last set pair, we might have some pending endings
158
164
// so we make sure to end them all in ending set
159
165
if (currentIndex == maxIndex) {
@@ -173,12 +179,6 @@ class SequencePerformer : public AbstractPerformer {
173
179
return res;
174
180
}
175
181
176
- void prepareLocalState (){
177
- createAvsHistoryFromScore ();
178
- setLoopIndices (0 , (score.size () == 0 ) ? 0 : (score.size () - 1 ));
179
- setCurrentIndex (0 );
180
- }
181
-
182
182
public:
183
183
SequencePerformer () :
184
184
AbstractPerformer (), score(Chronology<noteData, std::vector>()),
0 commit comments