osamc.de/archiv/ardourscripting/index.html

165 lines
11 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Ardour Scripting 101</title><meta content="yes" name="apple-mobile-web-app-capable"><meta content="black-translucent" name="apple-mobile-web-app-status-bar-style"><meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" name="viewport"><link href="reveal.js/css/reveal.css" rel="stylesheet"><link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme"><!--This CSS is generated by the Asciidoctor-Reveal.js converter to further integrate AsciiDoc's existing semantic with Reveal.js--><style type="text/css">.reveal div.right {
float: right;
}
/* callouts */
.conum[data-value] {display:inline-block;color:#fff!important;background-color:rgba(50,150,50,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]:after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}</style><link href="reveal.js/lib/css/zenburn.css" rel="stylesheet"><script>var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? "reveal.js/css/print/pdf.css" : "reveal.js/css/print/paper.css";
document.getElementsByTagName( 'head' )[0].appendChild( link );</script><!--[if lt IE 9]><script src="reveal.js/lib/js/html5shiv.js"></script><![endif]--></head><body><div class="reveal"><div class="slides"><section class="title" data-state="title"><h1>Ardour Scripting 101</h1><div class="preamble"><div class="paragraph"><p><a href="https://osamc.de/">Open Source Audio Meeting Cologne</a></p></div>
<div class="paragraph"><p><a href="https://github.com/danielappelt" target="_blank">Daniel Appelt</a> / 2019-11-20</p></div></div></section>
<section id="_what"><h2>What?</h2><div class="ulist"><ul><li class="fragment"><p>Scripting allows to add functionality to Ardour&#8217;s core</p></li><li class="fragment"><p>Scripts can hook into different parts of Ardour</p></li><li class="fragment"><p>Some scripts are shipped by default</p></li><li class="fragment"><p>Scripting language is <a href="https://lua.org" target="_blank">Lua</a></p></li><li class="fragment"><p>New Ardour releases include new features and scripts</p></li></ul></div>
<aside class="notes"><div class="ulist"><ul><li><p>Supported since version 4.7.213</p></li><li><p>Scripting console, Editor actions, Hooks / Signals, DSP processors, Session scripts</p></li></ul></div></aside></section>
<section><section id="_where"><h2>Where?</h2></section><section id="_in_the_file_system"><h2>In the file system</h2><div class="ulist"><ul><li><p>Users can add further scripts to their installation</p></li><li><p>Linux: $HOME/.config/ardour5/scripts</p></li></ul></div></section><section id="_in_the_application"><h2>In the application</h2><div class="ulist"><ul><li class="fragment"><p>Menu → Window → Scripting</p></li><li class="fragment"><p>Menu → Edit → Scripted Actions (and Hooks)</p></li><li class="fragment"><p>Menu → Session → Scripting</p></li><li class="fragment"><p>Mixer-strip → context menu (right click) → New Lua Proc</p></li></ul></div></section></section>
<section id="_how"><h2>How?</h2><div class="ulist"><ul><li class="fragment"><p><a href="https://manual.ardour.org/scripting/" target="_blank">Ardour Scripting Documentation</a></p></li><li class="fragment"><p><a href="https://github.com/Ardour/ardour/tree/master/scripts" target="_blank">Ardour scripting examples</a></p></li><li class="fragment"><p><a href="https://github.com/Ardour/ardour/blob/master/gtk2_ardour/luainstance.cc" target="_blank">Deep dive into code</a></p></li><li class="fragment"><p><a href="https://github.com/Ardour/ardour/blob/master/gtk2_ardour/luasignal_syms.h" target="_blank">Supported signals</a></p></li></ul></div></section>
<section id="_minimal_code_example"><h2>Minimal code example</h2><pre class="highlight listingblock"><code data-noescape class="lua language-lua">ardour {
["type"] = "EditorAction",
name = "Rewind",
}
function factory (unused_params)
return function ()
Session:goto_start() -- rewind the transport
end
end</code></pre></section>
<section id="_mastering_lua"><h2>Mastering Lua?</h2><div class="ulist"><ul><li class="fragment"><p><a href="https://devhints.io/lua" target="_blank">Lua Cheatsheet</a></p></li><li class="fragment"><p><a href="https://www.lua.org/pil/contents.html" target="_blank">Programming in Lua</a></p></li><li class="fragment"><p><a href="https://www.lua.org/manual/5.3/" target="_blank">Lua Reference Manual</a></p></li></ul></div></section>
<section id="_conclusion"><h2>Conclusion</h2><div class="ulist"><ul><li class="fragment"><p>Scripting allows to add "missing" functionality</p></li><li class="fragment"><p>Available Lua API is already huge</p></li><li class="fragment"><p>Still, there are some missing parts and inconsistencies</p></li></ul></div>
<aside class="notes"><div class="ulist"><ul><li><p>Sometimes you have to write ugly code to achieve simple things</p></li><li><p>Selection hooks are missing, for example</p></li><li><p>collectgarbage(), non-unified naming</p></li></ul></div></aside></section>
<section><section id="_extra"><h2>Extra</h2></section><section id="_ardour_lua_plugin_of_the_month"><h2><a href="https://github.com/Ardour/ardour/blob/master/scripts/lfo_automation.lua" target="_blank">(Ardour Lua) Plugin of the month</a></h2></section></section></div></div><script src="reveal.js/lib/js/head.min.js"></script><script src="reveal.js/js/reveal.js"></script><script>Array.prototype.slice.call(document.querySelectorAll('.slides section')).forEach(function(slide) {
if (slide.getAttribute('data-background-color')) return;
// user needs to explicitly say he wants CSS color to override otherwise we might break custom css or theme (#226)
if (!(slide.classList.contains('canvas') || slide.classList.contains('background'))) return;
var bgColor = getComputedStyle(slide).backgroundColor;
if (bgColor !== 'rgba(0, 0, 0, 0)' && bgColor !== 'transparent') {
slide.setAttribute('data-background-color', bgColor);
slide.style.backgroundColor = 'transparent';
}
})
// See https://github.com/hakimel/reveal.js#configuration for a full list of configuration options
Reveal.initialize({
// Display presentation control arrows
controls: true,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: true,
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: 'bottom-right',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: 'faded',
// Display a presentation progress bar
progress: true,
// Display the page number of the current slide
slideNumber: false,
// Control which views the slide number displays on
showSlideNumber: 'all',
// Push each slide change to the browser history
history: false,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Vertical centering of slides
center: true,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// Randomizes the order of slides each time the presentation loads
shuffle: false,
// Turns fragments on and off globally
fragments: true,
// Flags whether to include the current fragment in the URL,
// so that reloading brings you to the same fragment position
fragmentInURL: false,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: true,
// Flags if speaker notes should be visible to all viewers
showNotes: false,
// Global override for autolaying embedded media (video/audio/iframe)
// - null: Media will only autoplay if data-autoplay is present
// - true: All media will autoplay, regardless of individual setting
// - false: No media will autoplay, regardless of individual setting
autoPlayMedia: null,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Use this method for navigation when auto-sliding
autoSlideMethod: Reveal.navigateNext,
// Specify the average time in seconds that you think you will spend
// presenting each slide. This is used to show a pacing timer in the
// speaker view
defaultTiming: 120,
// Enable slide navigation via mouse wheel
mouseWheel: false,
// Hides the address bar on mobile devices
hideAddressBar: true,
// Opens links in an iframe preview overlay
// Add `data-preview-link` and `data-preview-link="false"` to customise each link
// individually
previewLinks: false,
// Transition style (e.g., none, fade, slide, convex, concave, zoom)
transition: 'slide',
// Transition speed (e.g., default, fast, slow)
transitionSpeed: 'default',
// Transition style for full page slide backgrounds (e.g., none, fade, slide, convex, concave, zoom)
backgroundTransition: 'fade',
// Number of slides away from the current that are visible
viewDistance: 3,
// Parallax background image (e.g., "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'")
parallaxBackgroundImage: '',
// Parallax background size in CSS syntax (e.g., "2100px 900px")
parallaxBackgroundSize: '',
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal: null,
parallaxBackgroundVertical: null,
// The display mode that will be used to show slides
display: 'block',
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 960,
height: 700,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.5,
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
{ src: 'reveal.js/plugin/notes/notes.js', async: true },
],
});</script></body></html>