I want to save/load VST panel’s all status on my VSTHost.
KORG M1 / Arturia AnalogLab V works fine with following code.
But Steinberg Halion Sonic returnd FALSE when Steinberg::Vst::PresetFile::loadPreset.
What is my mistake.
Thank you.
BOOL EasyVst::savePreset(const char* utfPath) {
Steinberg::IBStream* file = NULL;
BOOL success = FALSE;
try {
file = FileStream::open(utfPath, “wb”);
FUID uid;
_vstComponent->getControllerClassId((char*)&uid);
success = Steinberg::Vst::PresetFile::savePreset(
file,
uid,
_vstComponent,
_editController
);
}
catch (...) {
std::wcout << "something happens in savePreset";
}
if (file != NULL) file->release();
return success;
}
BOOL EasyVst::loadPreset(const char* utfPath) {
Steinberg::IBStream* file = NULL;
BOOL success = FALSE;
try {
file = FileStream::open(utfPath, “rb”);
FUID uid;
_vstComponent->getControllerClassId((char*)&uid);
success = Steinberg::Vst::PresetFile::loadPreset(
file,
uid,
_vstComponent,
_editController
);
if (!success) {
std::wcout << "false from #loadPreset";
}
}
catch (...) {
std::wcout << "something happens in loadPreset";
}
if (file != NULL) file->release();
return success;
}
hello forum.
additional information.
C:\Program Files\Common Files\VST3\Steinberg\HALion Sonic.vst3 (Directory type)
not work with it.
but,
C:\Program Files\Common Files\VST3\Steinberg\HALion Sonic SE\Halion Sonic SE.vst3
worked.
and, file flush problem??
MyCustomEasyVst::savePreset
MyCustomEasyVst::loadPreset < another instance
not work.
MyCustomEasyVst::savePreset
MyCustomEasyVst::loadPreset < same instance
MyCustomEasyVst::savePreset
MyCustomEasyVst::loadPreset < another instance
worked.
any hints?
maybe flush file will be fine.??
But,
Following Solution Works Good.
BOOL CustomEasyVst::savePreset(const char* utfPath) {
BOOL success = FALSE;
try {
BufferStream buffer0;
BufferStream buffer;
FUID uid;
_vstComponent->getControllerClassId((char*)&uid);
success = Steinberg::Vst::PresetFile::savePreset(
&buffer0,
uid,
_vstComponent,
_editController
);
success = Steinberg::Vst::PresetFile::savePreset(
&buffer,
uid,
_vstComponent,
_editController
);
if (success) {
int64 pos;
buffer0.tell(&pos);
std::cout << "success0 pos = " << std::to_string(pos) << std::endl;
buffer.tell(&pos);
std::cout << "success1 pos = " << std::to_string(pos) << std::endl;
success = bufferToFile(utfPath, buffer);
}
if (!success) {
std::wcout << "false from #savePreset";
}
}
catch (...) {
std::wcout << "something happens in savePreset";
}
return success;
}
Logfile …
(With C:\Program Files\Common Files\VST3\Steinberg\HALion Sonic SE\Halion Sonic SE.vst3)
success0 pos = 7879
success1 pos = 263922
(With C:\Program Files\Common Files\VST3\Steinberg\HALion Sonic.vst3 directory)
success0 pos = 10188
success1 pos = 197340