--[[ Example Augustus Loop MIDI customisation script. By expertsleepers, 2/10/2008. This script is an example of how you can use the setOthersParameter() function to create a multi-plug-in looping system. To use this as intended you will need to load four copies of Augustus Loop into your host app, and set the OSC Port on them to the values 1 to 4. Then configure your MIDI routing to send incoming MIDI to just one of the four. --]] -- you can use 'print' to help with debugging -- on Mac OS X, the output will appear in console.log - use the Console utility to view it -- if your script contains errors and cannot be run, an error message will appear in the same place print ( "Augustus Loop 'MultiLoop' script running at ", os.date() ) -- define the state variables local currentLoop = 1 local maxLoop = 4 -- get the parameter IDs that we want to control -- setParameter() will work with a parameter name, but it's more efficient to find the ID from the -- name here once, and then use the ID local paramID_InputLevel = getParameterID( "Input Level" ) local paramID_FreezeLoop = getParameterID( "Freeze Loop" ) local paramID_ClearLoop = getParameterID( "Clear Loop" ) -- define the functions that will handle events -- local function setupMultiloop( channel, noteNumber, velocity ) for i=1,maxLoop,1 do setOthersParameter( i, paramID_InputLevel, 0.0 ) setOthersParameter( i, "Sync Group Mode", 3 ) setOthersParameter( i, "Sync Group Number", 1 ) setOthersParameter( i, "Punch In Set Input Level", 1 ) setOthersParameter( i, "Punch Out Set Input Level", 1 ) end end -- local function selectPreviousLoop( channel, noteNumber, velocity ) if currentLoop > 1 then currentLoop = currentLoop - 1 end end -- local function selectNextLoop( channel, noteNumber, velocity ) if currentLoop < maxLoop then currentLoop = currentLoop + 1 end end -- local function toggleOpenCurrentLoop( channel, noteNumber, velocity ) local v = getOthersParameter( currentLoop, paramID_InputLevel ) setOthersParameter( currentLoop, paramID_InputLevel, 1-v ) end -- local function toggleFreezeCurrentLoop( channel, noteNumber, velocity ) local v = getOthersParameter( currentLoop, paramID_FreezeLoop ) setOthersParameter( currentLoop, paramID_FreezeLoop, 1-v ) end -- local function clearCurrentLoop( channel, noteNumber, velocity ) setOthersParameter( currentLoop, paramID_ClearLoop, 1 ) end -- finally, request that the functions above be called on the appropriate MIDI events requestNoteOn( 76, setupMultiloop ) requestNoteOn( 77, selectPreviousLoop ) requestNoteOn( 78, selectNextLoop ) requestNoteOn( 79, toggleOpenCurrentLoop ) requestNoteOn( 80, toggleFreezeCurrentLoop ) requestNoteOn( 81, clearCurrentLoop )