++musescore3 (3.2.3+dfsg2-11) unstable; urgency=medium
++
++ * Fix soundfont-related crashes or audible artefacts (Closes: #985129)
++
++ -- Thorsten Glaser <tg@mirbsd.de> Sun, 14 Mar 2021 19:37:23 +0100
++
+musescore3 (3.2.3+dfsg2-10) unstable; urgency=medium
+
+ * Merge musescore2 (2.3.2+dfsg4-14) unstable; urgency=medium
+ - fixes rare error in m3-common.prerm (Closes: #984592)
+
+ -- Thorsten Glaser <tg@mirbsd.de> Fri, 05 Mar 2021 17:59:50 +0100
+
+musescore3 (3.2.3+dfsg2-9) unstable; urgency=medium
+
+ * backports/plugin-parent.diff: fix crash when traversing from
+ an Element through its parents (in a QML plugin): missing
+ NULL return when the element has no parent
+ * upstream/sprintf.diff: fix (unlikely) sprintf overflow
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 11 Feb 2021 02:21:26 +0100
+
+musescore3 (3.2.3+dfsg2-8) unstable; urgency=medium
+
+ * Sync SMuFL update to upstream
+ * Merge musescore2 (2.3.2+dfsg4-12) unstable; urgency=medium
+ - Fix CFLAGS/CXXFLAGS extras to disable upstream-only warnings
+ - Update list of MScore.ttf copyright holders again, document
+ - Explicitly debundle GNU FreeFont
+ - Switch debian/watch to api.github.com to list more tags
+ - Modernise maintainer scripts from jupp (template)
+ - Bump Policy (no changes relevant for us)
+ - Update lintian overrides
+ * Merge patches from upstream or submitted:
+ - do not delete courtesy accidentals on octave changes
+ - allow mid-score staff name changes
+ - fix crash hiding palettes (F9)
+ - various plugin-related fixes
+ - expose Score.selection object to access elements selected in GUI
+ - add removeElement API and restore Chord.{add,remove} for plugins
+ * Update patch submission/merge status/metadata
+ * Fix pattern order in debian/copyright and document deviations
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 01 Feb 2021 01:04:50 +0100
+
+musescore3 (3.2.3+dfsg1-7) unstable; urgency=medium
+
+ * Address QA warning in AppData
+ * Quell another debugging output
+ * Update musical font against latest PR sent upstream
+ * Also indicate tuning, on/off time in the status line
+ * Update SMuFL data (but keep same version) matching PR submitted
+ * Fix rendering of parenthesised accidentals
+ * Update lintian overrides
+
+ -- Thorsten Glaser <tg@mirbsd.de> Sun, 25 Oct 2020 06:45:12 +0100
+
+musescore3 (3.2.3+dfsg1-6) unstable; urgency=low
+
+ * Merge musescore2 (2.3.2+dfsg3-9) unstable; urgency=medium
+ - Document the situation with musescore{,3,4} in Description
+ * Update older changelog to mention need to avoid linking libssl
+ * Merge musescore2 (2.3.2+dfsg3-10) unstable; urgency=low
+ - reproducible builds: timezone-local stamps in PKZIP archives
+ * Rename source package to musescore3 for symmetry
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 06 Aug 2020 14:46:47 +0200
+
+musescore (3.2.3+dfsg1-5exp1) experimental; urgency=medium
+
+ * Upload to experimental, again with the revert restriking patch
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 30 Jul 2020 20:35:58 +0200
+
+musescore (3.2.3+dfsg1-5) unstable; urgency=high
+
+ * Merge musescore2 (2.3.2+dfsg3-8) wtf; urgency=low
+ - Bump Policy (nothing relevant), debhelper
+ - Remove dependencies on Qt SQL library which are unneeded
+ - Fix DEP 5 format: repacking notice must be in Source, not a Comment
+ - Update patches (forwarding information / releases fixed)
+ - Drop home-grown umask fixup code, dh does this nowadays
+ - Use dh’s new execute_{before,after}_* overrides
+ - Work around #796257 to fix Debian reproducible builds
+ - Don’t show irrelevant Qt5 deprecation warnings; upstream’s to fix
+ - Forward and apply fixes by lintian
+ * Add some patches from upstream:
+ - Fix warning when loading custom workspaces
+ - Allow building against Qt 5.14 (Closes: #964641)
+ - Fix rendering of emboldened fonts
+ - Numerous crash, playback, layout and other bugfixes
+ * Update copyright info (Debian and patches from upstream/submissions)
+ - a new CLA seems to be used since 2019…
+ * SMuFL: fix typo
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 30 Jul 2020 20:24:17 +0200
+
+musescore (3.2.3+dfsg1-4exp1) experimental; urgency=medium
+
+ * The “Zintermäärtes” upload, go “schnörzen” now ☺
+ * Upload to experimental, again with the revert restriking patch
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 11 Nov 2019 00:00:19 +0100
+
+musescore (3.2.3+dfsg1-4) unstable; urgency=medium
+
+ * Apply workaround for broken directory bookmarks in file dialogue
+ * (Yes I know 3.3’s out, I will be packaging it shortly)
+ * Merge musescore2 (2.3.2+dfsg3-7) wtf; urgency=low
+ * Upload to sid again without the revert restriking patch
+ * Add new features from 3.2 to the package description
+
+ -- Thorsten Glaser <tg@mirbsd.de> Sun, 10 Nov 2019 22:54:07 +0100
+
+musescore (3.2.3+dfsg1-3exp1) experimental; urgency=medium
+
+ * Upload to experimental, again with the revert restriking patch
+ * Use the Debian packaging of freefont, do not bundle it
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 30 Oct 2019 15:37:20 +0100
+
+musescore (3.2.3+dfsg1-3) unstable; urgency=high
+
+ * Fix crash on reading preferences files containing unrecognised
+ entries (such as these from a later otherwise compatible version)
+ * Update lintian override: a false positive is no longer present
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 30 Oct 2019 15:36:22 +0100
+
+musescore (3.2.3+dfsg1-2exp1) experimental; urgency=low
+
+ * Upload to experimental, again with the revert restriking patch
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 30 Sep 2019 02:32:24 +0200
+
+musescore (3.2.3+dfsg1-2) unstable; urgency=low
+
+ * Upload to unstable, again without the restriking patch
+ * Merge musescore (3.2.3+dfsg1-1exp1) experimental; urgency=low
+ - pull another post-release bugfix from upstream
+ * Set umask 022 for reproducibility
+ * Merge musescore2 (2.3.2+dfsg3-6) wtf; urgency=low
+ - updates d/copyright with more historic info + formatting
+ - modernising and correcing packaging
+ - runs test in UTF-8 locale, lile build
+ - add -g3 to optdbg builds
+ - Policy 4.4.1 (no changes)
+ * Fix misspelt translation
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 30 Sep 2019 01:18:56 +0200
+
+musescore (3.2.3+dfsg1-1exp1) experimental; urgency=low
+
+ * Upload to experimental, again with the revert restriking patch
+ * Pull another post-release bugfix from upstream
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 10 Jul 2019 18:57:24 +0200
+
+musescore (3.2.3+dfsg1-1) unstable; urgency=low
+
+ * Fix About when build number is empty (cosmetic)
+ * Merge musescore2 (2.3.2+dfsg3-5) wtf; urgency=low
+ * New upstream release
+ * Upload to unstable, with the revert restriking patch disabled
+ * Fix building with disabled plugins (needed to build on stretch)
+ * Small cosmetic fix for About dialogue and --long-version
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 10 Jul 2019 03:22:28 +0200
+
+musescore (3.2.2+dfsg1-1) experimental; urgency=medium
+
+ * New upstream release
+ * Merge musescore-snapshot (3.1+dfsg1-1) experimental; urgency=medium
+ * Drop merged patches, update patches
+ * Merge musescore2 (2.3.2+dfsg3-4) wtf; urgency=low
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 04 Jul 2019 23:55:01 +0200
+
+musescore-snapshot (3.1+dfsg1-1) experimental; urgency=medium
+
+ * New upstream release, repackaged as snapshot for integration work
+ * Apply four post-release bugfixes: three from master, one from the
+ musescore.com backend branch that’s not… yet(?) there
+ * Update description with new features from 3.0 and 3.1
+ * Merge musescore2 (2.3.2+dfsg3-2) wtf; urgency=medium
+ * Supplement the AppStream metadata with the new release
+ * Fix charset used by local plugin docs
+ * Register plugin documentation with doc-base
+ * Note known bug https://musescore.org/en/node/290147
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 03 Jun 2019 23:42:38 +0200
+
+musescore-snapshot (3.1~pre20190412+dfsg1-1) experimental; urgency=low
+
+ * New upstream snapshot “v3.1beta”
+ * Merge musescore (3.0.5+dfsg1-2) experimental; urgency=low
+ * Generate and install full plugin documentation locally
+ * Merge musescore (3.0.5+dfsg1-3) experimental; urgency=low
+
+ -- Thorsten Glaser <tg@mirbsd.de> Fri, 19 Apr 2019 22:24:42 +0200
+
+musescore-snapshot (3.1~pre20190227+dfsg1-1) experimental; urgency=low
+
+ * Revert to tracking “git master” snapshots now 3.0.x was branched
+ * New upstream snapshot; drop applied and refresh remaining patches
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 27 Feb 2019 21:01:07 +0100
+
+musescore (3.0.5+dfsg1-3) experimental; urgency=low
+
+ * Merge musescore (2.3.2+dfsg2-6) unstable; urgency=medium
+ * Mark more patches as applied upstream
+ * Adopt package description marker distinguishing from castling branch
+ * Update AppData PR patch
+ * Add a few crash fix patches until 3.1 is out
+ * Clarify the Qt 5.7 patch use in stretch-backports-sloppy *only*
+ * Apply recommended settings of debhelper 12
+
+ -- Thorsten Glaser <tg@mirbsd.de> Sat, 04 May 2019 01:55:53 +0200
+
+musescore (3.0.5+dfsg1-2) experimental; urgency=low
+
+ * Merge musescore (2.3.2+dfsg2-5) unstable; urgency=medium
+ * Update patches and pull three new bugfix patches from upstream
+ * Stop suggesting old tiny soundfonts: we pull in a suitable, large
+ one (with better UX) already, and the user can install any SF2/SF3
+ or SFZ one by themselves
+ * Use the same soundfont as upstream does, for fresh installations
+ * Workaround for DEP 5 syntax in a complex case
+ * Fix share/plugins/notenames.qml copyright years
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 17 Apr 2019 23:33:14 +0200
+
+musescore (3.0.5+dfsg1-1) experimental; urgency=medium
+
+ * New upstream version, targetting experimental until AFTER buster release
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 13 Mar 2019 17:52:48 +0100
+
+musescore (3.0.4+dfsg1-1) experimental; urgency=low
+
+ * New upstream version, targetting experimental until AFTER buster release
+ * Remove applied patches
+ * Fix upstream release notes link
+ * Apply a reproducibility fix merged in upstream 3.1
+ * Automate skipping the testsuite for too-old Qt5, easing backports/PPA
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 07 Mar 2019 22:48:58 +0100
+
+musescore (3.0.3+dfsg1-1) experimental; urgency=low
+
+ * Merge from the musescore-snapshot package but rename it back
+ * Rename binary packages to musescore3{,-common} for coïnstallability
+ (musescore{,-common} 2.x will stay around for buster’s lifetime, and
+ upstream says users should have both in parallel, for existing scores)
+ * New upstream version, targetting experimental until AFTER buster release
+ * Apply upstream patch to fix sound to not always be piano + some crashes
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 27 Feb 2019 20:02:56 +0100
+
+musescore-snapshot (3.0.2+dfsg1-3) experimental; urgency=high
+
+ * Backport proposed fixes for saving text colours and flipping lyrics
+
+ -- Thorsten Glaser <tg@mirbsd.de> Mon, 18 Feb 2019 00:34:31 +0100
+
+musescore-snapshot (3.0.2+dfsg1-2) experimental; urgency=medium
+
+ * Mark patches as applied upstream
+ * Allow manually debugging xvfb testsuite runner
+ * Make up a $HOME directory which the testsuite can use
+
+ -- Thorsten Glaser <tg@mirbsd.de> Thu, 07 Feb 2019 19:07:46 +0100
+
+musescore-snapshot (3.0.2+dfsg1-1) experimental; urgency=medium
+
+ * Fix failing tst_runscripts
+ * Allow MuseJazz fonts back in, the source code situation was cleared
+ * Backport another FTBFS fix
+ * New upstream release
+ - update copyright
+ - refresh all patches and PRs
+ * Fix non-constant format string (-Wformat-security)
+ * Slight env cleanup for the tests (tbf within pbuilder)
+
+ -- Thorsten Glaser <tg@mirbsd.de> Wed, 06 Feb 2019 21:07:52 +0100
+
+musescore-snapshot (3.0.1+dfsg1-2) experimental; urgency=low
+
+ * Fix XDG_DATA_HOME subpath location in the manpage
+ * Merge changes from musescore (2.3.2+dfsg2-3)
+ * Update upstream submission status of, and the patches themselves
+
+ -- Thorsten Glaser <tg@mirbsd.de> Sun, 27 Jan 2019 17:06:00 +0100
+
+ musescore2 (2.3.2+dfsg4-15) unstable; urgency=medium
+
+ * Fix soundfont-related crashes or audible artefacts (Closes: #985129)
+
+ -- Thorsten Glaser <tg@mirbsd.de> Sun, 14 Mar 2021 18:17:41 +0100
+
musescore2 (2.3.2+dfsg4-14) unstable; urgency=medium
* Fix possible error cause in m-common.prerm (Closes: #984592)
--- /dev/null
-@@ -589,6 +589,7 @@ Sample::Sample(SFont* s)
+ Description: Fix multiple possible causes of crashes or audible artefacts
+ - Track sample name so we can issue proper warning messages, show filename
+ - On read errors, issue an error message and mark sample as invalid
+ - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails
+ - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end;
+ only switch end to point to the last sample afterwards in only one place
+ - Add sanity check provided by the SoundFont spec as extra warning
+ - Do not crash if there is no data[]
+ - Issue diagnostics if disabling a sample
+ - Swap two members to improve structure packing/alignment while there
+ - Use unsigned integers for SoundFont element sizes properly
+ Author: mirabilos <m@mirbsd.org>
+ Bug: https://musescore.org/en/node/89216 (and probably others)
+ Bug-Debian: https://bugs.debian.org/985129
+ Forwarded: tbd
+
+ --- a/fluid/sfont.cpp
+ +++ b/fluid/sfont.cpp
-@@ -625,11 +626,12 @@ void Sample::load()
- #ifdef SOUNDFONT3
- char* p = new char[size];
- if (fd.read(p, size) != size) {
-- printf(" read %d failed\n", size);
- delete[] p;
++@@ -610,6 +610,7 @@ Sample::Sample(SFont* s)
+ data = 0;
+ amplitude_that_reaches_noise_floor_is_valid = false;
+ amplitude_that_reaches_noise_floor = 0.0;
+ + name[0] = 0;
+ }
+
+ //---------------------------------------------------------
-- decompressOggVorbis(p, size);
-+ setValid(decompressOggVorbis(p, size));
- delete[] p;
++@@ -647,18 +648,22 @@ void Sample::load()
++ std::vector<char> p;
++ p.resize(size);
++ if (fd.read(p.data(), size) != size) {
++- qDebug("read %d failed", size);
+ + qWarning("SoundFont(%s) Sample(%s) read %u bytes failed", qPrintable(sf->get_name()), name, size);
+ + setValid(false);
+ return;
+ }
-@@ -637,8 +639,11 @@ void Sample::load()
++- decompressOggVorbis(p.data(), size);
+++ setValid(decompressOggVorbis(p.data(), size));
+ #endif
+ }
-@@ -652,11 +657,34 @@ void Sample::load()
++ else {
+ data = new short[size];
+ size *= sizeof(short);
+
+ - if (fd.read((char*)data, size) != size)
+ + if (fd.read((char*)data, size) != size) {
+ + qWarning("SoundFont(%s) Sample(%s) read %u bytes failed", qPrintable(sf->get_name()), name, size);
+ + setValid(false);
+ return;
+ + }
+
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ unsigned char hi, lo;
-@@ -725,6 +753,8 @@ bool SFont::load()
++@@ -672,11 +677,34 @@ void Sample::load()
+ data[i] = s;
+ }
+ }
+ - end -= (start + 1); // marks last sample, contrary to SF spec.
+ + end -= start;
+ loopstart -= start;
+ loopend -= start;
+ start = 0;
+ }
+ +
+ + // sanity checks:
+ + // - start < end in SFont::load_shdr(int)
+ + // - start < loopstart < loopend < end for !SF3 ibidem
+ + // - … for SF3 in Sample::decompressOggVorbis(char *, unsigned int) in sfont3.cpp
+ + // - most importantly, they are done *before* start is normalised to 0, which it is at this point
+ + //
+ + // 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))
+ + qWarning("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) {
+ + qWarning("SoundFont(%s) Sample(%s) data is nil", qPrintable(sf->get_name()), name);
+ + setValid(false);
+ + }
+ +
+ + // from here, end marks the last sample, not one past as in the SF2 spec
+ + if (end > 0)
+ + end -= 1;
+ +
+ optimize();
+ }
+
-@@ -1599,9 +1629,7 @@ void SFont::load_shdr (int size)
++@@ -745,6 +773,8 @@ bool SFont::load()
+ }
+ SFChunk chunk;
+
+ + // so that any subsequent errors can be attributed to the right file
+ + qDebug("Loading soundfont: %s", qPrintable(f.fileName()));
+ try {
+ readchunk(&chunk);
+ if (chunkid(chunk.id) != RIFF_ID)
-@@ -1616,16 +1644,19 @@ void SFont::load_shdr (int size)
++@@ -1624,9 +1654,7 @@ void SFont::load_shdr (int size)
+ for (int i = 0; i < size; i++) {
+ Sample* p = new Sample(this);
+ sample.append(p);
+ - char buffer[21];
+ - READSTR (buffer);
+ - // READSTR (p->name);
+ + READSTR (p->name);
+ READD (p->start);
+ READD (p->end); /* - end, loopstart and loopend */
+ READD (p->loopstart); /* - will be checked and turned into */
-@@ -1636,8 +1667,10 @@ void SFont::load_shdr (int size)
++@@ -1641,16 +1669,19 @@ void SFont::load_shdr (int size)
+ continue;
+ }
+ if ((p->end > getSamplesize()) || (p->start > (p->end - 4))) {
+ - qWarning("Sample start/end file positions are invalid, disabling");
+ + qWarning("Sample(%s) start/end file positions are invalid, disabling", p->name);
+ p->setValid(false);
+ continue;
+ }
+ p->setValid(true);
+ if (p->sampletype & FLUID_SAMPLETYPE_OGG_VORBIS) {
+ + // done in Sample::decompressOggVorbis in sfont3.cpp
+ }
+ else {
+ // loop is fowled?? (cluck cluck :)
+ if (p->loopend > p->end || p->loopstart >= p->loopend || p->loopstart <= p->start) {
+ + qWarning("Sample(%s) start(%u) startloop(%u) endloop(%u) end(%u) fowled (broken soundfont?), fixing up",
+ + p->name, p->start, p->loopstart, p->loopend, p->end);
+ /* can pad loop by 8 samples and ensure at least 4 for loop (2*8+4) */
+ if ((p->end - p->start) >= 20) {
+ p->loopstart = p->start + 8;
-@@ -147,8 +147,10 @@ class Sample {
++@@ -1661,8 +1692,10 @@ void SFont::load_shdr (int size)
+ p->loopend = p->end - 1;
+ }
+ }
+ - if ((p->end - p->start) < 8)
+ + if ((p->end - p->start) < 8) {
+ + qWarning("Sample(%s) too small, disabling", p->name);
+ p->setValid(false);
+ + }
+ }
+ }
+ FSKIP (SFSHDRSIZE); /* skip terminal shdr */
+ --- a/fluid/sfont.h
+ +++ b/fluid/sfont.h
-@@ -159,7 +161,7 @@ class Sample {
++@@ -150,8 +150,10 @@ class Sample {
+ filled out automatically */
+ /* Set this to zero, when submitting a new sample. */
+
+ - bool amplitude_that_reaches_noise_floor_is_valid;
+ double amplitude_that_reaches_noise_floor;
+ + bool amplitude_that_reaches_noise_floor_is_valid;
+ +
+ + char name[21];
+
+ Sample(SFont*);
+ ~Sample();
-@@ -1795,7 +1795,6 @@ void Sample::optimize()
++@@ -162,7 +164,7 @@ class Sample {
+ bool valid() const { return _valid; }
+ void setValid(bool v) { _valid = v; }
+ #ifdef SOUNDFONT3
+ - bool decompressOggVorbis(char* p, int size);
+ + bool decompressOggVorbis(char* p, unsigned int size);
+ #endif
+ };
+
+ --- a/fluid/sfont3.cpp
+ +++ b/fluid/sfont3.cpp
+ @@ -10,7 +10,7 @@ namespace FluidS {
+ // decompressOggVorbis
+ //---------------------------------------------------------
+
+ -bool Sample::decompressOggVorbis(char* src, int size)
+ +bool Sample::decompressOggVorbis(char* src, unsigned int size)
+ {
+ AudioFile af;
+ QByteArray ba(src, size);
+ @@ -18,32 +18,37 @@ bool Sample::decompressOggVorbis(char* s
+ start = 0;
+ end = 0;
+ if (!af.open(ba)) {
+ - qDebug("Sample::decompressOggVorbis: open failed: %s", af.error());
+ + qDebug("SoundFont(%s) Sample(%s) decompressOggVorbis: open failed: %s", qPrintable(sf->get_name()), name, af.error());
+ return false;
+ }
+ - int frames = af.frames();
+ + unsigned int frames = af.frames();
+ data = new short[frames * af.channels()];
+ - if (frames != af.readData(data, frames)) {
+ - qDebug("Sample read failed: %s", af.error());
+ + if (frames != (unsigned int)af.readData(data, frames)) {
+ + qDebug("SoundFont(%s) Sample(%s) read failed: %s", qPrintable(sf->get_name()), name, af.error());
+ delete[] data;
+ data = 0;
+ + return false;
+ }
+ - end = frames - 1;
+ + // cf. https://musescore.org/en/node/89216#comment-1068379 and following
+ + end = frames;
+
+ - if (loopend > end ||loopstart >= loopend || loopstart <= start) {
+ + // loop is fowled?? (cluck cluck :)
+ + if (loopend > end || loopstart >= loopend || loopstart <= start) {
+ + qWarning("SoundFont(%s) Sample(%s) start(%u) startloop(%u) endloop(%u) end(%u) fowled (broken soundfont?), fixing up",
+ + qPrintable(sf->get_name()), name, start, loopstart, loopend, end);
+ /* can pad loop by 8 samples and ensure at least 4 for loop (2*8+4) */
+ if ((end - start) >= 20) {
+ loopstart = start + 8;
+ - loopend = end - 8;
+ + loopend = end - 8;
+ }
+ - else { // loop is fowled, sample is tiny (can't pad 8 samples)
+ + else { // loop is fowled, sample is tiny (can't pad 8 samples)
+ loopstart = start + 1;
+ - loopend = end - 1;
+ + loopend = end - 1;
+ }
+ }
+ if ((end - start) < 8) {
+ - qDebug("invalid sample");
+ - setValid(false);
+ + qWarning("SoundFont(%s) Sample(%s) too small, disabling", qPrintable(sf->get_name()), name);
+ + return false;
+ }
+
+ return true;
+ --- a/fluid/voice.cpp
+ +++ b/fluid/voice.cpp
-@@ -1803,7 +1802,7 @@ void Sample::optimize()
++@@ -1805,7 +1805,6 @@ void Sample::optimize()
+ signed short peak;
+ float normalized_amplitude_during_loop;
+ double result;
+ - int i;
+
+ /* ignore ROM and other(?) invalid samples */
+ if (!s->valid())
++@@ -1813,7 +1812,7 @@ void Sample::optimize()
+
+ if (!s->amplitude_that_reaches_noise_floor_is_valid) { /* Only once */
+ /* Scan the loop */
+ - for (i = (int)s->loopstart; i < (int) s->loopend; i ++) {
+ + for (size_t i = s->loopstart; i < s->loopend; i++) {
+ signed short val = s->data[i];
+ if (val > peak_max)
+ peak_max = val;