Browse Source

Dispatch Module::SampleRateChange event when the Module is added to the engine.

tags/v2.0.0
Andrew Belt 2 years ago
parent
commit
a98256c6f4
2 changed files with 6 additions and 1 deletions
  1. +1
    -1
      include/engine/Module.hpp
  2. +5
    -0
      src/engine/Engine.cpp

+ 1
- 1
include/engine/Module.hpp View File

@@ -389,7 +389,7 @@ struct Module {
float sampleRate;
float sampleTime;
};
/** Called after the Engine sample rate changes.
/** Called when the Engine sample rate changes, and when the Module is added to the Engine.
*/
virtual void onSampleRateChange(const SampleRateChangeEvent& e) {
// Call deprecated event method by default


+ 5
- 0
src/engine/Engine.cpp View File

@@ -806,6 +806,11 @@ void Engine::addModule(Module* module) {
// Dispatch AddEvent
Module::AddEvent eAdd;
module->onAdd(eAdd);
// Dispatch SampleRateChangeEvent
Module::SampleRateChangeEvent eSrc;
eSrc.sampleRate = internal->sampleRate;
eSrc.sampleTime = internal->sampleTime;
module->onSampleRateChange(eSrc);
// Update ParamHandles' module pointers
for (ParamHandle* paramHandle : internal->paramHandles) {
if (paramHandle->moduleId == module->id)


Loading…
Cancel
Save