Set a better sfz file default

This commit is contained in:
Jean Pierre Cimalando 2020-06-20 16:29:50 +02:00
parent 846dd6d23f
commit 9d49794704
2 changed files with 11 additions and 3 deletions

View file

@ -88,6 +88,10 @@
#define LV2_DEBUG(...) #define LV2_DEBUG(...)
#endif #endif
static const char default_sfz_text[] =
"<region>sample=*sine" "\n"
"ampeg_attack=0.02 ampeg_release=0.1" "\n";
typedef struct typedef struct
{ {
// Features // Features
@ -416,7 +420,7 @@ instantiate(const LV2_Descriptor *descriptor,
} }
self->synth = sfizz_create_synth(); self->synth = sfizz_create_synth();
sfizz_load_string(self->synth, "default.sfz", "<region>sample=*sine"); sfizz_load_string(self->synth, "default.sfz", default_sfz_text);
return (LV2_Handle)self; return (LV2_Handle)self;
} }
@ -886,7 +890,7 @@ sfizz_lv2_load_file(LV2_Handle instance, const char *file_path)
if (file_path[0] == '\0') if (file_path[0] == '\0')
{ {
if (!sfizz_load_string(self->synth, "default.sfz", "<region>sample=*sine")) if (!sfizz_load_string(self->synth, "default.sfz", default_sfz_text))
return false; return false;
} }
else else

View file

@ -20,6 +20,10 @@ constexpr int fastRound(T x)
return static_cast<int>(x + T{ 0.5 }); // NOLINT return static_cast<int>(x + T{ 0.5 }); // NOLINT
} }
static const char defaultSfzText[] =
"<region>sample=*sine" "\n"
"ampeg_attack=0.02 ampeg_release=0.1" "\n";
SfizzVstProcessor::SfizzVstProcessor() SfizzVstProcessor::SfizzVstProcessor()
: _fifoToWorker(64 * 1024) : _fifoToWorker(64 * 1024)
{ {
@ -342,7 +346,7 @@ void SfizzVstProcessor::loadSfzFileOrDefault(sfz::Sfizz& synth, const std::strin
if (!filePath.empty()) if (!filePath.empty())
synth.loadSfzFile(filePath); synth.loadSfzFile(filePath);
else else
synth.loadSfzString("default.sfz", "<region>sample=*sine"); synth.loadSfzString("default.sfz", defaultSfzText);
} }
void SfizzVstProcessor::doBackgroundWork() void SfizzVstProcessor::doBackgroundWork()