29 Jul 2004 18:39

ladspar 0.1

I released ladspar, a Ruby module for using LADSPA plugins. I'm pretty psyched about it, mostly because it will let me write the textfile-driven software synth I've been dreaming about, but also because it's so darned cool and only took me a week to write. (of course it helps that Erin is out of town...)

Every silver lining has its cloud, though, and mine is my example in the README was seriously flawed. Here's the corrected example (I'm too lazy to repackage and reupload it):

require 'ladspa'
require 'narray'

# load the CMT library
cmt = LADSPA.load_library('cmt')

# get an instance of the amp_mono plugin
amp_mono = cmt.plugins.find {|p| p.label == 'amp_mono'}.instantiate(44100)

# The ports are Gain, Input, and Output.
amp_mono.ports[0].connect_port(2.0) # gain

input = NArray.sfloat(44100)
amp_mono.ports[1].connect_port(input)

output = NArray.sfloat(44100)
amp_mono.ports[2].connect_port(output)

amp_mono.activate if amp_mono.has_activate

# prep the input data ...

amp_mono.run

amp_mono.deactivate if amp_mono.has_deactivate
amp_mono.cleanup

21 Jul 2004 10:12

Terminus in GTK2 Applications

I'm a big fan of the Terminus font, and an even bigger fan of Vim. Recent versions of Vim Debian packages are built with GTK2 instead of GTK1. GTK2 apps use TrueType fonts and in general make fonts in X even more complicated than they already were. I must have my terminus while in gvim, and it just wasn't there by default. Here's the trick:

$ dpkg-reconfigure fontconfig  # answer yes to "Use Bitmapped fonts by default"

20 Jul 2004 14:45

Happy Hacking Keyboard, GNOME 2.4, and FVWM

I'm using GNOME at work, and got sick of the "user friendly" window non-manager Metacity, so I started investigating other options. Despite much smoke and mirrors to the contrary you really can use other window managers in GNOME these days (this is 2.4). Sawmill is nice in theory but I have an aversion to lisp syntax (although I love the language theoretically).

FVWM is one of my favorite WMs from the configurability standpoint. Its weakness is as a desktop. I don't require much from a desktop: quicklaunch, dock (panel is OK, slit is best), and do it without taking a lot of space. FVWM can almost cover the first two with some work, but it flat out fails on the last point. But I digress. The point is that I decided to use FVWM as my window manager in GNOME and I am loving it.

One of the great things about FVWM is that it groks all the keystrokes and modifiers. So I can use that windows key for window manager functions and leave Alt alone, so applications that use Alt will actually work. My Happy Hacking keyboard has cute little diamond keys that are supposed to be Meta keys. They output the Super_[LR] keycodes. Alas, for whatever reason, mod4 wasn't getting bound to them, as you can see here:

fugalh@gwythaint:~$ xmodmap
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_L (0x42),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_R (0x71)
mod2        Num_Lock (0x4d)
mod3      
mod4    
mod5

This is the secret:

fugalh@gwythaint:~$ cat > ~/.xmodmaprc
add mod4 = Super_L Super_R
fugalh@gwythaint:~$ xmodmap ~/.xmodmaprc

Throw that last command in your ~/.xsession to complete the trick. Now things like the following work in your ~/.fvwm/.fvwm2rc:

# do the alt-drag and alt-resize thing
Mouse 1 FSTW 4 Move
Mouse 3 FSTW 4 Resize
Update

I think I was wrong, the problem was probably GNOME in the end. Not only does GNOME annoyingly complain about my having an ~/.xmodmaprc, but it apparently does its own xmodmap based on the keyboard settings, which wipes out my custom xmodmap. So the solution is to set the keyboard to Generic 104-key PC in Keyboard Preferences.

On FVWM and GNOME

You probably want the following basics in your .fvwm2rc for GNOME 2.4:

Style "gnome-panel" NoTitle, !Borders, NeverFocus
# this emulates the default FVWM root menu. Notice the D context (see fvwm(1))
Mouse 1 RD A Menu MenuFvwmRoot

Oh and by the way, you need FVWM >= 2.5.x for GNOME 2.x, or a patch and a module for FVWM 2.4.x.