Show Midi Plugins in Plugin Finder

It was discussed on another thread:

Opened this as a new topic as it’s not only related to the Midi Channel Filter.

1 Like

This can be fixed in the mod-ui client. Ugly, but it works :see_no_evil:

Following will put MIDI plugins to the MIDI category and unknown plugins to a new category called Other.

Modifiy /usr/share/mod/html/index.html and add following lines to the div called plugin-results-wrapper:

<div id="plugin-results-wrapper">
  (...)

  <div id="effect-content-MIDIPlugin" class="plugins-wrapper"></div>

  (...)

  <div id="effect-content-Other" class="plugins-wrapper"></div>

  (...)

</div>

and add following li’s to the js-category-tabs ul:

<ul class="clearfix js-category-tabs">

  (...)
  
  <li id="effect-tab-MIDIPlugin">MIDI</li>

  (...)

  <li id="effect-tab-Other">Other</li>

  (...)

</ul>

In /usr/share/mod/html/js/effects.js modify the function renderNextPlugin thats embedded in the showPlugins function to:

function renderNextPlugin(c) {
            if (self.data('showPluginsRenderId') != currentRenderId) {
                // another render is in place, stop this one
                if (callback) { callback() }
                return
            }

            if (renderedIndex >= pluginCount) {
                // if we get here it means we finished rendering
                self.effectBox('calculateNavigation')

                if (self.data('showPluginsRenderId') == currentRenderId) {
                    // no other renders in queue, take the chance and reset the id
                    self.data('showPluginsRenderId', 0)
                }
                if (callback) { callback() }
                return
            }

            plugin   = plugins[renderedIndex]
            category = plugin.category[0]

            self.effectBox('renderPlugin', plugin, self.find('#effect-content-All'))

            if (FAVORITES.indexOf(plugin.uri) >= 0) {
                self.effectBox('renderPlugin', plugin, self.find('#effect-content-Favorites'))
            }

            if(!category){
              category = (plugin.label.match(/MIDI/gi) || plugin.name.match(/MIDI/gi)) ? "MIDIPlugin" : "Other";
            }

            if (category && category != 'All') {
                self.effectBox('renderPlugin', plugin, self.find('#effect-content-' + category))
            }

            renderedIndex += 1

            c = c || 0;
            if (c < 20) renderNextPlugin(c+1);
            else setTimeout(renderNextPlugin, 1);
        }

Don’t know how to highlight code, so put this:

            if(!category){
              category = (plugin.label.match(/MIDI/gi) || plugin.name.match(/MIDI/gi)) ? "MIDIPlugin" : "Other";
            }

before:

            if (category && category != 'All') {
                self.effectBox('renderPlugin', plugin, self.find('#effect-content-' + category))
            }
1 Like

That’s nice, could you post a screenshot of what’s the end result of the category? :slight_smile:

The Other category:

The Midi category:

@Giedrius did you encounter problems with the fix in the original template?

Currently working on a responsive mobile template and my screens might slightly differ from the original version :joy:

1 Like

Looking good! I haven’t tried it out yet, but if it’s working well, it’d make sense to include the changes when updating to 1.10.

1 Like

Sure, my solution works well and it’s just one line of code, but it’s quite an ugly hack.

Do I understand right that we only have access to the compiled mod-ui/utils? Midi Channel Filter - #6 by Giedrius. If not, I would recommend to fix it directly in utils_lilv.cpp.

It seems that meanwhile moddevices corrected it: mod-ui/utils_lilv.cpp at master · moddevices/mod-ui · GitHub

1 Like

No, we can build the binaries as needed. If it’s fixed in 1.10, then no extra changes would be necessary then. :slight_smile:

1 Like

Thats good news! In the meantime you can use my hack :yum: