Commits

Omer Goshen committed dbf9ffd

Missing Spectogram file

Comments (0)

Files changed (2)

libneil/src/plugins/Spectogram/Ring.hpp

+#ifndef RING__H
+#define RING__H
+
+/**
+ * Ring Buffer
+ */
+template<typename T, int SIZE>
+class Ring
+{
+  volatile int writePos;
+  volatile int readPos;
+  enum Op { READ, WRITE } op;
+  T samples[SIZE];  
+public:
+  Ring() : writePos(0), readPos(0), op(READ)
+  {
+    // memset(&samples, 0, sizeof(T)*SIZE);    
+  }
+
+  bool push(T s) {
+    if(full()) {
+    // if(writable()==0) {
+      // clear();
+      // printf("%s:%s",__FUNCTION__,"overflow\n");      
+      return false;
+    }
+    samples[writePos] = s;
+    writePos = (writePos + 1) % SIZE;
+    // writePos = (writePos + 1) & (SIZE-1);
+    // __sync_val_compare_and_swap (&samples[writePos], samples[writePos], s);
+    // __sync_lock_test_and_set(&samples[writePos], s);
+    // __sync_fetch_and_add(&writePos, 1);
+    // __sync_val_compare_and_swap(&writePos, SIZE+1, 0);
+    // __sync_fetch_and_and(&writePos, SIZE - 1);
+    op = WRITE;
+    return true;
+  }
+
+  T pop() {
+    // static int pops = 0;
+    // pops++;
+    if(empty()) {
+    // if(readable()==0) {
+      // clear();
+      // static int n = 0;
+      // printf("%s:underrun %d/%d (%%%-3.2f)\n",__FUNCTION__,n++,pops,float(n)/pops*100.f);
+      return 0;
+    }
+    T s = samples[readPos];
+    readPos = (readPos + 1) % SIZE;
+    // readPos = (readPos + 1) & (SIZE-1);
+    // __sync_fetch_and_add(&readPos, 1);
+    // __sync_val_compare_and_swap(&readPos, SIZE+1, 0);
+    // __sync_fetch_and_and(&readPos, SIZE - 1);
+    op = READ;
+    return s;
+  }
+
+  int readable() const {
+    // volatile int i = writePos; __sync_fetch_and_sub(&i, readPos); return i;
+    int i = ((readPos > writePos) ? SIZE : 0) + writePos - readPos;
+    if(i)
+      return i;
+    else
+      return op == WRITE ? SIZE : 0;
+
+    // return ((readPos > writePos) ? SIZE : 0) + writePos - readPos;
+    // int r = writePos - readPos;
+    // if(r<0)
+    //   r = SIZE - readPos + writePos - 1;
+    // return r;
+  }
+
+  int writable() const {
+    return SIZE - readable();
+  }  
+
+  bool empty() const {
+    // return readPos == writePos;
+    // return readable() == 0;
+    return readPos == writePos && op == READ;
+  }
+
+  bool full() const  { 
+    return readPos == writePos && op == WRITE;
+    // return ( ((writePos + 1) % SIZE) == readPos ); 
+  }
+
+  void clear() {
+    // memset(&samples, 0, sizeof(T)*SIZE);
+    writePos = readPos = 0;
+    op = READ;
+  }
+};
+
+#endif // RING__H

src/components/contextmenu.py

 import zzub
 import os.path
 
-from neil.utils import is_generator, is_root, is_controller, is_effect, \
-        prepstr, Menu, new_theme_image, gettext
-from neil.utils import PLUGIN_FLAGS_MASK, ROOT_PLUGIN_FLAGS, \
-        GENERATOR_PLUGIN_FLAGS, EFFECT_PLUGIN_FLAGS, CONTROLLER_PLUGIN_FLAGS
+from neil.utils import is_generator, is_root, is_effect, prepstr, Menu, gettext
 from neil.utils import iconpath, show_machine_manual, filenameify
 
+
 class ContextMenu(Menu):
     __neil__ = dict(
             id = 'neil.core.contextmenu',
         self.rootwindow = parent
         return Menu.popup(self, parent, event)
 
+
 class PluginContextMenu(gtk.Menu):
     __neil__ = dict(id='neil.core.popupmenu',
                       singleton=True,
                       categories=['contextmenu.handler'])
 
-    plugin_tree = {'@krzysztof_foltman/generator/infector;1' :
+    plugin_tree = {'@krzysztof_foltman/generator/infector;1':
                        ['Synthesizers', 'Subtractive'],
-                   'jamesmichaelmcdermott@gmail.com/generator/primifun;1' :
+                   'jamesmichaelmcdermott@gmail.com/generator/primifun;1':
                        ['Synthesizers', 'Subtractive'],
-                   '@cameron_foale/generator/green_milk;1' :
+                   '@cameron_foale/generator/green_milk;1':
                        ['Synthesizers', 'Subtractive'],
-                   '@makk.org/M4wII;1' :
+                   '@makk.org/M4wII;1':
                        ['Synthesizers', 'Subtractive'],
-                   '@libneil/oomek/generator/aggressor' :
+                   '@libneil/oomek/generator/aggressor':
                        ['Synthesizers', 'Subtractive'],
-                   '@libneil/mda/generator/jx10' :
+                   '@libneil/mda/generator/jx10':
                        ['Synthesizers', 'Subtractive'],
-                   'jamesmichaelmcdermott@gmail.com/generator/4fm2f;1' :
+                   'jamesmichaelmcdermott@gmail.com/generator/4fm2f;1':
                        ['Synthesizers', 'FM'],
-                   '@libneil/somono/generator/fm303;1' :
+                   '@libneil/somono/generator/fm303;1':
                        ['Synthesizers', 'FM'],
-                   '@libneil/mda/generator/dx10' :
+                   '@libneil/mda/generator/dx10':
                        ['Synthesizers', 'FM'],
-                   'jamesmichaelmcdermott@gmail.com/generator/pluckedstring;1' :
+                   'jamesmichaelmcdermott@gmail.com/generator/pluckedstring;1':
                        ['Synthesizers', 'Physical Modelling'],
-                   'jamesmichaelmcdermott@gmail.com/generator/dynamite6;1' :
+                   'jamesmichaelmcdermott@gmail.com/generator/dynamite6;1':
                        ['Synthesizers', 'Physical Modelling'],
-                   '@mda-vst/epiano;1' :
+                   '@mda-vst/epiano;1':
                        ['Synthesizers', 'Physical Modelling'],
-                   '@libneil/fsm/generator/kick_xp' :
+                   '@libneil/fsm/generator/kick_xp':
                        ['Synthesizers', 'Percussive'],
-                   '@libneil/somono/generator/cloud;1' :
+                   '@libneil/somono/generator/cloud;1':
                        ['Synthesizers', 'Granular'],
-                   'jamesmichaelmcdermott@gmail.com/generator/DTMF_1;1' :
+                   'jamesmichaelmcdermott@gmail.com/generator/DTMF_1;1':
                        ['Synthesizers', 'Other'],
-                   '@rift.dk/generator/Matilde+Tracker;1.5' :
+                   '@rift.dk/generator/Matilde+Tracker;1.5':
                        ['Samplers'],
-                   '@libneil/mrmonkington/effect/mcp_chorus' :
+                   '@libneil/mrmonkington/effect/mcp_chorus':
                        ['Effects', 'Time based'],
-                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/delay;1' :
+                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/delay;1':
                        ['Effects', 'Time based'],
-                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/phaser;1' :
+                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/phaser;1':
                        ['Effects', 'Time based'],
-                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/reverb;1' :
+                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/reverb;1':
                        ['Effects', 'Time based'],
-                   '@libneil/somono/effect/mverb' :
+                   '@libneil/somono/effect/mverb':
                        ['Effects', 'Time based'],
-                   '@libneil/somono/effect/mdaDubDelay' :
+                   '@libneil/somono/effect/mdaDubDelay':
                        ['Effects', 'Time based'],
-                   '@mda/effect/mdaThruZero;1' :
+                   '@mda/effect/mdaThruZero;1':
                        ['Effects', 'Time based'],
-                   '@libneil/somono/effect/chebyshev;1' :
+                   '@libneil/somono/effect/chebyshev;1':
                        ['Effects', 'Distortion'],
-                   '@libneil/arguru/effect/distortion' :
+                   '@libneil/arguru/effect/distortion':
                        ['Effects', 'Distortion'],
-                   'graue@oceanbase.org/effect/softsat;1' :
+                   'graue@oceanbase.org/effect/softsat;1':
                        ['Effects', 'Distortion'],
-                   '@mda/effect/mdaBandisto;1' :
+                   '@mda/effect/mdaBandisto;1':
                        ['Effects', 'Distortion'],
-                   '@neil/lunar/effect/bitcrusher;1' :
+                   '@neil/lunar/effect/bitcrusher;1':
                        ['Effects', 'Distortion'],
-                   '@bblunars/effect/mdaDegrade' :
+                   '@bblunars/effect/mdaDegrade':
                        ['Effects', 'Distortion'],
-                   '@libneil/edsca/effect/Migraine' :
+                   '@libneil/edsca/effect/Migraine':
                        ['Effects', 'Distortion'],
-                   '@bblunars/effect/mdaSubSynth' :
+                   '@bblunars/effect/mdaSubSynth':
                        ['Effects', 'Distortion'],
-                   '@libneil/mda/effect/combo' :
+                   '@libneil/mda/effect/combo':
                        ['Effects', 'Distortion'],
-                   '@libneil/mda/effect/leslie' :
+                   '@libneil/mda/effect/leslie':
                        ['Effects', 'Modulation'],
-                   '@bigyo/frequency+shifter;1' :
+                   '@bigyo/frequency+shifter;1':
                        ['Effects', 'Modulation'],
-                   'jamesmichaelmcdermott@gmail.com/effect/btdsys_ringmod;1' :
+                   'jamesmichaelmcdermott@gmail.com/effect/btdsys_ringmod;1':
                        ['Effects', 'Modulation'],
-                   'jamesmichaelmcdermott@gmail.com/effect/modulator;1' :
+                   'jamesmichaelmcdermott@gmail.com/effect/modulator;1':
                        ['Effects', 'Modulation'],
-                   '@libneil/mrmonkington/effect/mcp_chorus' :
+                   '@libneil/mrmonkington/effect/mcp_chorus':
                        ['Effects', 'Modulation'],
-                   '@libneil/arguru/effect/compressor' :
+                   '@libneil/arguru/effect/compressor':
                        ['Effects', 'Dynamics'],
-                   '@binarywerks.dk/multi-2;1' :
+                   '@binarywerks.dk/multi-2;1':
                        ['Effects', 'Dynamics'],
-                   '@libneil/mda/effect/transient' :
+                   '@libneil/mda/effect/transient':
                        ['Effects', 'Dynamics'],
-                   '@libneil/mda/effect/multiband' :
+                   '@libneil/mda/effect/multiband':
                        ['Effects', 'Dynamics'],
-                   '@libneil/mda/effect/dynamics' :
+                   '@libneil/mda/effect/dynamics':
                        ['Effects', 'Dynamics'],
-                   '@FireSledge.org/ParamEQ;1' :
+                   '@FireSledge.org/ParamEQ;1':
                        ['Effects', 'Filter'],
-                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/philthy;1' :
+                   '@trac.zeitherrschaft.org/aldrin/lunar/effect/philthy;1':
                        ['Effects', 'Filter'],
-                   'jamesmichaelmcdermott@gmail.com/effect/dffilter;1' :
+                   'jamesmichaelmcdermott@gmail.com/effect/dffilter;1':
                        ['Effects', 'Filter'],
-                   '@libneil/somono/effect/filter' :
+                   '@libneil/somono/effect/filter':
                        ['Effects', 'Filter'],
-                   '@libneil/mda/effect/vocoder' :
+                   '@libneil/mda/effect/vocoder':
                        ['Effects', 'Filter'],
-                   '@libneil/mda/effect/talkbox' :
+                   '@libneil/mda/effect/talkbox':
                        ['Effects', 'Filter'],
-                   '@libneil/mda/effect/rezfilter' :
+                   '@libneil/mda/effect/rezfilter':
                        ['Effects', 'Filter'],
-                   'jamesmichaelmcdermott@gmail.com/effect/sprayman;1' :
+                   'jamesmichaelmcdermott@gmail.com/effect/sprayman;1':
                        ['Effects', 'Sampling'],
-                   '@libneil/somono/effect/stutter;1' :
+                   '@libneil/somono/effect/stutter;1':
                        ['Effects', 'Sampling'],
-                   '@libneil/mda/effect/repsycho' :
+                   '@libneil/mda/effect/repsycho':
                        ['Effects', 'Sampling'],
-                   '@libneil/mda/effect/tracker' :
+                   '@libneil/mda/effect/tracker':
                        ['Effects', 'Other'],
-                   '@libneil/mda/effect/beatbox' :
+                   '@libneil/mda/effect/beatbox':
                        ['Effects', 'Other'],
-                   '@libneil/mda/effect/envelope' :
+                   '@libneil/mda/effect/envelope':
                        ['Effects', 'Other'],
                    '@libneil/mda/effect/shepard':
                        ['Effects', 'Other'],
-                   '@libneil/mda/effect/detune' :
+                   '@libneil/mda/effect/detune':
                        ['Effects', 'Other'],
-                   '@libneil/mda/effect/vocinput' :
+                   '@libneil/mda/effect/vocinput':
                        ['Effects', 'Other'],
-                   '@libneil/mda/effect/stereo' :
+                   '@libneil/mda/effect/stereo':
                        ['Effects', 'Other'],
-                   '@libneil/somono/controller/lfnoise;1' :
+                   '@libneil/somono/controller/lfnoise;1':
                        ['Control'],
-                   '@neil/lunar/controller/Control;1' :
+                   '@neil/lunar/controller/Control;1':
                        ['Control'],
-                   '@trac.zeitherrschaft.org/aldrin/lunar/controller/LunarLFO;1' :
+                   '@trac.zeitherrschaft.org/aldrin/lunar/controller/LunarLFO;1':
                        ['Control'],
-                   '@zzub.org/input' :
+                   '@zzub.org/input':
                        ['Utility'],
-                   '@zzub.org/output' :
+                   '@zzub.org/output':
                        ['Utility'],
-                   '@zzub.org/recorder/file' :
+                   '@zzub.org/recorder/file':
                        ['Utility'],
-                   '@zzub.org/recorder/wavetable' :
+                   '@zzub.org/recorder/wavetable':
                        ['Utility'],
-                   '@libneil/gershon/gfx/Oscilloscope' :
+                   '@libneil/gershon/gfx/Oscilloscope':
                        ['Analyzers'],
-                   '@libneil/gershon/gfx/Spectrum' :
+                   '@libneil/gershon/gfx/Spectrum':
+                       ['Analyzers'],
+                   '@libneil/gershon/gfx/Spectogram':
                        ['Analyzers']
                   }
 
 
     def create_add_machine_submenu(self, menu, connection=False):
         def get_icon_name(pluginloader):
-            uri = pluginloader.get_uri()
+            # uri = pluginloader.get_uri()
             #if uri.startswith('@zzub.org/dssidapter/'):
             #    return iconpath("scalable/dssi.svg")
             #if uri.startswith('@zzub.org/ladspadapter/'):
             for c in '():[]/,.!"\'$%&\\=?*#~+-<>`@ ':
                 filename = filename.replace(c, '_')
             while '__' in filename:
-                filename = filename.replace('__','_')
+                filename = filename.replace('__', '_')
             filename = filename.strip('_')
             return "%s.svg" % iconpath("scalable/" + filename)
+
         def add_path(tree, path, loader):
             if len(path) == 1:
                 tree[path[0]] = loader
             else:
                 tree[path[0]] = add_path(tree[path[0]], path[1:], loader)
                 return tree
+
         def populate_from_tree(menu, tree):
             for key, value in tree.iteritems():
                 if type(value) is not type({}):
                 else:
                     item, submenu = menu.add_submenu(key)
                     populate_from_tree(submenu, value)
+
         def create_plugin(item, loader, connection=False):
             player = com.get('neil.core.player')
             if connection:
 
         menu.add_check_item("_Bypass", mp.get_bypass(),
                                 self.on_popup_bypass, mp)
-        menu.add_separator()                                
+        menu.add_separator()
         menu.add_separator()
         menu.add_item("_Parameters...", self.on_popup_show_params, mp)
         menu.add_item("_Attributes...", self.on_popup_show_attribs, mp)
 
     def on_machine_help(self, widget, mp):
         name = filenameify(mp.get_pluginloader().get_name())
-	if not show_machine_manual(name):
-	    info = gtk.MessageDialog(self.get_toplevel(), flags=0, type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_OK, message_format="Sorry, there's no help for this plugin yet")
-	    info.run()
-	    info.destroy()
+        if not show_machine_manual(name):
+            info = gtk.MessageDialog(self.get_toplevel(), flags=0, type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_OK, message_format="Sorry, there's no help for this plugin yet")
+            info.run()
+            info.destroy()
 
     def on_popup_rename(self, widget, mp):
         text = gettext(self, "Enter new plugin name:", prepstr(mp.get_name()))
         player = com.get('neil.core.player')
         player.toggle_bypass(mp)
 
-
     def on_popup_mute(self, widget, mp):
         """
         Event handler for the "Mute" context menu option.
         """
         plugin = mp.get_input_connection_plugin(index)
         conntype = mp.get_input_connection_type(index)
-        mp.delete_input(plugin,conntype)
+        mp.delete_input(plugin, conntype)
         player = com.get('neil.core.player')
         player.history_commit("disconnect")
 
         @param event: Menu event.
         @type event: wx.MenuEvent
         """
-        dlg = com.get('neil.core.attributesdialog',mp,self)
+        dlg = com.get('neil.core.attributesdialog', mp, self)
         dlg.run()
         dlg.destroy()
 
-
     def on_popup_show_presets(self, widget, plugin):
         """
         Event handler for the "Presets..." context menu option.
         player = com.get('neil.core.player')
         for mp in reversed(list(player.get_plugin_list())):
             info = common.get_plugin_infos().get(mp)
-            info.muted=False
+            info.muted = False
             mp.set_mute(info.muted)
             info.reset_plugingfx()
 
         """
         Event handler for plugin commands
         """
-        plugin.command((subindex<<8) | index)
+        plugin.command((subindex << 8) | index)
 
     def on_popup_set_target(self, widget, plugin):
         """
         Event handler for menu option to set machine as target for default connection
         """
         player = com.get('neil.core.player')
-        if player.autoconnect_target==plugin:
+        if player.autoconnect_target == plugin:
             player.autoconnect_target = None
         else:
             player.autoconnect_target = plugin
                 PluginContextMenu,
         ],
 )
-