VST3: unconditionally set controller's component state
This synchronizes component and controller when loading presets like the VST3 SDK does.
This commit is contained in:
parent
de76d583b4
commit
4a8e9f28f3
@ -433,6 +433,7 @@ public:
|
||||
tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
|
||||
tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
|
||||
|
||||
void rewind () { _pos = 0; }
|
||||
protected:
|
||||
IBStream& _stream;
|
||||
int64 _offset;
|
||||
|
@ -2252,14 +2252,10 @@ VST3PI::load_state (RAMStream& stream)
|
||||
}
|
||||
if (is_equal_ID (i->_id, Vst::getChunkID (Vst::kComponentState))) {
|
||||
ROMStream s (stream, i->_offset, i->_size);
|
||||
tresult res = _component->setState(&s);
|
||||
tresult re2 = res;
|
||||
tresult res = _component->setState (&s);
|
||||
|
||||
if (FUnknownPtr<Vst::IEditController> (_component) == 0) {
|
||||
/* only if component and controller are not identical */
|
||||
s.seek (0, IBStream::kIBSeekSet, NULL);
|
||||
re2 = _controller->setComponentState(&s);
|
||||
}
|
||||
s.rewind ();
|
||||
tresult re2 = _controller->setComponentState (&s);
|
||||
|
||||
if (!(re2 == kResultOk || re2 == kNotImplemented || res == kResultOk || res == kNotImplemented)) {
|
||||
DEBUG_TRACE (DEBUG::VST3Config, "VST3PI::load_state: failed to restore component state\n");
|
||||
@ -2277,10 +2273,13 @@ VST3PI::load_state (RAMStream& stream)
|
||||
#if 0
|
||||
else if (is_equal_ID (i->_id, Vst::getChunkID (Vst::kProgramData))) {
|
||||
Vst::IUnitInfo* unitInfo = unit_info ();
|
||||
printf ("VST3: ignored unsupported kProgramData.\n");
|
||||
// PresetFile::restoreProgramData
|
||||
// RAMStream pgmstream (...) create substream
|
||||
// unit_info->setUnitProgramData (unitProgramListID, programIndex, pgmstream)
|
||||
stream.seek (i->_offset, IBStream::kIBSeekSet, &seek_result);
|
||||
int32 id = -1;
|
||||
if (stream.read_int32 (id)) {
|
||||
ROMStream s (stream, i->_offset + sizeof (int32), i->_size - sizeof (int32));
|
||||
unit_info->setUnitProgramData (id, programIndex, s);
|
||||
//unit_data->setUnitData (id, programIndex, s)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user