Hi Christian, Thanks a bunch for setting me on the right track with this. I can now see that the engine is indeed successfully loading the instrument plugin, both at startup and when an instrument editor is requested: // load the DLL (the plugins should register themselfes automatically) void* pDLL = dlopen(sPath.c_str(), RTLD_NOW); if (pDLL) { LoadedDLLs.push_back(pDLL); fprintf (stderr, "Successfully loaded: %s\n", sPath.c_str() ); } else { std::cerr << "Failed to load instrument editor plugin: '" << sPath << "', cause: " << dlerror() << std::endl; } } closedir(hDir);
This is the fprintf'ed bit of code + a force reload of the plugins for testing I'm using in AvailableEditors to track what's happening: std::vector<String> InstrumentEditorFactory::AvailableEditors() { // make sure plugins were loaded already bPluginsLoaded = false; //force reload them fprintf (stderr, "Trying to find an available editor.\n"); LoadPlugins(); // render result std::vector<String> result; std::map<String, InnerFactory*>::iterator iter = InnerFactories.begin(); fprintf (stderr, "iterate InnerFactories.begin.\n"); for (; iter != InnerFactories.end(); iter++) { fprintf(stderr, "Iterating through editors..\n "); result.push_back(iter->first); } fprintf (stderr, "Returning available editors result.\n"); return result; } Registered sampler engines: 'GIG','SF2','SFZ' Registered MIDI input drivers: ALSA,JACK Registered audio output drivers: ALSA,JACK Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK Iterating through editors.. Returning available editors result. Registered instrument editors: 'gigedit' This is the output when the instrument editor is successfully loaded ("interactively" using "EDIT CHANNEL INSTRUMENT 0" the LSCP shell): Data type is libgig and data version is 4.3.0.svn34 Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK InnerFactories.begin. Iterating through editors.. Returning available editors result. Instrument plugin is 'gigedit' Searching for matching editors now... Trying to find an editor that can support: libgig and 4.3.0.svn34 Found a matching editor. :) Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK InnerFactories.begin. Iterating through editors.. Returning available editors result. Registered instrument editors again: 'gigedit' Searched finished for matching editors... Found matching editor 'gigedit' for instrument ('/home/andrew/Desktop/Samples/1 Woodwinds/Dan Dean Solo Woodwinds/Dan Dean Cl arinet 5.1.gig', 0) having data structure ('libgig','4.3.0.svn34') InstrumentEditor::Launch(instr=0x7f41b042b9d0,type=libgig,version=4.3.0.svn34) This is the output when I, shall we say, non-interactively (i.e netcat) send a command to Linuxsampler: Data type is libgig and data version is 4.3.0.svn34 Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK InnerFactories.begin. Returning available editors result. Instrument plugin is Searching for matching editors now... Trying to find an editor that can support: libgig and 4.3.0.svn34 Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK InnerFactories.begin. Returning available editors result. Registered instrument editors again: Searched finished for matching editors... vEditors looks empty. What about available editors string?Trying to find an available editor. Loading instrument editor plugins...Successfully loaded: /usr/local/lib/linuxsampler/plugins/libgigeditlinuxsamplerplugin.so OK InnerFactories.begin. Returning available editors result. ERROR: There is not any instrument editor registered to the sampler! It looks like the iterating through the previously registered editors gets "forgotten" or otherwise the 'InnerFactories.begin()' loop is empty in the 'non-interactive' example.. Phew.. That's enough wall of text then! Cheers, Andrew. On Mon, Dec 27, 2021 at 2:41 PM Christian Schoenebeck < schoeneb...@linuxsampler.org> wrote: > On Sonntag, 26. Dezember 2021 21:57:12 CET Andrew C wrote: > > *Diff patch for debugging/illustration purposes:* > > > > Index: LS-DEBUG/src/engines/gig/InstrumentResourceManager.cpp > > =================================================================== > > --- LS-DEBUG/src/engines/gig/InstrumentResourceManager.cpp (revision > > 4010) > > +++ LS-DEBUG/src/engines/gig/InstrumentResourceManager.cpp (working > > copy) > > @@ -216,6 +216,8 @@ > > InstrumentEditor* > > > InstrumentResourceManager::LaunchInstrumentEditor(LinuxSampler::EngineChanne > > l* pEngineChannel, instrument_id_t ID, > > void* pUserData) throw (InstrumentManagerException) { > > const String sDataType = GetInstrumentDataStructureName(ID); > > const String sDataVersion = > GetInstrumentDataStructureVersion(ID); > > + fprintf (stderr, "Data type is %s and data version is %s\n", > > sDataType.c_str(), sDataVersion.c_str()); > > + fprintf (stderr, "Instrument plugin is %s\n", > > InstrumentEditorFactory::AvailableEditorsAsString().c_str()); > > The output of this was an empty string there, which means the sampler did > not > load *any* plugin DLL at all. > > > // find instrument editors capable to handle given instrument > > std::vector<String> vEditors = > > InstrumentEditorFactory::MatchingEditors(sDataType, > > sDataVersion); > > @@ -224,10 +226,16 @@ > > fprintf(stderr, > > "ERROR: There is not any instrument editor registered > > to the sampler!\n" > > "[Cause: Make sure an instrument editor is installed > to > > the sampler's plugin dir (%s)]\n", > > - > InstrumentEditorFactory::PluginDirsAsString().c_str() > > - ); > > + > > > InstrumentEditorFactory::PluginDirsAsString().c_str()); > > + if (InstrumentEditorFactory::FoundPlugins) { > > + fprintf (stderr, > > + "We found and registered plugins in %s at startup, > but > > currently available plugins are:%s \n", > > + > InstrumentEditorFactory::PluginDirsAsString().c_str(), > > + > > > > InstrumentEditorFactory::AvailableEditorsAsString().c_str() > > > > + ); > > + }; > > throw InstrumentManagerException( > > - "There is not any instrument editor installed and > > registered to the sampler" > > + "netcat seems to cause issues." > > ); > > Has nothing to do with netcat. > > > } > > fprintf(stderr, > > Index: LS-DEBUG/src/plugins/InstrumentEditorFactory.cpp > > =================================================================== > > --- LS-DEBUG/src/plugins/InstrumentEditorFactory.cpp (revision 4010) > > +++ LS-DEBUG/src/plugins/InstrumentEditorFactory.cpp (working copy) > > @@ -44,6 +44,7 @@ > > std::map<String, InstrumentEditorFactory::InnerFactory*> > > InstrumentEditorFactory::InnerFactories; > > > > bool InstrumentEditorFactory::bPluginsLoaded = false; > > + bool InstrumentEditorFactory::FoundPlugins = false; > > > > std::list<void*> InstrumentEditorFactory::LoadedDLLs; > > > > @@ -287,6 +288,7 @@ > > } > > closedir(hDir); > > #endif > > + InstrumentEditorFactory::FoundPlugins = true; > > return true; > > } > > Wrong assumption. At this point it just *tried* to load plugins. It does > not > mean it was able to actually load any plugin successfully. > > You should rather debug what happens in the loop above. > > for (dirent* pEntry = readdir(hDir); pEntry; pEntry = readdir(hDir)) { > ... > } > > That loops iterares over all files found in the plugin dir and then tries > to > load every file that is actually a DLL file (i.e. filename ending with > ".so"). > > > Index: LS-DEBUG/src/plugins/InstrumentEditorFactory.h > > =================================================================== > > --- LS-DEBUG/src/plugins/InstrumentEditorFactory.h (revision 4010) > > +++ LS-DEBUG/src/plugins/InstrumentEditorFactory.h (working copy) > > @@ -98,6 +98,7 @@ > > static String PluginDirsAsString(); > > static std::vector<String> AvailableEditors(); > > static String AvailableEditorsAsString(); > > + static bool FoundPlugins; > > static std::vector<String> MatchingEditors(String sTypeName, > String > > sTypeVersion); > > static void LoadPlugins(); > > static void ClosePlugins(); > > > > > > _______________________________________________ > Linuxsampler-devel mailing list > Linuxsampler-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel >
_______________________________________________ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel