Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:ardourlua [26.01.2016 17:29]
rgareus created
wiki:ardourlua [24.02.2016 00:46] (current)
rgareus [LuaSession]
Line 1: Line 1:
 ====== Ardour Lua Scripting ====== ====== Ardour Lua Scripting ======
-~~DRAFT~~+moved to   http://manual.ardour.org/lua-scripting/
  
-Lua is a lightweight programming language which lends itself nicely to embedded into other applications.+===== Console Examples =====
  
-In Ardour's case Lua is available... 
- 
-  * DSP Scripts - audio processor plugins (per track) with access to the session 
-  * Session Scripts - global per session actions  
-  * Editor Action Scripts - user accessible actions (menu, bindings) 
-  * Editor Hooks - event triggered GUI actions 
-  * Script Console 
- 
-===== Why Lua? ===== 
- 
-small, lean, rt-safe. 
- 
-==== General Concepts ==== 
- 
-  * Ardour calls Lua (not the other way 'round). 
-  * No bound constructors. ardour provided factory methods. ie. Lua asks ardour to create objects (eg, new tracks) then get a reference to the object. 
- 
-===== DSP Scripts ===== 
- 
- 
- 
-===== Editor Examples ===== 
- 
-   
   print (Session:route_by_remote_id(1):name())   print (Session:route_by_remote_id(1):name())
      
Line 60: Line 36:
   # called when a new session is loaded:   # called when a new session is loaded:
   function new_session (name) print("NEW SESSION:", name) end   function new_session (name) print("NEW SESSION:", name) end
 +  
 +   
 +  route = Session:route_by_remote_id(1)
 +  processor = route:nth_plugin(0)
 +  plugininsert = processor:to_insert()
 +  
 +  plugin = plugininsert:plugin(0)
 +  print (plugin:label())
 +  print (plugin:parameter_count())
 +  
 +  x = ARDOUR.ParameterDescriptor ()
 +  _, t = plugin:get_parameter_descriptor(2, x) -- port #2
 +  paramdesc = t[2]
 +  print (paramdesc.lower)
 +  
 +  ctrl = ARDOUR.EvoralParameter(ARDOUR.AutomationType.PluginAutomation, 0, 2)
 +  ac = plugininsert:automation_control(ctrl, false)
 +  print (ac:get_value ())
 +  ac:set_value(1.0, PBD.GroupControlDisposition.NoGroup)
 +
 +===== LuaSession =====
 +
 +  for i,_ in AudioEngine:available_backends():iter() do print (i.name) end              
 +  backend = AudioEngine:set_backend("ALSA", "", "")
 +  print (AudioEngine:current_backend_name())
 +  for i,_ in backend:enumerate_devices():iter() do print (i.name) end
 +  backend:set_input_device_name("HDA Intel PCH")
 +  backend:set_output_device_name("HDA Intel PCH")
 +  print (backend:buffer_size())
 +  print (AudioEngine:get_last_backend_error())
 +  
 +  s = load_session ("/home/rgareus/Documents/ArdourSessions/lua2/", "lua2")
 +  s:request_transport_speed (1.0)
 +  print (s:transport_rolling())
 +  s:goto_start()
 +  close_session()
  
 
wiki/ardourlua.1453825744.txt.gz · Last modified: 26.01.2016 17:29 by rgareus