File: plugin.xml

package info (click to toggle)
swh-lv2 1.0.15%2B20111107.gitec6b85e-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 984 kB
  • sloc: xml: 11,701; ansic: 2,120; makefile: 103; sh: 19
file content (80 lines) | stat: -rw-r--r-- 2,249 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0"?>
<!DOCTYPE ladspa SYSTEM "ladspa-swh.dtd">
<?xml-stylesheet href="ladspa.css" type="text/css"?>

<ladspa>
  <global>
    <meta name="maker" value="Steve Harris &lt;steve@plugin.org.uk&gt;"/>
    <meta name="copyright" value="GPL"/>
    <meta name="properties" value="HARD_RT_CAPABLE"/>
    <code><![CDATA[
      #include "ladspa-util.h"
    ]]></code>
  </global>

  <plugin label="freqTracker" id="1418" class="AnalyserPlugin">
    <name>Frequency tracker</name>

    <callback event="instantiate"><![CDATA[
      fs = s_rate;
      f = 0.0f;
      fo = 0.0f;
      cross_time = 0;
      last_amp = 0.0f;
    ]]></callback>

    <callback event="activate"><![CDATA[
      cross_time = 0;
      f = 0.0f;
      fo = 0.0f;
      last_amp = 0.0f;
    ]]></callback>

    <callback event="run"><![CDATA[
      unsigned long pos;
      float xm1 = last_amp;
      const float damp_lp = (1.0f - speed) * 0.9f;
      const float damp_lpi = 1.0f - damp_lp;

      for (pos = 0; pos < sample_count; pos++) {
	if (input[pos] < 0.0f && xm1 > 0.0f) {
	  if (cross_time > 3.0f) {
	    f = fs / ((float)cross_time * 2.0f);
	  }
	  cross_time = 0;
	}
	xm1 = input[pos];
	cross_time++;
	fo = fo * damp_lp + f * damp_lpi;
	fo = flush_to_zero(fo);
	buffer_write(freq[pos], fo);
      }

      plugin_data->last_amp = xm1;
      plugin_data->fo = fo;
      plugin_data->f = f;
      plugin_data->cross_time = cross_time;
    ]]></callback>

    <port label="speed" dir="input" type="control" hint="default_middle">
      <name>Tracking speed</name>
      <p>This controls the level of damping applied to the output.</p>
      <p>High values will make the frequency output jump around, low values will make it a bit slow to respond.</p>
      <range min="0" max="1"/>
    </port>

    <port label="input" dir="input" type="audio">
      <name>Input</name>
    </port>

    <port label="freq" dir="output" type="audio">
      <name>Frequency (Hz)</name>
    </port>

    <instance-data label="fs" type="float" />
    <instance-data label="cross_time" type="int" />
    <instance-data label="last_amp" type="LADSPA_Data" />
    <instance-data label="f" type="LADSPA_Data" />
    <instance-data label="fo" type="LADSPA_Data" />
  </plugin>
</ladspa>