MCPcopy Create free account
hub / github.com/audacity/audacity / load

Method load

libraries/lib-vst3/module_linux.cpp:164–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 bool load (const std::string& inPath, std::string& errorDescription) override
165 {
166 auto modulePath = getSOPath (inPath);
167 if (!modulePath)
168 {
169 errorDescription = inPath + " is not a module directory.";
170 return false;
171 }
172
173 mModule = dlopen (reinterpret_cast<const char*> (modulePath->generic_string ().data ()),
174 RTLD_LAZY);
175 if (!mModule)
176 {
177 errorDescription = "dlopen failed.\n";
178 errorDescription += dlerror ();
179 return false;
180 }
181 // ModuleEntry is mandatory
182 auto moduleEntry = getFunctionPointer<ModuleEntryFunc> ("ModuleEntry");
183 if (!moduleEntry)
184 {
185 errorDescription =
186 "The shared library does not export the required 'ModuleEntry' function";
187 return false;
188 }
189 // ModuleExit is mandatory
190 auto moduleExit = getFunctionPointer<ModuleExitFunc> ("ModuleExit");
191 if (!moduleExit)
192 {
193 errorDescription =
194 "The shared library does not export the required 'ModuleExit' function";
195 return false;
196 }
197 auto factoryProc = getFunctionPointer<GetFactoryProc> ("GetPluginFactory");
198 if (!factoryProc)
199 {
200 errorDescription =
201 "The shared library does not export the required 'GetPluginFactory' function";
202 return false;
203 }
204
205 if (!moduleEntry (mModule))
206 {
207 errorDescription = "Calling 'ModuleEntry' failed";
208 return false;
209 }
210 auto f = Steinberg::FUnknownPtr<Steinberg::IPluginFactory> (owned (factoryProc ()));
211 if (!f)
212 {
213 errorDescription = "Calling 'GetPluginFactory' returned nullptr";
214 return false;
215 }
216 factory = PluginFactory (f);
217 return true;
218 }
219
220 void* mModule {nullptr};
221};

Callers 15

GetMuteMethod · 0.45
GetSoloMethod · 0.45
GetVolumeMethod · 0.45
GetPanMethod · 0.45
CloseLockMethod · 0.45
ConvertToSampleFormatMethod · 0.45
GetMinMaxMethod · 0.45
GetRMSMethod · 0.45
CopyMethod · 0.45
PasteMethod · 0.45
GetBestBlockSizeMethod · 0.45
WriteXMLMethod · 0.45

Calls 2

dlerrorFunction · 0.50
dataMethod · 0.45

Tested by 1

TestAccessStateFunction · 0.36