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