Fix gpconverter adds extra points for the same bend

This commit is contained in:
mikekirin 2023-04-25 14:53:25 +02:00
parent 5cda56428e
commit 2ee328489f
2 changed files with 15 additions and 1 deletions

View file

@ -1911,6 +1911,10 @@ void GPConverter::addBend(const GPNote* gpnote, Note* note)
return;
}
if (gpnote->bend()->isEmpty()) {
return;
}
auto gpTimeToMuTime = [] (float time) {
return time * PitchValue::MAX_TIME / 100;
};
@ -1947,7 +1951,7 @@ void GPConverter::addBend(const GPNote* gpnote, Note* note)
if (gpBend->middleOffset1 == -1 && gpBend->middleOffset2 == -1 && gpBend->middleValue != -1) {
//!@NOTE It seems when middle point is places exactly in the middle
//!of bend GP6 stores this value equal -1
if (gpBend->destinationOffset > 50 || gpBend->destinationOffset == -1) {
if (gpBend->destinationOffset > 50) {
bend->points().push_back(PitchValue(gpTimeToMuTime(50), gpBend->middleValue));
}
}

View file

@ -63,6 +63,16 @@ public:
float middleValue{ -1 };
float originOffset{ -1 };
float originValue{ -1 };
bool isEmpty() const
{
return destinationValue == -1
&& destinationOffset == -1
&& middleValue == -1
&& middleOffset1 == -1
&& middleOffset2 == -1
&& originOffset == -1
&& originValue == -1;
}
};
struct Trill {
int auxillaryFret{ -1 };