summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2012-12-18 16:19:29 +0000
committerRobert Jonsson <spamatica@gmail.com>2012-12-18 16:19:29 +0000
commita227872303382ecb2020e4408525f0b25f41e88d (patch)
tree99b9971aeec5ea71427829f24f83f9aacbeeb3db
parenta2ae7e06099f1ceb38d752909e3c17055fbc59ca (diff)
fluidsynth and simpledrums search project folder for missing sounds
-rw-r--r--muse2/ChangeLog6
-rw-r--r--muse2/muse/app.cpp9
-rw-r--r--muse2/synti/fluidsynth/fluidsynti.cpp24
-rw-r--r--muse2/synti/simpledrums2/simpledrums.cpp28
-rw-r--r--muse2/synti/simpledrums2/simpledrumsgui.cpp4
5 files changed, 49 insertions, 22 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 42c3e921..2b57805e 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,9 @@
+18.12.2012
+ - Enable fluidsynth and simpledrums to search for missing sounds in project dir if
+ the path was missing. (rj)
+ - Added change-dir to project dir when saving or loading songs, it needs to be
+ researched a bit if this has any drawbacks. The idea is that if plugins or
+ whatever wants to write to disk it should happen in the project dir. (rj)
14.12.2012:
- Made simpledrums ask to load another sample if a sample wasn't found during loading (rj)
- when dragging multiple notes in editors they are not played, to avoid hanging notes (rj)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 45492889..82bf56af 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1145,11 +1145,13 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool doReadM
}
project.setFile(MusEGui::getUniqueUntitledName());
MusEGlobal::museProject = MusEGlobal::museProjectInitPath;
+ QDir::setCurrent(QDir::homePath());
}
else {
printf("Setting project path to %s\n", fi.absolutePath().toLatin1().constData());
MusEGlobal::museProject = fi.absolutePath();
project.setFile(name);
+ QDir::setCurrent(MusEGlobal::museProject);
}
QString ex = fi.completeSuffix().toLower();
QString mex = ex.section('.', -1, -1);
@@ -1298,7 +1300,8 @@ void MusE::setUntitledProject()
{
setConfigDefaults();
QString name(MusEGui::getUniqueUntitledName());
- MusEGlobal::museProject = "./";
+ MusEGlobal::museProject = MusEGlobal::museProjectInitPath;
+ QDir::setCurrent(QDir::homePath());
project.setFile(name);
setWindowTitle(tr("MusE: Song: %1").arg(MusEGui::projectTitleFromFilename(name)));
writeTopwinState=true;
@@ -1338,6 +1341,7 @@ void MusE::loadProject()
tr("MusE: load project"), &doReadMidiPorts);
if (!fn.isEmpty()) {
MusEGlobal::museProject = QFileInfo(fn).absolutePath();
+ QDir::setCurrent(QFileInfo(fn).absolutePath());
loadProjectFile(fn, false, doReadMidiPorts);
}
}
@@ -1711,6 +1715,8 @@ bool MusE::saveAs()
}
else
MusEGlobal::museProject = tempOldProj;
+
+ QDir::setCurrent(MusEGlobal::museProject);
}
return ok;
@@ -2624,6 +2630,7 @@ MusE::lash_idle_cb ()
setWindowTitle(tr("MusE: Song: %1").arg(MusEGui::projectTitleFromFilename(project.absoluteFilePath())));
addProject(ss.toAscii());
MusEGlobal::museProject = QFileInfo(ss.toAscii()).absolutePath();
+ QDir::setCurrent(MusEGlobal::museProject);
}
lash_send_event (lash_client, event);
}
diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp
index d3561fb9..eddedc87 100644
--- a/muse2/synti/fluidsynth/fluidsynti.cpp
+++ b/muse2/synti/fluidsynth/fluidsynti.cpp
@@ -616,15 +616,21 @@ bool FluidSynth::pushSoundfont (const char* filename, int extid)
else
{
- // TODO: Strings should be translated, this does
- // however require the class to be derived from qobject
- // tried in vain to make the call in the gui object
- // could'nt get it to work due to symbol missing in .so ...
- QString newName = QFileDialog::getOpenFileName(0,
- QString("Can't find soundfont: %1 - Choose soundfont").arg(filename),
- filename,
- QString("Soundfonts (*.sf2);;All files (*)"));
- helper->filename = newName.toStdString();
+ //printf("current path: %s \nmuseProject %s\nfilename %s\n",QDir::currentPath().toLatin1().data(), MusEGlobal::museProject.toLatin1().data(), filename);
+ QFileInfo fi(filename);
+ if (QFile::exists(fi.fileName()))
+ helper->filename = QDir::currentPath().toStdString() + "/" + fi.fileName().toStdString();
+ else {
+ // TODO: Strings should be translated, this does
+ // however require the class to be derived from qobject
+ // tried in vain to make the call in the gui object
+ // could'nt get it to work due to symbol missing in .so ...
+ QString newName = QFileDialog::getOpenFileName(0,
+ QString("Can't find soundfont: %1 - Choose soundfont").arg(filename),
+ filename,
+ QString("Soundfonts (*.sf2);;All files (*)"));
+ helper->filename = newName.toStdString();
+ }
}
if (pthread_create(&fontThread, attributes, ::fontLoadThread, (void*) helper))
diff --git a/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp
index d62c5374..a723c133 100644
--- a/muse2/synti/simpledrums2/simpledrums.cpp
+++ b/muse2/synti/simpledrums2/simpledrums.cpp
@@ -29,6 +29,7 @@
#include "muse/mpevent.h"
//#include "common_defs.h"
#include "simpledrums.h"
+#include "globals.h"
#include <samplerate.h>
#include <QFileDialog>
@@ -1345,16 +1346,23 @@ bool SimpleSynth::loadSample(int chno, const char* filename)
}
else
{
-
- // TODO: Strings should be translated, this does
- // however require the class to be derived from qobject
- // tried in vain to make the call in the gui object
- // could'nt get it to work due to symbol missing in .so ...
- QString newName = QFileDialog::getOpenFileName(0,
- QString("Can't find sample: %1 - Choose sample").arg(filename),
- filename,
- QString("Samples *.wav *.ogg *.flac (*.wav *.WAV *.ogg *.flac);;All files (*)"));
- loader->filename = newName.toStdString();
+ //printf("current path: %s \nmuseProject %s\nfilename %s\n",QDir::currentPath().toLatin1().data(), MusEGlobal::museProject.toLatin1().data(), filename);
+ //MusEGlobal::museProject
+ QFileInfo fi(filename);
+ if (QFile::exists(fi.fileName()))
+ loader->filename = QDir::currentPath().toStdString() + "/" + fi.fileName().toStdString();
+ else {
+
+ // TODO: Strings should be translated, this does
+ // however require the class to be derived from qobject
+ // tried in vain to make the call in the gui object
+ // could'nt get it to work due to symbol missing in .so ...
+ QString newName = QFileDialog::getOpenFileName(0,
+ QString("Can't find sample: %1 - Choose sample").arg(filename),
+ filename,
+ QString("Samples *.wav *.ogg *.flac (*.wav *.WAV *.ogg *.flac);;All files (*)"));
+ loader->filename = newName.toStdString();
+ }
}
diff --git a/muse2/synti/simpledrums2/simpledrumsgui.cpp b/muse2/synti/simpledrums2/simpledrumsgui.cpp
index b68a441e..640ea3b6 100644
--- a/muse2/synti/simpledrums2/simpledrumsgui.cpp
+++ b/muse2/synti/simpledrums2/simpledrumsgui.cpp
@@ -805,9 +805,9 @@ void SimpleSynthGui::loadSampleDialogue(int channel)
{
QString filename =
QFileDialog::getOpenFileName(
- this,
+ this,
tr("Load sample dialog"),
- lastDir,
+ lastDir,
QString("Samples *.wav *.ogg *.flac (*.wav *.WAV *.ogg *.flac);;All files (*)"));
if (filename != QString::null) {