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
7 changes: 4 additions & 3 deletions audio/midi/fluid/sfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,10 @@ void Sample::load()
//
// now add some extra sanity checks from the SF2 spec (biased so they work with unsigned int);
// just a warning, they probably work with Fluid, possibly with audible artefacts though...
if (!(start + 7 < loopstart) || !(loopstart + 31 < loopend) || !(loopend + 7 < end))
qDebug("SoundFont(%s) Sample(%s) start(%u) startloop(%u) endloop(%u) end(%u) smaller than SoundFont 2.04 spec chapter 7.10 recommendation",
qPrintable(sf->get_name()), name, start, loopstart, loopend, end);
if (!(start + 7 < loopstart) || !(loopstart + 31 < loopend) || !(loopend + 7 < end)) {
// qDebug("SoundFont(%s) Sample(%s) start(%u) startloop(%u) endloop(%u) end(%u) smaller than SoundFont 2.04 spec chapter 7.10 recommendation",
// qPrintable(sf->get_name()), name, start, loopstart, loopend, end);
}

// this used to cause a crash
if (!data) {
Expand Down
2 changes: 1 addition & 1 deletion config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
SET(MUSESCORE_NAME "MuseScore")
SET(MUSESCORE_VERSION_MAJOR "3")
SET(MUSESCORE_VERSION_MINOR "7")
SET(MUSESCORE_VERSION_PATCH "0")
SET(MUSESCORE_VERSION_PATCH "1")
SET(MUSESCORE_VERSION_LABEL "")

message(STATUS "MUSESCORE_BUILD_CONFIG ${MUSESCORE_BUILD_CONFIG}")
Expand Down
3 changes: 0 additions & 3 deletions global/settings/types/preferencekeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
#define PREF_APP_TELEMETRY_ALLOWED "application/telemetry/allowed"
#define PREF_APP_BACKUP_GENERATE_BACKUP "application/backup/generateBackup"
#define PREF_APP_BACKUP_SUBFOLDER "application/backup/subfolder"
#define PREF_APP_SHOW_PROGRESS_LAYOUT "application/show/progressBar/layout"
#define PREF_APP_SHOW_PROGRESS_SAVE "application/show/progressBar/save"
#define PREF_APP_SHOW_PROGRESS_AUTOSAVE "application/show/progressBar/autosave"
#define PREF_EXPORT_AUDIO_NORMALIZE "export/audio/normalize"
#define PREF_EXPORT_AUDIO_SAMPLERATE "export/audio/sampleRate"
#define PREF_EXPORT_AUDIO_PCMRATE "export/audio/PCMRate"
Expand Down
22 changes: 11 additions & 11 deletions libmscore/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ bool Score::checkClefs()

void Measure::fillGap(const Fraction& pos, const Fraction& len, int track, const Fraction& stretch, bool useGapRests)
{
qDebug().nospace().noquote()
<< "measure " << tick().print() << " pos " << pos.print() << ", "
<< "len " << len.print() << " stretch " << stretch.print() << " track " << track;
// qDebug().nospace().noquote()
// << "measure " << tick().print() << " pos " << pos.print() << ", "
// << "len " << len.print() << " stretch " << stretch.print() << " track " << track;
TDuration d;
d.setVal(len.ticks());
if (d.isValid()) {
Expand Down Expand Up @@ -363,17 +363,17 @@ void Measure::checkMeasure(int staffIdx, bool useGapRests)
currentPos = seg->rtick() * stretch;

if (currentPos < expectedPos) {
qDebug().nospace().noquote()
<< "in measure overrun" << tick().print()
<< "at " << (currentPos/stretch).ticks() << "-" << (expectedPos/stretch).ticks()
<< " track " << track;
// qDebug().nospace().noquote()
// << "in measure overrun" << tick().print()
// << "at " << (currentPos/stretch).ticks() << "-" << (expectedPos/stretch).ticks()
// << " track " << track;
break;
}
else if (currentPos > expectedPos) {
qDebug().nospace().noquote()
<< "in measure underrun " << tick().print()
<< " at " << (currentPos/stretch).ticks() << "-" << (expectedPos/stretch).ticks()
<< " track " << track;
// qDebug().nospace().noquote()
// << "in measure underrun " << tick().print()
// << " at " << (currentPos/stretch).ticks() << "-" << (expectedPos/stretch).ticks()
// << " track " << track;
fillGap(expectedPos, currentPos - expectedPos, track, stretch);
}

Expand Down
14 changes: 10 additions & 4 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ void CmdState::setTick(TickType tt, const Fraction& t)
_startTick = t;
else if (tt == TickType::EndTick)
_endTick = t;
else
_startTick = _endTick = t;

setUpdateMode(UpdateMode::Layout);
}
Expand Down Expand Up @@ -300,10 +302,14 @@ void Score::endCmd(bool rollback)

void CmdState::dump()
{
qDebug("CmdState: mode %d %d-%d", int(_updateMode), _startTick.ticks(), _endTick.ticks());
qDebug().noquote().nospace()
<< "CmdState: mode " << int(_updateMode) << " " << _startTick.print() << "-" << _endTick.print() << " "
<< (_el ? _el->name() : "no element") << " "
<< (_el ? _el->tick().print() : "") << " "
<< "mbase: " << (_mb ? _mb->index() : 0)
;
// bool _excerptsChanged { false };
// bool _instrumentsChanged { false };

}
#endif

Expand All @@ -320,8 +326,8 @@ void Score::update(bool resetCmdState)
CmdState& cs = ms->cmdState();
Fraction layoutStart = cs.startTick();
Fraction layoutEnd = cs.endTick();

if (auto singleElement = cs.element()) {
const auto singleElement = cs.element();
if (singleElement) {
if (singleElement->isFingering() ||
singleElement->isArticulation()) {
layoutEntirePage = true;
Expand Down
35 changes: 10 additions & 25 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ void LayoutContext::layoutArticAndFingeringOnCrossStaffBeams(System* system)
void LayoutContext::layoutPage(Page* page, qreal restHeight, qreal footerPadding)
{
if (restHeight < 0.0) {
qDebug("restHeight < 0.0: %f\n", restHeight);
// qDebug("restHeight < 0.0: %f\n", restHeight);
restHeight = 0;
}

Expand Down Expand Up @@ -5704,36 +5704,20 @@ void LayoutContext::layout()
{
MeasureBase* lmb;

QProgressDialog progress;
const bool layoutAll = (startTick <= Fraction(0,1) && (endTick < Fraction(0,1) || endTick >= score->last()->endTick()));

const bool showProgress = (MScore::showProgressBarForLayout && layoutAll) || (MScore::showProgressBarForPartialLayout);
if (showProgress) {
const int totalMeasures = score->measures() ? score->measures()->size() : 0;
QString label;
if (layoutAll)
label = QObject::tr("Performing full layout") + QObject::tr(" for") + ":\n" + score->title() + "…";
else
label = QObject::tr("Performing partial layout between ") + startTick.print() + " and " + endTick.print()
+ QObject::tr(" for") + ":\n" + score->title() + "…";

progress.setLabelText(label);
progress.setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
progress.setRange(0, totalMeasures);
progress.setCancelButton(nullptr);
progress.setWindowModality(Qt::WindowModal);
progress.setValue(0);
progress.setMinimumDuration(0);
}
const int min = 0;
const int max = score->measures() ? score->measures()->size() : 0;
const QString progressFormat = "Layout: %p%";
int progressValue = min;
emit score->updateProgress(progressFormat, min, min, max);

do {
getNextPage();
collectPage();

if (page && !page->systems().isEmpty()) {
lmb = page->systems().back()->measures().back();
if (showProgress)
progress.setValue(lmb->index());
progressValue = lmb->index();
emit score->updateProgress(progressFormat, progressValue, min, max);
}
else
lmb = nullptr;
Expand All @@ -5750,7 +5734,8 @@ void LayoutContext::layout()
} while (curSystem && !(rangeDone && lmb == pageOldMeasure));
// && page->system(0)->measures().back()->tick() > endTick // FIXME: perhaps the first measure was meant? Or last system?

progress.close();
if (progressValue != max)
emit score->updateProgress(progressFormat, max, min, max);

if (!curSystem) {
// The end of the score. The remaining systems are not needed...
Expand Down
5 changes: 0 additions & 5 deletions libmscore/mscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ bool MScore::showSystemBoundingRect = false;
bool MScore::showCorruptedMeasures = true;
bool MScore::useFallbackFont = true;

bool MScore::showProgressBarForLayout = true;
bool MScore::showProgressBarForPartialLayout = false;
bool MScore::showProgressBarForSave = true;
bool MScore::showProgressBarForAutosave = true;

bool MScore::saveTemplateMode = false;
bool MScore::noGui = false;

Expand Down
5 changes: 0 additions & 5 deletions libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,6 @@ class MScore {
static bool debugMode;
static bool testMode;

static bool showProgressBarForLayout;
static bool showProgressBarForPartialLayout;
static bool showProgressBarForSave;
static bool showProgressBarForAutosave;

static int division;
static int sampleRate;
static int mtcType;
Expand Down
22 changes: 13 additions & 9 deletions libmscore/rendermidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2643,33 +2643,37 @@ void MidiRenderer::renderScore(EventMap* events, const Context& ctx)

int currentChunk = 0;
QProgressDialog progress;
if (MScore::showProgressBarForLayout) {
const int totalChunks = chunks.size();
QString label = QObject::tr("Rendering MIDI events") + " "
const int min = 0;
const int max = chunks.size();
const QString& progressFormat = "Rendering MIDI: %p%";
emit score->updateProgress(progressFormat, min, min, max);

// When loading score, allow early termination, but not if in some other ctx
if (ScoreLoad::loading() ) {
QString label = QObject::tr("Loading score") + ": " + QObject::tr("Rendering MIDI events") + " "
+ QObject::tr("for") + ":\n"
+ score->title() + "…\n"
+ QObject::tr("Safe to cancel early");
+ QObject::tr("Cancelling is safe");

progress.setLabelText(label);
progress.setCancelButtonText(QObject::tr("Cancel"));
progress.setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint));
progress.setRange(0, totalChunks);
progress.setRange(min, max);
progress.setWindowModality(Qt::WindowModal);
progress.setValue(0);
progress.setMinimumDuration(2500);
}

for (const Chunk& chunk : chunks) {
if (MScore::showProgressBarForLayout) {
progress.setValue(++currentChunk);
// Allow user to prematurely break rendering:
emit score->updateProgress(progressFormat, ++currentChunk, min, max);
progress.setValue(currentChunk);
if (progress.wasCanceled())
break;
}

renderChunk(chunk, events, ctx);
}
progress.close();
emit score->updateProgress(progressFormat, max, min, max);
}

void MidiRenderer::renderChunk(const Chunk& chunk, EventMap* events, const Context& ctx)
Expand Down
4 changes: 2 additions & 2 deletions libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4386,7 +4386,7 @@ ChordRest* Score::findCR(Fraction tick, int track) const
{
Measure* m = tick2measureMM(tick);
if (!m) {
qDebug("findCR: no measure for tick %d", tick.ticks());
// qDebug("findCR: no measure for tick %d", tick.ticks());
return nullptr;
}
// attach to first rest all spanner when mmRest
Expand Down Expand Up @@ -4422,7 +4422,7 @@ ChordRest* Score::findCRinStaff(const Fraction& tick, int staffIdx) const
Fraction ptick = tick - Fraction::fromTicks(1);
Measure* m = tick2measureMM(ptick);
if (!m) {
qDebug("findCRinStaff: no measure for tick %d", ptick.ticks());
// qDebug("findCRinStaff: no measure for tick %d", ptick.ticks());
return 0;
}
// attach to first rest all spanner when mmRest
Expand Down
2 changes: 2 additions & 0 deletions libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ enum class UpdateMode {
enum class TickType { // for explicit cmdState updates
StartTick,
EndTick,
StartAndEndTick,
};

//---------------------------------------------------------
Expand Down Expand Up @@ -593,6 +594,7 @@ class Score : public QObject, public ScoreElement {
signals:
void posChanged(POS, unsigned, bool);
void playlistChanged();
void updateProgress(const QString&, int, int, int);

public:
Score();
Expand Down
51 changes: 29 additions & 22 deletions libmscore/scorefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,25 +220,12 @@ void Score::writeMovement(XmlWriter& xml, bool selectionOnly)
xml.setCurTrack(0);
xml.setTrackDiff(-staffStart * VOICES);
if (measureStart) {

// progress bar
const bool showOnSave = (!isAutosaving() && MScore::showProgressBarForSave);
const bool showOnAutosave = (isAutosaving() && MScore::showProgressBarForAutosave);
int currentMeasureIdx = 0;
QProgressDialog progress;
if (showOnSave || showOnAutosave) {
int totalMeasuresByStaff = (staffEnd - staffStart) * score()->measures()->size();
QString label = (showOnAutosave ? QObject::tr("Performing Autosave")
: QObject::tr("Save File")) + ":\n"
+ score()->title() + "…";
progress.setLabelText(label);
progress.setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::FramelessWindowHint));
progress.setCancelButton(nullptr);
progress.setRange(0, totalMeasuresByStaff);
progress.setWindowModality(Qt::WindowModal);
progress.setValue(0);
progress.setMinimumDuration(0);
}
const int totalMeasuresByStaff = (staffEnd - staffStart) * score()->measures()->size();
const int min = 0;
const int max = totalMeasuresByStaff;
const QString& progressFormat = isAutosaving() ? "Autosave: %p%" : "Saving: %p%";
emit updateProgress(progressFormat, min, min, max);

for (int staffIdx = staffStart; staffIdx < staffEnd; ++staffIdx) {
xml.stag(staff(staffIdx), QString("id=\"%1\"").arg(staffIdx + 1 - staffStart));
Expand All @@ -259,16 +246,14 @@ void Score::writeMovement(XmlWriter& xml, bool selectionOnly)
forceTimeSig = false;
}

if (showOnSave || showOnAutosave)
progress.setValue(++currentMeasureIdx);
emit updateProgress(progressFormat, ++currentMeasureIdx, min, max);

// Largest consumption of time for file-saving:
writeMeasure(xml, m, staffIdx, writeSystemElements, forceTimeSig);
}
xml.etag();
}

progress.close();
emit updateProgress(progressFormat, max, min, max);
}
xml.setCurTrack(-1);
if (isMaster()) {
Expand Down Expand Up @@ -1191,6 +1176,28 @@ void Score::print(QPainter* painter, int pageNo)
painter->restore();
}
}

// PASS #4 Always draw noteheads with information inside them (Solfegge/Pitch) on top of ledger/staff lines
// NOTE: Must be manually applied and not AUTO Notehead with staff properties, otherwise BehindStaff+BehindLedger
// will still be honored
if (MScore::noteheadsBehindStaff || MScore::noteheadsBehindLedger) {
for (const Element* e : elements) {
if (!e->isNote())
continue;
if (!e->visible())
continue;

auto n = toNote(e);
if (!n->onTabStaff() && !n->headSchemeHasAlphaNumerics())
continue;

painter->save();
painter->translate(e->pagePos());
e->draw(painter);
painter->translate(-e->pagePos());
painter->restore();
}
}
MScore::pdfPrinting = false;
_printing = false;
}
Expand Down
Loading
Loading