MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / PluginLv2

Method PluginLv2

lv2export/lv2plugin.cpp:62–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60 void** ports;
61
62 PluginLv2(double sr)
63 {
64 rack::random::Xoroshiro128Plus& rng(rack::random::local());
65
66 if (! rng.isSeeded())
67 {
68 struct timeval tv;
69 gettimeofday(&tv, NULL);
70 uint64_t usec = uint64_t(tv.tv_sec) * 1000 * 1000 + tv.tv_usec;
71
72 static uint64_t globalCounter = 1;
73 rng.seed(usec, globalCounter++);
74
75 for (int i = 0; i < 4; i++)
76 rng();
77 }
78
79 context._engine.sampleRate = sr;
80 contextSet(&context);
81 module = PLUGIN_MODEL->createModule();
82
83 numInputs = module->getNumInputs();
84 numOutputs = module->getNumOutputs();
85 numParams = module->getNumParams();
86 numLights = module->getNumLights();
87 ports = new void*[numInputs+numOutputs+numParams+numLights];
88
89 Module::SampleRateChangeEvent e = { context._engine.sampleRate, 1.0f / context._engine.sampleRate };
90 module->onSampleRateChange(e);
91
92 // FIXME for CV ports we need to detect if something is connected
93 for (int i=numInputs; --i >=0;)
94 {
95 // if (!kCvInputs[i])
96 module->inputs[i].channels = 1;
97 }
98 for (int i=numOutputs; --i >=0;)
99 {
100 // if (!kCvOutputs[i])
101 module->outputs[i].channels = 1;
102 }
103
104 d_stdout("Loaded " SLUG " :: %i inputs, %i outputs, %i params and %i lights",
105 numInputs, numOutputs, numParams, numLights);
106 }
107
108 PluginLv2()
109 {

Callers

nothing calls this directly

Calls 9

isSeededMethod · 0.80
seedMethod · 0.80
getNumInputsMethod · 0.80
getNumOutputsMethod · 0.80
getNumParamsMethod · 0.80
getNumLightsMethod · 0.80
contextSetFunction · 0.70
createModuleMethod · 0.45
onSampleRateChangeMethod · 0.45

Tested by

no test coverage detected