diff options
author | Robert Jonsson <spamatica@gmail.com> | 2012-12-15 20:16:40 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2012-12-15 20:16:40 +0000 |
commit | 90a75ad2160b3502d192fe4d9b5f58331a1870a3 (patch) | |
tree | 12a144a7d3a35afdfc4bedd356e9951c262811c3 /muse2/synti/simpledrums2 | |
parent | 7d07eab1370ca0e7e76797f7eacf145e735b64ee (diff) |
simple drums asks for samples if they are missing
Diffstat (limited to 'muse2/synti/simpledrums2')
-rw-r--r-- | muse2/synti/simpledrums2/simpledrums.cpp | 22 | ||||
-rw-r--r-- | muse2/synti/simpledrums2/simpledrumsgui.cpp | 2 |
2 files changed, 22 insertions, 2 deletions
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); |