mirror of
https://abf.rosa.ru/djam/musescore.git
synced 2025-02-24 10:53:00 +00:00
Updated to release 2.1, replaced P5 with a fix for building without LAME support, dropped some cruft from Fedora, enabled build with system libfreetype and fixed file lists
This commit is contained in:
parent
7a44725ab1
commit
da75ad225c
6 changed files with 658 additions and 88 deletions
4
.abf.yml
4
.abf.yml
|
@ -1,4 +1,2 @@
|
|||
sources:
|
||||
MuseScore-2.0.3.zip: b03692c06e4cb4434bc09c5227289e3f0b686a38
|
||||
mscore.metainfo.xml: 2bbcdaddfd02be062e73bbd402e5780c3ec33777
|
||||
mscore.xml: a052c92204a6e25285262a945900b25627b5aebd
|
||||
MuseScore-2.1.zip: f8fcd5bda1ca2985d5c3504dd2f2ac7aeb8db3f0
|
||||
|
|
16
mscore.metainfo.xml
Normal file
16
mscore.metainfo.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright 2014 Parag Nemade <pnemade AT redhat DOT com> -->
|
||||
<component type="font">
|
||||
<id>mscore</id>
|
||||
<metadata_license>CC-BY-3.0</metadata_license>
|
||||
<name>MuseJazz</name>
|
||||
<summary>MuseScore fonts</summary>
|
||||
<description>
|
||||
<p>
|
||||
MuseScore is a free cross platform WYSIWYG music notation program.
|
||||
</p>
|
||||
</description>
|
||||
<updatecontact>pnemade_at_redhat_dot_com</updatecontact>
|
||||
<url type="homepage">http://musescore.org/en</url>
|
||||
</component>
|
||||
|
9
mscore.xml
Normal file
9
mscore.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-musescore">
|
||||
<comment>MuseScore file</comment>
|
||||
<glob pattern="*.msc"/>
|
||||
<glob pattern="*.mscx"/>
|
||||
<glob pattern="*.mscz"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
|
@ -1,59 +0,0 @@
|
|||
diff -Naur MuseScore-2.0.3-orig/CMakeLists.txt MuseScore-2.0.3/CMakeLists.txt
|
||||
--- MuseScore-2.0.3-orig/CMakeLists.txt 2016-04-01 03:46:08.000000000 +0300
|
||||
+++ MuseScore-2.0.3/CMakeLists.txt 2016-04-27 19:19:39.595201647 +0300
|
||||
@@ -621,7 +621,6 @@
|
||||
${OGG_INCDIR}
|
||||
${VORBIS_INCDIR}
|
||||
${SNDFILE_INCDIR}
|
||||
- ${LAME_INCLUDE_DIR}
|
||||
# ${FREETYPE_INCLUDE_DIRS}
|
||||
${PROJECT_SOURCE_DIR}/thirdparty/freetype/include
|
||||
)
|
||||
diff -Naur MuseScore-2.0.3-orig/mscore/file.cpp MuseScore-2.0.3/mscore/file.cpp
|
||||
--- MuseScore-2.0.3-orig/mscore/file.cpp 2016-04-01 03:46:08.000000000 +0300
|
||||
+++ MuseScore-2.0.3/mscore/file.cpp 2016-04-27 19:27:08.024177076 +0300
|
||||
@@ -1545,9 +1545,6 @@
|
||||
fl.append(tr("FLAC Audio (*.flac)"));
|
||||
fl.append(tr("Ogg Vorbis Audio (*.ogg)"));
|
||||
#endif
|
||||
-#ifdef USE_LAME
|
||||
- fl.append(tr("MP3 Audio (*.mp3)"));
|
||||
-#endif
|
||||
fl.append(tr("Standard MIDI File (*.mid)"));
|
||||
fl.append(tr("MusicXML File (*.xml)"));
|
||||
fl.append(tr("Compressed MusicXML File (*.mxl)"));
|
||||
@@ -1621,9 +1618,6 @@
|
||||
fl.append(tr("FLAC Audio (*.flac)"));
|
||||
fl.append(tr("Ogg Vorbis Audio (*.ogg)"));
|
||||
#endif
|
||||
-#ifdef USE_LAME
|
||||
- fl.append(tr("MP3 Audio (*.mp3)"));
|
||||
-#endif
|
||||
fl.append(tr("Standard MIDI File (*.mid)"));
|
||||
fl.append(tr("MusicXML File (*.xml)"));
|
||||
fl.append(tr("Compressed MusicXML File (*.mxl)"));
|
||||
@@ -1821,10 +1815,6 @@
|
||||
else if (ext == "wav" || ext == "flac" || ext == "ogg")
|
||||
rv = saveAudio(cs, fn);
|
||||
#endif
|
||||
-#ifdef USE_LAME
|
||||
- else if (ext == "mp3")
|
||||
- rv = saveMp3(cs, fn);
|
||||
-#endif
|
||||
else if (ext == "spos") {
|
||||
cs->switchToPageMode();
|
||||
// save positions of segments
|
||||
diff -Naur MuseScore-2.0.3-orig/mscore/musescore.cpp MuseScore-2.0.3/mscore/musescore.cpp
|
||||
--- MuseScore-2.0.3-orig/mscore/musescore.cpp 2016-04-01 03:46:08.000000000 +0300
|
||||
+++ MuseScore-2.0.3/mscore/musescore.cpp 2016-04-27 19:29:14.629040023 +0300
|
||||
@@ -2203,10 +2203,6 @@
|
||||
else if (fn.endsWith(".wav") || fn.endsWith(".ogg") || fn.endsWith(".flac"))
|
||||
return mscore->saveAudio(cs, fn);
|
||||
#endif
|
||||
-#ifdef USE_LAME
|
||||
- else if (fn.endsWith(".mp3"))
|
||||
- return mscore->saveMp3(cs, fn);
|
||||
-#endif
|
||||
else if (fn.endsWith(".spos")) {
|
||||
cs->switchToPageMode();
|
||||
rv = savePositions(cs, fn, true);
|
610
musescore-2.1-fix-disabling-lame-support.patch
Normal file
610
musescore-2.1-fix-disabling-lame-support.patch
Normal file
|
@ -0,0 +1,610 @@
|
|||
diff -rupN MuseScore-2.1.old/mscore/exportmp3.cpp MuseScore-2.1/mscore/exportmp3.cpp
|
||||
--- MuseScore-2.1.old/mscore/exportmp3.cpp 2017-04-27 06:14:22.000000000 +0200
|
||||
+++ MuseScore-2.1/mscore/exportmp3.cpp 2017-05-29 10:20:01.999336127 +0200
|
||||
@@ -605,288 +605,5 @@ QString MP3Exporter::getLibraryTypeStrin
|
||||
}
|
||||
#endif //mac
|
||||
|
||||
-//---------------------------------------------------------
|
||||
-// canSaveMp3
|
||||
-//---------------------------------------------------------
|
||||
-
|
||||
-bool MuseScore::canSaveMp3()
|
||||
- {
|
||||
- MP3Exporter exporter;
|
||||
- if (!exporter.loadLibrary(MP3Exporter::AskUser::NO)) {
|
||||
- qDebug("Could not open MP3 encoding library!");
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (!exporter.validLibraryLoaded()) {
|
||||
- qDebug("Not a valid or supported MP3 encoding library!");
|
||||
- return false;
|
||||
- }
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
-//---------------------------------------------------------
|
||||
-// saveMp3
|
||||
-//---------------------------------------------------------
|
||||
-
|
||||
-bool MuseScore::saveMp3(Score* score, const QString& name)
|
||||
- {
|
||||
- EventMap events;
|
||||
- score->renderMidi(&events);
|
||||
- if(events.size() == 0)
|
||||
- return false;
|
||||
-
|
||||
- MP3Exporter exporter;
|
||||
- if (!exporter.loadLibrary(MP3Exporter::AskUser::MAYBE)) {
|
||||
- QSettings settings;
|
||||
- settings.setValue("/Export/lameMP3LibPath", "");
|
||||
- if(!MScore::noGui)
|
||||
- QMessageBox::warning(0,
|
||||
- tr("Error Opening LAME library"),
|
||||
- tr("Could not open MP3 encoding library!"),
|
||||
- QString::null, QString::null);
|
||||
- qDebug("Could not open MP3 encoding library!");
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (!exporter.validLibraryLoaded()) {
|
||||
- QSettings settings;
|
||||
- settings.setValue("/Export/lameMP3LibPath", "");
|
||||
- if(!MScore::noGui)
|
||||
- QMessageBox::warning(0,
|
||||
- tr("Error Opening LAME library"),
|
||||
- tr("Not a valid or supported MP3 encoding library!"),
|
||||
- QString::null, QString::null);
|
||||
- qDebug("Not a valid or supported MP3 encoding library!");
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- // Retrieve preferences
|
||||
-// int highrate = 48000;
|
||||
-// int lowrate = 8000;
|
||||
-// int bitrate = 64;
|
||||
-// int brate = 128;
|
||||
-// int rmode = MODE_CBR;
|
||||
-// int vmode = ROUTINE_FAST;
|
||||
-// int cmode = CHANNEL_STEREO;
|
||||
-
|
||||
- int channels = 2;
|
||||
-
|
||||
- int oldSampleRate = MScore::sampleRate;
|
||||
- int sampleRate = preferences.exportAudioSampleRate;
|
||||
- exporter.setBitrate(preferences.exportMp3BitRate);
|
||||
-
|
||||
- int inSamples = exporter.initializeStream(channels, sampleRate);
|
||||
- if (inSamples < 0) {
|
||||
- if (!MScore::noGui) {
|
||||
- QMessageBox::warning(0, tr("Encoding Error"),
|
||||
- tr("Unable to initialize MP3 stream"),
|
||||
- QString::null, QString::null);
|
||||
- }
|
||||
- qDebug("Unable to initialize MP3 stream");
|
||||
- MScore::sampleRate = oldSampleRate;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- QFile file(name);
|
||||
- if (!file.open(QIODevice::WriteOnly)) {
|
||||
- if (!MScore::noGui) {
|
||||
- QMessageBox::warning(0,
|
||||
- tr("Encoding Error"),
|
||||
- tr("Unable to open target file for writing"),
|
||||
- QString::null, QString::null);
|
||||
- }
|
||||
- MScore::sampleRate = oldSampleRate;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- int bufferSize = exporter.getOutBufferSize();
|
||||
- uchar* bufferOut = new uchar[bufferSize];
|
||||
- MasterSynthesizer* synti = synthesizerFactory();
|
||||
- synti->init();
|
||||
- synti->setSampleRate(sampleRate);
|
||||
- if (MScore::noGui) { // use score settings if possible
|
||||
- bool r = synti->setState(score->synthesizerState());
|
||||
- if (!r)
|
||||
- synti->init();
|
||||
- }
|
||||
- else { // use current synth settings
|
||||
- bool r = synti->setState(mscore->synthesizerState());
|
||||
- if (!r)
|
||||
- synti->init();
|
||||
- }
|
||||
-
|
||||
- MScore::sampleRate = sampleRate;
|
||||
-
|
||||
- QProgressDialog progress(this);
|
||||
- progress.setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowTitleHint));
|
||||
- progress.setWindowModality(Qt::ApplicationModal);
|
||||
- //progress.setCancelButton(0);
|
||||
- progress.setCancelButtonText(tr("Cancel"));
|
||||
- progress.setLabelText(tr("Exporting..."));
|
||||
- if (!MScore::noGui)
|
||||
- progress.show();
|
||||
-
|
||||
- static const int FRAMES = 512;
|
||||
- float bufferL[FRAMES];
|
||||
- float bufferR[FRAMES];
|
||||
-
|
||||
- float peak = 0.0;
|
||||
- double gain = 1.0;
|
||||
- EventMap::const_iterator endPos = events.cend();
|
||||
- --endPos;
|
||||
- const int et = (score->utick2utime(endPos->first) + 1) * MScore::sampleRate;
|
||||
- const int maxEndTime = (score->utick2utime(endPos->first) + 3) * MScore::sampleRate;
|
||||
- progress.setRange(0, et);
|
||||
-
|
||||
- for (int pass = 0; pass < 2; ++pass) {
|
||||
- EventMap::const_iterator playPos;
|
||||
- playPos = events.cbegin();
|
||||
- synti->allSoundsOff(-1);
|
||||
-
|
||||
- //
|
||||
- // init instruments
|
||||
- //
|
||||
- foreach(Part* part, score->parts()) {
|
||||
- const InstrumentList* il = part->instruments();
|
||||
- for(auto i = il->begin(); i!= il->end(); i++) {
|
||||
- foreach(const Channel* a, i->second->channel()) {
|
||||
- a->updateInitList();
|
||||
- foreach(MidiCoreEvent e, a->init) {
|
||||
- if (e.type() == ME_INVALID)
|
||||
- continue;
|
||||
- e.setChannel(a->channel);
|
||||
- int syntiIdx= synti->index(score->midiMapping(a->channel)->articulation->synti);
|
||||
- synti->play(e, syntiIdx);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- int playTime = 0.0;
|
||||
-
|
||||
- for (;;) {
|
||||
- unsigned frames = FRAMES;
|
||||
- float max = 0;
|
||||
- //
|
||||
- // collect events for one segment
|
||||
- //
|
||||
- memset(bufferL, 0, sizeof(float) * FRAMES);
|
||||
- memset(bufferR, 0, sizeof(float) * FRAMES);
|
||||
- double endTime = playTime + frames;
|
||||
-
|
||||
- float* l = bufferL;
|
||||
- float* r = bufferR;
|
||||
-
|
||||
- for (; playPos != events.cend(); ++playPos) {
|
||||
- double f = score->utick2utime(playPos->first) * MScore::sampleRate;
|
||||
- if (f >= endTime)
|
||||
- break;
|
||||
- int n = f - playTime;
|
||||
- if (n) {
|
||||
- float bu[n * 2];
|
||||
- memset(bu, 0, sizeof(float) * 2 * n);
|
||||
-
|
||||
- synti->process(n, bu);
|
||||
- float* sp = bu;
|
||||
- for (int i = 0; i < n; ++i) {
|
||||
- *l++ = *sp++;
|
||||
- *r++ = *sp++;
|
||||
- }
|
||||
- playTime += n;
|
||||
- frames -= n;
|
||||
- }
|
||||
- const NPlayEvent& e = playPos->second;
|
||||
- if (e.isChannelEvent()) {
|
||||
- int channelIdx = e.channel();
|
||||
- Channel* c = score->midiMapping(channelIdx)->articulation;
|
||||
- if (!c->mute) {
|
||||
- synti->play(e, synti->index(c->synti));
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- if (frames) {
|
||||
- float bu[frames * 2];
|
||||
- memset(bu, 0, sizeof(float) * 2 * frames);
|
||||
- synti->process(frames, bu);
|
||||
- float* sp = bu;
|
||||
- for (unsigned i = 0; i < frames; ++i) {
|
||||
- *l++ = *sp++;
|
||||
- *r++ = *sp++;
|
||||
- }
|
||||
- playTime += frames;
|
||||
- }
|
||||
-
|
||||
- if (pass == 1) {
|
||||
- for (int i = 0; i < FRAMES; ++i) {
|
||||
- max = qMax(max, qAbs(bufferL[i]));
|
||||
- max = qMax(max, qAbs(bufferR[i]));
|
||||
- bufferL[i] *= gain;
|
||||
- bufferR[i] *= gain;
|
||||
- }
|
||||
- long bytes;
|
||||
- if (FRAMES < inSamples)
|
||||
- bytes = exporter.encodeRemainder(bufferL, bufferR, FRAMES , bufferOut);
|
||||
- else
|
||||
- bytes = exporter.encodeBuffer(bufferL, bufferR, bufferOut);
|
||||
- if (bytes < 0) {
|
||||
- if (MScore::noGui)
|
||||
- qDebug("exportmp3: error from encoder: %ld", bytes);
|
||||
- else
|
||||
- QMessageBox::warning(0,
|
||||
- tr("Encoding Error"),
|
||||
- tr("Error %1 returned from MP3 encoder").arg(bytes),
|
||||
- QString::null, QString::null);
|
||||
- break;
|
||||
- }
|
||||
- else
|
||||
- file.write((char*)bufferOut, bytes);
|
||||
- }
|
||||
- else {
|
||||
- for (int i = 0; i < FRAMES; ++i) {
|
||||
- max = qMax(max, qAbs(bufferL[i]));
|
||||
- max = qMax(max, qAbs(bufferR[i]));
|
||||
- peak = qMax(peak, qAbs(bufferL[i]));
|
||||
- peak = qMax(peak, qAbs(bufferR[i]));
|
||||
- }
|
||||
- }
|
||||
- playTime = endTime;
|
||||
- if (!MScore::noGui) {
|
||||
- if (progress.wasCanceled())
|
||||
- break;
|
||||
- progress.setValue((pass * et + playTime) / 2);
|
||||
- qApp->processEvents();
|
||||
- }
|
||||
- if (playTime >= et)
|
||||
- synti->allNotesOff(-1);
|
||||
- // create sound until the sound decays
|
||||
- if (playTime >= et && max * peak < 0.000001)
|
||||
- break;
|
||||
- // hard limit
|
||||
- if (playTime > maxEndTime)
|
||||
- break;
|
||||
- }
|
||||
- if (progress.wasCanceled())
|
||||
- break;
|
||||
- if (pass == 0 && peak == 0.0) {
|
||||
- qDebug("song is empty");
|
||||
- break;
|
||||
- }
|
||||
- gain = 0.99 / peak;
|
||||
- }
|
||||
-
|
||||
- long bytes = exporter.finishStream(bufferOut);
|
||||
- if (bytes > 0L)
|
||||
- file.write((char*)bufferOut, bytes);
|
||||
-
|
||||
- bool wasCanceled = progress.wasCanceled();
|
||||
- progress.close();
|
||||
- delete synti;
|
||||
- delete[] bufferOut;
|
||||
- file.close();
|
||||
- if (wasCanceled)
|
||||
- file.remove();
|
||||
- MScore::sampleRate = oldSampleRate;
|
||||
- return true;
|
||||
- }
|
||||
}
|
||||
|
||||
diff -rupN MuseScore-2.1.old/mscore/musescore.cpp MuseScore-2.1/mscore/musescore.cpp
|
||||
--- MuseScore-2.1.old/mscore/musescore.cpp 2017-04-27 06:14:22.000000000 +0200
|
||||
+++ MuseScore-2.1/mscore/musescore.cpp 2017-05-29 10:34:23.955284063 +0200
|
||||
@@ -110,6 +110,10 @@
|
||||
#include "help.h"
|
||||
#include "awl/aslider.h"
|
||||
|
||||
+#ifdef USE_LAME
|
||||
+#include "exportmp3.h"
|
||||
+#endif
|
||||
+
|
||||
#ifdef AEOLUS
|
||||
extern Ms::Synthesizer* createAeolus();
|
||||
#endif
|
||||
@@ -5022,8 +5026,303 @@ SynthesizerState MuseScore::synthesizerS
|
||||
return synti ? synti->state() : state;
|
||||
}
|
||||
|
||||
+
|
||||
+
|
||||
+//---------------------------------------------------------
|
||||
+// canSaveMp3
|
||||
+//---------------------------------------------------------
|
||||
+
|
||||
+bool MuseScore::canSaveMp3()
|
||||
+ {
|
||||
+#ifndef USE_LAME
|
||||
+ return false;
|
||||
+#else
|
||||
+ MP3Exporter exporter;
|
||||
+ if (!exporter.loadLibrary(MP3Exporter::AskUser::NO)) {
|
||||
+ qDebug("Could not open MP3 encoding library!");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (!exporter.validLibraryLoaded()) {
|
||||
+ qDebug("Not a valid or supported MP3 encoding library!");
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+//---------------------------------------------------------
|
||||
+// saveMp3
|
||||
+//---------------------------------------------------------
|
||||
+
|
||||
+bool MuseScore::saveMp3(Score* score, const QString& name)
|
||||
+ {
|
||||
+#ifndef USE_LAME
|
||||
+ return false;
|
||||
+#else
|
||||
+ EventMap events;
|
||||
+ score->renderMidi(&events);
|
||||
+ if(events.size() == 0)
|
||||
+ return false;
|
||||
+
|
||||
+ MP3Exporter exporter;
|
||||
+ if (!exporter.loadLibrary(MP3Exporter::AskUser::MAYBE)) {
|
||||
+ QSettings settings;
|
||||
+ settings.setValue("/Export/lameMP3LibPath", "");
|
||||
+ if(!MScore::noGui)
|
||||
+ QMessageBox::warning(0,
|
||||
+ tr("Error Opening LAME library"),
|
||||
+ tr("Could not open MP3 encoding library!"),
|
||||
+ QString::null, QString::null);
|
||||
+ qDebug("Could not open MP3 encoding library!");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (!exporter.validLibraryLoaded()) {
|
||||
+ QSettings settings;
|
||||
+ settings.setValue("/Export/lameMP3LibPath", "");
|
||||
+ if(!MScore::noGui)
|
||||
+ QMessageBox::warning(0,
|
||||
+ tr("Error Opening LAME library"),
|
||||
+ tr("Not a valid or supported MP3 encoding library!"),
|
||||
+ QString::null, QString::null);
|
||||
+ qDebug("Not a valid or supported MP3 encoding library!");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Retrieve preferences
|
||||
+ // int highrate = 48000;
|
||||
+ // int lowrate = 8000;
|
||||
+ // int bitrate = 64;
|
||||
+ // int brate = 128;
|
||||
+ // int rmode = MODE_CBR;
|
||||
+ // int vmode = ROUTINE_FAST;
|
||||
+ // int cmode = CHANNEL_STEREO;
|
||||
+
|
||||
+ int channels = 2;
|
||||
+
|
||||
+ int oldSampleRate = MScore::sampleRate;
|
||||
+ int sampleRate = preferences.exportAudioSampleRate;
|
||||
+ exporter.setBitrate(preferences.exportMp3BitRate);
|
||||
+
|
||||
+ int inSamples = exporter.initializeStream(channels, sampleRate);
|
||||
+ if (inSamples < 0) {
|
||||
+ if (!MScore::noGui) {
|
||||
+ QMessageBox::warning(0, tr("Encoding Error"),
|
||||
+ tr("Unable to initialize MP3 stream"),
|
||||
+ QString::null, QString::null);
|
||||
+ }
|
||||
+ qDebug("Unable to initialize MP3 stream");
|
||||
+ MScore::sampleRate = oldSampleRate;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ QFile file(name);
|
||||
+ if (!file.open(QIODevice::WriteOnly)) {
|
||||
+ if (!MScore::noGui) {
|
||||
+ QMessageBox::warning(0,
|
||||
+ tr("Encoding Error"),
|
||||
+ tr("Unable to open target file for writing"),
|
||||
+ QString::null, QString::null);
|
||||
+ }
|
||||
+ MScore::sampleRate = oldSampleRate;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ int bufferSize = exporter.getOutBufferSize();
|
||||
+ uchar* bufferOut = new uchar[bufferSize];
|
||||
+ MasterSynthesizer* synti = synthesizerFactory();
|
||||
+ synti->init();
|
||||
+ synti->setSampleRate(sampleRate);
|
||||
+ if (MScore::noGui) { // use score settings if possible
|
||||
+ bool r = synti->setState(score->synthesizerState());
|
||||
+ if (!r)
|
||||
+ synti->init();
|
||||
+ }
|
||||
+ else { // use current synth settings
|
||||
+ bool r = synti->setState(mscore->synthesizerState());
|
||||
+ if (!r)
|
||||
+ synti->init();
|
||||
+ }
|
||||
+
|
||||
+ MScore::sampleRate = sampleRate;
|
||||
+
|
||||
+ QProgressDialog progress(this);
|
||||
+ progress.setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowTitleHint));
|
||||
+ progress.setWindowModality(Qt::ApplicationModal);
|
||||
+ //progress.setCancelButton(0);
|
||||
+ progress.setCancelButtonText(tr("Cancel"));
|
||||
+ progress.setLabelText(tr("Exporting..."));
|
||||
+ if (!MScore::noGui)
|
||||
+ progress.show();
|
||||
+
|
||||
+ static const int FRAMES = 512;
|
||||
+ float bufferL[FRAMES];
|
||||
+ float bufferR[FRAMES];
|
||||
+
|
||||
+ float peak = 0.0;
|
||||
+ double gain = 1.0;
|
||||
+ EventMap::const_iterator endPos = events.cend();
|
||||
+ --endPos;
|
||||
+ const int et = (score->utick2utime(endPos->first) + 1) * MScore::sampleRate;
|
||||
+ const int maxEndTime = (score->utick2utime(endPos->first) + 3) * MScore::sampleRate;
|
||||
+ progress.setRange(0, et);
|
||||
+
|
||||
+ for (int pass = 0; pass < 2; ++pass) {
|
||||
+ EventMap::const_iterator playPos;
|
||||
+ playPos = events.cbegin();
|
||||
+ synti->allSoundsOff(-1);
|
||||
+
|
||||
+ //
|
||||
+ // init instruments
|
||||
+ //
|
||||
+ foreach(Part* part, score->parts()) {
|
||||
+ const InstrumentList* il = part->instruments();
|
||||
+ for(auto i = il->begin(); i!= il->end(); i++) {
|
||||
+ foreach(const Channel* a, i->second->channel()) {
|
||||
+ a->updateInitList();
|
||||
+ foreach(MidiCoreEvent e, a->init) {
|
||||
+ if (e.type() == ME_INVALID)
|
||||
+ continue;
|
||||
+ e.setChannel(a->channel);
|
||||
+ int syntiIdx= synti->index(score->midiMapping(a->channel)->articulation->synti);
|
||||
+ synti->play(e, syntiIdx);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int playTime = 0.0;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ unsigned frames = FRAMES;
|
||||
+ float max = 0;
|
||||
+ //
|
||||
+ // collect events for one segment
|
||||
+ //
|
||||
+ memset(bufferL, 0, sizeof(float) * FRAMES);
|
||||
+ memset(bufferR, 0, sizeof(float) * FRAMES);
|
||||
+ double endTime = playTime + frames;
|
||||
+
|
||||
+ float* l = bufferL;
|
||||
+ float* r = bufferR;
|
||||
+
|
||||
+ for (; playPos != events.cend(); ++playPos) {
|
||||
+ double f = score->utick2utime(playPos->first) * MScore::sampleRate;
|
||||
+ if (f >= endTime)
|
||||
+ break;
|
||||
+ int n = f - playTime;
|
||||
+ if (n) {
|
||||
+ float bu[n * 2];
|
||||
+ memset(bu, 0, sizeof(float) * 2 * n);
|
||||
+
|
||||
+ synti->process(n, bu);
|
||||
+ float* sp = bu;
|
||||
+ for (int i = 0; i < n; ++i) {
|
||||
+ *l++ = *sp++;
|
||||
+ *r++ = *sp++;
|
||||
+ }
|
||||
+ playTime += n;
|
||||
+ frames -= n;
|
||||
+ }
|
||||
+ const NPlayEvent& e = playPos->second;
|
||||
+ if (e.isChannelEvent()) {
|
||||
+ int channelIdx = e.channel();
|
||||
+ Channel* c = score->midiMapping(channelIdx)->articulation;
|
||||
+ if (!c->mute) {
|
||||
+ synti->play(e, synti->index(c->synti));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (frames) {
|
||||
+ float bu[frames * 2];
|
||||
+ memset(bu, 0, sizeof(float) * 2 * frames);
|
||||
+ synti->process(frames, bu);
|
||||
+ float* sp = bu;
|
||||
+ for (unsigned i = 0; i < frames; ++i) {
|
||||
+ *l++ = *sp++;
|
||||
+ *r++ = *sp++;
|
||||
+ }
|
||||
+ playTime += frames;
|
||||
+ }
|
||||
+
|
||||
+ if (pass == 1) {
|
||||
+ for (int i = 0; i < FRAMES; ++i) {
|
||||
+ max = qMax(max, qAbs(bufferL[i]));
|
||||
+ max = qMax(max, qAbs(bufferR[i]));
|
||||
+ bufferL[i] *= gain;
|
||||
+ bufferR[i] *= gain;
|
||||
+ }
|
||||
+ long bytes;
|
||||
+ if (FRAMES < inSamples)
|
||||
+ bytes = exporter.encodeRemainder(bufferL, bufferR, FRAMES , bufferOut);
|
||||
+ else
|
||||
+ bytes = exporter.encodeBuffer(bufferL, bufferR, bufferOut);
|
||||
+ if (bytes < 0) {
|
||||
+ if (MScore::noGui)
|
||||
+ qDebug("exportmp3: error from encoder: %ld", bytes);
|
||||
+ else
|
||||
+ QMessageBox::warning(0,
|
||||
+ tr("Encoding Error"),
|
||||
+ tr("Error %1 returned from MP3 encoder").arg(bytes),
|
||||
+ QString::null, QString::null);
|
||||
+ break;
|
||||
+ }
|
||||
+ else
|
||||
+ file.write((char*)bufferOut, bytes);
|
||||
+ }
|
||||
+ else {
|
||||
+ for (int i = 0; i < FRAMES; ++i) {
|
||||
+ max = qMax(max, qAbs(bufferL[i]));
|
||||
+ max = qMax(max, qAbs(bufferR[i]));
|
||||
+ peak = qMax(peak, qAbs(bufferL[i]));
|
||||
+ peak = qMax(peak, qAbs(bufferR[i]));
|
||||
+ }
|
||||
+ }
|
||||
+ playTime = endTime;
|
||||
+ if (!MScore::noGui) {
|
||||
+ if (progress.wasCanceled())
|
||||
+ break;
|
||||
+ progress.setValue((pass * et + playTime) / 2);
|
||||
+ qApp->processEvents();
|
||||
+ }
|
||||
+ if (playTime >= et)
|
||||
+ synti->allNotesOff(-1);
|
||||
+ // create sound until the sound decays
|
||||
+ if (playTime >= et && max * peak < 0.000001)
|
||||
+ break;
|
||||
+ // hard limit
|
||||
+ if (playTime > maxEndTime)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (progress.wasCanceled())
|
||||
+ break;
|
||||
+ if (pass == 0 && peak == 0.0) {
|
||||
+ qDebug("song is empty");
|
||||
+ break;
|
||||
+ }
|
||||
+ gain = 0.99 / peak;
|
||||
+ }
|
||||
+
|
||||
+ long bytes = exporter.finishStream(bufferOut);
|
||||
+ if (bytes > 0L)
|
||||
+ file.write((char*)bufferOut, bytes);
|
||||
+
|
||||
+ bool wasCanceled = progress.wasCanceled();
|
||||
+ progress.close();
|
||||
+ delete synti;
|
||||
+ delete[] bufferOut;
|
||||
+ file.close();
|
||||
+ if (wasCanceled)
|
||||
+ file.remove();
|
||||
+ MScore::sampleRate = oldSampleRate;
|
||||
+ return true;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+
|
||||
using namespace Ms;
|
||||
|
||||
//---------------------------------------------------------
|
|
@ -2,7 +2,7 @@
|
|||
%define shortname mscore
|
||||
|
||||
# Musical OCR, based on tesseract
|
||||
# ATM fails to build (gvm 05/15)
|
||||
# ATM fails to build (gvm 05/17)
|
||||
%define with_omr 0
|
||||
# Pipe organ synthetizer
|
||||
# Also broken ATM
|
||||
|
@ -10,8 +10,8 @@
|
|||
|
||||
Summary: Linux MusE Score Typesetter
|
||||
Name: musescore
|
||||
Version: 2.0.3
|
||||
Release: 3
|
||||
Version: 2.1
|
||||
Release: 1
|
||||
# (Fedora) rtf2html is LGPLv2+
|
||||
# paper4.png paper5.png are LGPLv3
|
||||
# the rest is GPLv2
|
||||
|
@ -26,26 +26,29 @@ Source2: %{shortname}.xml
|
|||
# Add metainfo file for font to show in gnome-software
|
||||
Source3: %{shortname}.metainfo.xml
|
||||
# (Fedora) use the system default soundfont instead of the deleted, non-free, one
|
||||
Patch1: musescore-2.0.3-use-default-soundfont.patch
|
||||
Patch1: %{name}-2.0.3-use-default-soundfont.patch
|
||||
# (Fedora) don't build the common files (font files, wallpapers, demo song,
|
||||
# instrument list) into the binary executable to reduce its size. This is also
|
||||
# useful to inform the users about the existence of different choices for common
|
||||
# files. The font files need to be separated due to the font packaging guidelines.
|
||||
Patch2: musescore-2.0.3-separate-commonfiles.patch
|
||||
Patch2: %{name}-2.0.3-separate-commonfiles.patch
|
||||
# Use CXXFLAGS for precompiled header
|
||||
Patch4: %{name}-2.0.1-fix-flags-for-precompiled-header.patch
|
||||
# Drop mp3 support due to no lame in main: http://musescore.org/en/node/57736
|
||||
Patch5: museScore-2.0.3-remove-lame-support.patch
|
||||
# The above issue is fixed by passing to cmake -DBUILD_LAME="OFF", but this
|
||||
# causes the build to fail at linking stage (see: http://musescore.org/en/node/201144)
|
||||
Patch5: %{name}-2.1-fix-disabling-lame-support.patch
|
||||
BuildRequires: cmake >= 2.8.7
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: qt5-linguist
|
||||
BuildRequires: qt5-tools
|
||||
# For big docs
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: graphviz
|
||||
BuildRequires: texlive-latex
|
||||
BuildRequires: texlive-dvips
|
||||
BuildRequires: cmake >= 2.8.7
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: qt5-linguist
|
||||
BuildRequires: qt5-tools
|
||||
BuildRequires: qtsingleapplication-devel
|
||||
BuildRequires: pkgconfig(freetype2)
|
||||
BuildRequires: pkgconfig(Qt5Core) >= 5.3.0
|
||||
BuildRequires: pkgconfig(Qt5Concurrent)
|
||||
BuildRequires: pkgconfig(Qt5Declarative)
|
||||
|
@ -101,16 +104,16 @@ It features:
|
|||
%files
|
||||
%doc ChangeLog* README* COPYING*
|
||||
%{_bindir}/%{shortname}
|
||||
%{_bindir}/musescore
|
||||
%{_bindir}/%{name}
|
||||
%{_datadir}/%{shortname}*
|
||||
%{_datadir}/applications/%{shortname}.desktop
|
||||
%{_datadir}/mime/packages/%{shortname}.xml
|
||||
%{_datadir}/mime/packages/musescore.xml
|
||||
%{_datadir}/mime/packages/%{name}.xml
|
||||
%{_datadir}/soundfonts/FluidR3Mono_GM.sf3
|
||||
%{_datadir}/soundfonts/FluidR3Mono_License.md
|
||||
%{_iconsdir}/hicolor/*/*/*
|
||||
%{_mandir}/man1/*.1*
|
||||
%exclude %{_datadir}/%{shortname}-2.0/manual/*
|
||||
%exclude %{_datadir}/%{shortname}-2.1/manual/*
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -127,7 +130,7 @@ MuseScore is a free cross platform WYSIWYG music notation program.
|
|||
This package contains the user manual of MuseScore in different languages.
|
||||
|
||||
%files doc
|
||||
%doc %{_datadir}/%{shortname}-2.0/manual/*
|
||||
%doc %{_datadir}/%{shortname}-2.1/manual/*
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -174,21 +177,14 @@ sed 's|\r||' thirdparty/rtf2html/README > tmpfile
|
|||
touch -r thirdparty/rtf2html/README tmpfile
|
||||
mv -f tmpfile thirdparty/rtf2html/README
|
||||
|
||||
# Why would we have to do this? Go as in Mageia and keep them
|
||||
# (Fedora) Remove preshipped fonts. We will build them from source
|
||||
|
||||
# (Fedora) Force specific compile flags:
|
||||
find . -name CMakeLists.txt -exec sed -i -e 's|-m32|%{optflags}|' -e 's|-O3|%{optflags}|' {} \;
|
||||
find . -name CMakeLists.txt -exec sed -i 's|-O3|%{optflags}|' {} \;
|
||||
|
||||
|
||||
%build
|
||||
mkdir -p build.release
|
||||
pushd build.release
|
||||
%cmake_qt5 ../.. -DCMAKE_BUILD_TYPE=RELEASE \
|
||||
-DCMAKE_CXX_FLAGS="%{optflags} -fsigned-char" \
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="%{optflags} -std=c++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG -fsigned-char" \
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH="OFF" \
|
||||
-DUSE_SYSTEM_FREETYPE="ON" \
|
||||
-DBUILD_LAME="OFF" \
|
||||
%if %{with_aeolus}
|
||||
-DAEOLUS="ON" \
|
||||
%else
|
||||
|
@ -243,10 +239,10 @@ cd ..
|
|||
popd
|
||||
|
||||
# Install .mscz files
|
||||
mkdir -p %{buildroot}%{_datadir}/%{shortname}-2.0/demos/
|
||||
install -p share/templates/*.mscz %{buildroot}%{_datadir}/%{shortname}-2.0/demos/
|
||||
mkdir -p %{buildroot}%{_datadir}/%{shortname}-2.1/demos/
|
||||
install -p share/templates/*.mscz %{buildroot}%{_datadir}/%{shortname}-2.1/demos/
|
||||
# symlinks to be safe
|
||||
pushd %{buildroot}%{_datadir}/%{shortname}-2.0/demos/
|
||||
pushd %{buildroot}%{_datadir}/%{shortname}-2.1/demos/
|
||||
for i in *.mcsz; do
|
||||
ln -s $i ../templates/$i
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue