View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

SCJMeterBridge

A Class to automatically start and connect the JACK Meterbridge to the SC outputs.
(note: you need to have the program "meterbridge" installed on your system)

Just call

SCJMeterBridge(channels,meter_type,reflevel,prepend)

channels : an array of SC output channels you want to get connected.
meter_type : type of meter
reflevel : reference level for the meter (can normally be left to default option)
prepend : prepend to the command "meterbridge", e.g. "/my/installation/location/", so that meterbridge gets called with "/my/installation/location/meterbridge".

Note that to stop the meterbridge, you need to close its window. There is no method provided to do this from SC.

Other methods:

SCJMeterBridge.prepend

sets the prepend, so that you do not have to call it for the instantation
SCJMeterBridge.info

gives the info output of meterbridge if called with no arguments
SCJMeterBridge.typelist

gives the possible types



Save as a class file (SCJMeterBridge.sc):

// 2005, Marije Baalman

SCJMeterBridge { classvar <>no, <typelist, <>prepend;

	*initClass{
		no = 0;
		prepend = "";
		typelist = [ "dpm", "vu", "ppm", "jf", "sco" ];
	}

	*new { arg channels, type, reflevel, pre;
		^super.new.init(channels, type, reflevel, pre);
	}

	*info { arg pre;
		prepend = pre ? prepend;
		(prepend++"meterbridge").unixCmd;
	}

	init { arg channels, type, reflevel, pre;
		var meterbridge, correcttype;
		//nochan = nochan ? 1;
		//startchan = startchan ? 0;
		channels = channels ? [0];
		type = type ? "dpm";
		correcttype = false;
		prepend = pre ? prepend;
		typelist.do{ |it| if ( type == it , { correcttype = true } ) };
		if ( correcttype.not, 
			{ type = "dpm"; 
				("incorrect metertype; possible types " + typelist ++". Now displaying dpm type").postln; 
			} );
		meterbridge = prepend++"meterbridge -t"+ type + "-n SuperMeter"++no+ "-c" + channels.size;
		if ( reflevel.notNil , { meterbridge = meterbridge + "-r" + reflevel; });
		channels.do{ |it,i| meterbridge=meterbridge ++ " SuperCollider:out_" ++ (it+1); };
		meterbridge.unixCmd;
		no = no + 1;
	}
}


Link to this Page