Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions src/braille/internal/braille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "engraving/dom/durationtype.h"
#include "engraving/dom/dynamic.h"
#include "engraving/dom/engravingitem.h"
#include "engraving/dom/expression.h"
#include "engraving/dom/fermata.h"
#include "engraving/dom/fingering.h"
#include "engraving/dom/hairpin.h"
Expand All @@ -50,13 +51,16 @@
#include "engraving/dom/page.h"
#include "engraving/dom/part.h"
#include "engraving/dom/pitchspelling.h"
#include "engraving/dom/rehearsalmark.h"
#include "engraving/dom/rest.h"
#include "engraving/dom/score.h"
#include "engraving/dom/segment.h"
#include "engraving/dom/slur.h"
#include "engraving/dom/spanner.h"
#include "engraving/dom/staff.h"
#include "engraving/dom/stafftext.h"
#include "engraving/dom/system.h"
#include "engraving/dom/systemtext.h"
#include "engraving/dom/tempotext.h"
#include "engraving/dom/text.h"
#include "engraving/dom/tie.h"
Expand Down Expand Up @@ -822,7 +826,7 @@
// we write the measure number
if (currentLineLength == 0) {
TextToUEBBraille textToBraille;
QString measureNumber = textToBraille.braille(QString::number(m->no() + 1)).remove(0, 1) + " ";
QString measureNumber = textToBraille.braille(QString::number(m->measureNumber() + 1)).remove(0, 1) + " ";
int measureNumberLen = measureNumber.size();
line[0] += measureNumber;
for (size_t i = 1; i < nrStaves; i++) {
Expand All @@ -836,7 +840,7 @@
}

for (size_t i = 0; i < nrStaves; ++i) {
BRAILLE_TRACE() << "Measure " << mb->no() + 1 << " Staff " << i;
BRAILLE_TRACE() << "Measure " << m->measureNumber() + 1 << " Staff " << i;

measureBraille[i] = brailleMeasure(m, static_cast<int>(i)).toUtf8();

Expand Down Expand Up @@ -1326,7 +1330,15 @@
//Render everything that is in Voice 1
for (auto seg = measure->first(); seg; seg = seg->next()) {
for (EngravingItem* annotation : seg->annotations()) {
if (annotation->isTempoText()) {
if (annotation->isExpression()) {
beiz->addEngravingItem(annotation, brailleExpressionText(toExpression(annotation), staffCount)); // Expression text is not rendered in the staff it is attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
} else if (annotation->isRehearsalMark()) {
beiz->addEngravingItem(annotation, brailleRehearsalMark(toRehearsalMark(annotation), staffCount)); // Rehearsal marks are not rendered in the staff they are attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015. // Rehearsal marks are not rendered in the staff they are attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
} else if (annotation->isStaffText()) {
beiz->addEngravingItem(annotation, brailleStaffText(toStaffText(annotation), staffCount)); // Staff text is not rendered in the staff it is attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
} else if (annotation->isSystemText()) {
beiz->addEngravingItem(annotation, brailleSystemText(toSystemText(annotation), staffCount));
} else if (annotation->isTempoText()) {
beiz->addEngravingItem(annotation, brailleTempoText(toTempoText(annotation), staffCount));
}
if (annotation->track() == staffCount * VOICES) {
Expand Down Expand Up @@ -2668,6 +2680,50 @@
return result;
}

QString Braille::brailleExpressionText(Expression* expression, int staffIdx)

Check warning on line 2683 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_x64)

unused parameter ‘staffIdx’ [-Wunused-parameter]

Check warning on line 2683 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_arm64)

unused parameter ‘staffIdx’ [-Wunused-parameter]
{
if ((!expression) || (expression->plainText().isEmpty())) {
return QString();
}

// Expression text is not rendered in the staff it is attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
resetOctave(expression->staffIdx());
return ">" + TextToUEBBraille().braille(expression->plainText());
}

QString Braille::brailleRehearsalMark(RehearsalMark* rehearsalMark, int staffIdx)

Check warning on line 2694 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_x64)

unused parameter ‘staffIdx’ [-Wunused-parameter]

Check warning on line 2694 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_arm64)

unused parameter ‘staffIdx’ [-Wunused-parameter]
{
if ((!rehearsalMark) || (rehearsalMark->plainText().isEmpty())) {
return QString();
}

resetOctave(rehearsalMark->staffIdx());
// Need a reference
return ">" + TextToUEBBraille().braille(rehearsalMark->plainText());
}

QString Braille::brailleStaffText(StaffText* staffText, int staffIdx)

Check warning on line 2705 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_x64)

unused parameter ‘staffIdx’ [-Wunused-parameter]

Check warning on line 2705 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_arm64)

unused parameter ‘staffIdx’ [-Wunused-parameter]
{
if (!staffText || staffText->plainText().isEmpty()) {
return QString();
}

// Staff text is not rendered in the staff it is attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
resetOctave(staffText->staffIdx());
return ">" + TextToUEBBraille().braille(staffText->plainText());
}

QString Braille::brailleSystemText(SystemText* systemText, int staffIdx)

Check warning on line 2716 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_x64)

unused parameter ‘staffIdx’ [-Wunused-parameter]

Check warning on line 2716 in src/braille/internal/braille.cpp

View workflow job for this annotation

GitHub Actions / build (linux_arm64)

unused parameter ‘staffIdx’ [-Wunused-parameter]
{
if (!systemText || systemText->plainText().isEmpty()) {
return QString();
}

// System text is not rendered in the staff it is attached to, but in the first staff. See 11.1.1. Page 87. Music Braille Code 2015.
resetOctave(systemText->staffIdx());
return ">" + TextToUEBBraille().braille(systemText->plainText());
}

QString Braille::brailleTempoText(TempoText* tempoText, int staffIdx)
{
if (!tempoText) {
Expand Down
9 changes: 9 additions & 0 deletions src/braille/internal/braille.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Clef;
class DurationElement;
class Dynamic;
class EngravingItem;
class Expression;
class Fermata;
class Fingering;
class Hairpin;
Expand All @@ -47,9 +48,13 @@ class Marker;
class Measure;
class MeasureRepeat;
class Note;

class RehearsalMark;
class Rest;
class Score;
class Slur;
class StaffText;
class SystemText;
class TempoText;
class TimeSig;
class Tuplet;
Expand Down Expand Up @@ -222,6 +227,10 @@ class Braille
QString brailleNote(const QString& pitchName, DurationType durationType, int dots);
QString brailleOctave(int octave);
QString brailleRest(Rest* rest);
QString brailleStaffText(StaffText* staffText, int staffIdx);
QString brailleSystemText(SystemText* systemText, int staffIdx);
QString brailleRehearsalMark(RehearsalMark* rehearsalMark, int staffIdx);
QString brailleExpressionText(Expression* expression, int staffIdx);
QString brailleTempoText(TempoText* tempoText, int staffIdx);
QString brailleTie(Chord* chord);
QString brailleTie(Note* note);
Expand Down
Loading