/usr/lib/lv2/offset-swh.lv2/plugin.ttl is in swh-lv2 1.0.16+git20160519~repack0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | @prefix : <http://lv2plug.in/ns/lv2core#> .
@prefix swh: <http://plugin.org.uk/swh-plugins/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix swhext: <http://plugin.org.uk/extensions#> .
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
@prefix pprops: <http://lv2plug.in/ns/ext/port-props#> .
swh:offset a :Plugin ;
a :UtilityPlugin ;
doap:name "Offset, sample-based" ;
doap:maintainer [
foaf:name "Steve Harris";
foaf:homepage <http://plugin.org.uk/> ;
foaf:mbox <mailto:steve@plugin.org.uk> ;
] ;
doap:license <http://usefulinc.com/doap/licenses/gpl> ;
:documentation <http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html#offset> ;
:pluginProperty :hardRtCapable ;
:port [
a :InputPort, :ControlPort ;
:name "offset (in samples)" ;
:index 0 ;
:symbol "offset" ;
:minimum -24000 ;
:maximum 24000 ;
:rangeSteps 48001 ;
:default 0.0 ;
:portProperty :causesArtifacts ;
] ;
:port [
a :InputPort, :ControlPort ;
:name "automatable (possibly adds playback delay)" ;
:index 1 ;
:symbol "automatable" ;
:default 0.0 ;
:portProperty :toggled ;
] ;
:port [
a :InputPort, :AudioPort ;
:name "Input" ;
:index 2 ;
:symbol "input" ;
] ;
:port [
a :OutputPort, :AudioPort ;
:name "Output" ;
:index 3 ;
:symbol "output" ;
] ;
:port [
a :OutputPort, :ControlPort ;
:name "latency" ;
:index 4 ;
:symbol "latency" ;
:portProperty :reportsLatency ;
] ;
swhext:code """
#include "ladspa-util.h"
#define MAX_OFFSET 24000
#define BUFFER_LEN (MAX_OFFSET*2 + 1)
#define BUFFER_POS(a) (((a) + BUFFER_LEN) % BUFFER_LEN)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
""" ;
swhext:callback [
swhext:event "instantiate" ;
swhext:code """
buffer = calloc(BUFFER_LEN, sizeof(LADSPA_Data));
""" ;
] ;
swhext:callback [
swhext:event "activate" ;
swhext:code """
memset(buffer, 0, BUFFER_LEN * sizeof(LADSPA_Data));
plugin_data->buffer_w_pos = 0;
plugin_data->last_offset = 0;
""" ;
] ;
swhext:callback [
swhext:event "cleanup" ;
swhext:code """
free(plugin_data->buffer);
""" ;
] ;
swhext:callback [
swhext:event "run" ;
swhext:code """
long buffer_r_pos, offset_delta, i;
if (automatable > 0) {
// report the maximum offset as latency to the host
*(plugin_data->latency) = MAX_OFFSET;
// and delay by the maximum offset by default
// (results in no audible offset)
buffer_r_pos = BUFFER_POS(buffer_w_pos - MAX_OFFSET);
// apply user-configured offset (results in the desired offset):
buffer_r_pos = BUFFER_POS(buffer_r_pos + (long)offset);
} else {
// report the currently required latency
// (the LV2 specification does not allow a negative latency)
*(plugin_data->latency) = MAX((long)offset, 0);
// if delaying, apply the configured offset
// (otherwise we rely on the host's latency compensation)
buffer_r_pos = BUFFER_POS(buffer_w_pos + MIN((long)offset, 0));
}
// if the offset increased, zero the buffer accordingly
offset_delta = (long)offset - last_offset;
for (; offset_delta>0; offset_delta--) {
buffer[BUFFER_POS(buffer_r_pos - offset_delta)] = 0.0f;
}
for (i=0; i<sample_count; i++) {
buffer[buffer_w_pos] = input[i];
buffer_w_pos = BUFFER_POS(buffer_w_pos + 1);
buffer_write(output[i], buffer[buffer_r_pos]);
buffer[buffer_r_pos] = 0.0f;
buffer_r_pos = BUFFER_POS(buffer_r_pos + 1);
}
plugin_data->buffer_w_pos = buffer_w_pos;
plugin_data->last_offset = (long)offset;
""" ;
] ;
swhext:createdBy <http://plugin.org.uk/swh-plugins/toTurtle.xsl> .
|