audacity icon indicating copy to clipboard operation
audacity copied to clipboard

define the Validator class for VST2 effects

Open Paul-Licameli opened this issue 2 years ago • 0 comments

Things to do (not necessarily in this sequence), with some analogous older commits

  • [x] 0. Define minimal Instance class -- holding references to Instance and EffectSettingsAccess (43d9887c)
  • [x] 1. Validator can fetch settings from, store to, Instance (And stores on construction; if needed to initally populate dialog values correctly) (7d1c0c6f)
  • [x] 2. Effect's TransferDataToWindow becomes Validator's UpdateUI override; ValidateUI moves into Validator, uses mAccess.ModifySettings, fetches settings from Instance
  • [x] 3. Plain UI controls, event handlers moved into Validator; all use ModifySettings, maybe just invoking ValidateUI (no analogy with AudioUnits)
    • [ ] EVENT_TABLE macros refer to validator class, not effect [PM: it was deleted]
    • [ ] DECLARE_EVENT_TABLE() needed in Validator class but deleted from Effect [PM: deleted from Effect, but not moved to Validator - no need to do it]
    • [ ] Pushing and popping of the event handler are not needed when the event table is no more [PM: actually, Pushing is still needed, please see comment in the code]
  • [x] 4. Native UI event and idle callbacks to host are handled by validator; parameter value changes invoke mAccess.ModifySettings (bae543a9)
    • [x] for VST2, this means certain cases of AudioMaster

Somewhere in this sequence, the mutex should be eliminated -- instead, OnSlider and Automate will use EffectSettingsAccess::ModifySettings.

The VSTEffectTimer will be part of the Validator not the Effect.

It may be that the Validator requires its own Wrapper to dispatch the Automate messages. Or it may be that the Instance's Wrapper will be sent the messages, but on the main thread, and the Validator should actually handle them. This isn't clear, and experiment should decide it.

But the Effect's Wrapper should not dispatch any Automate messages. It should be possible for two dialogs to be open at once for two instances of the same Effect. Any state information should be duplicated and separated, not unique in the Effect.

Paul-Licameli avatar Jul 29 '22 10:07 Paul-Licameli