summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2012-12-15 20:16:40 +0000
committerRobert Jonsson <spamatica@gmail.com>2012-12-15 20:16:40 +0000
commit90a75ad2160b3502d192fe4d9b5f58331a1870a3 (patch)
tree12a144a7d3a35afdfc4bedd356e9951c262811c3
parent7d07eab1370ca0e7e76797f7eacf145e735b64ee (diff)
simple drums asks for samples if they are missing
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/synti/simpledrums2/simpledrums.cpp22
-rw-r--r--muse2/synti/simpledrums2/simpledrumsgui.cpp2
3 files changed, 24 insertions, 2 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 3b9168b0..ffb4d1ea 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+14.12.2012:
+ - Made simpledrums ask to load another sample if a sample wasn't found during loading (rj)
12.12.2012:
- Fixed some vst controls stuck. (Tim)
- Added vst master timebase (sequencers should work now). WIP Not quite finished. (Tim)
diff --git a/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp
index 2cc42ba6..d62c5374 100644
--- a/muse2/synti/simpledrums2/simpledrums.cpp
+++ b/muse2/synti/simpledrums2/simpledrums.cpp
@@ -31,6 +31,7 @@
#include "simpledrums.h"
#include <samplerate.h>
+#include <QFileDialog>
const char* SimpleSynth::synth_state_descr[] =
{
@@ -1333,11 +1334,30 @@ bool SimpleSynth::loadSample(int chno, const char* filename)
// Thread stuff:
SS_SampleLoader* loader = new SS_SampleLoader;
loader->channel = ch;
- loader->filename = std::string(filename);
loader->ch_no = chno;
if (SS_DEBUG) {
printf("Loader filename is: %s\n", filename);
}
+
+ if (QFile::exists(filename))
+ {
+ loader->filename = std::string(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();
+ }
+
+
pthread_t sampleThread;
pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
pthread_attr_init(attributes);
diff --git a/muse2/synti/simpledrums2/simpledrumsgui.cpp b/muse2/synti/simpledrums2/simpledrumsgui.cpp
index f5e38a86..b68a441e 100644
--- a/muse2/synti/simpledrums2/simpledrumsgui.cpp
+++ b/muse2/synti/simpledrums2/simpledrumsgui.cpp
@@ -808,7 +808,7 @@ void SimpleSynthGui::loadSampleDialogue(int channel)
this,
tr("Load sample dialog"),
lastDir,
- QString("*.wav *.WAV"));
+ QString("Samples *.wav *.ogg *.flac (*.wav *.WAV *.ogg *.flac);;All files (*)"));
if (filename != QString::null) {
QFileInfo fi(filename);