<?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"/>
	</global>

	<plugin label="shaper" id="1187" class="WaveshaperPlugin">
		<name>Wave shaper</name>
		<p>This plugin reshapes the wave by an exponential function, inspiration was taken from the Nord module of the same name.</p>
		<p>If you are getting rubbish out then it's probably because the host isn't using the input/output range hints, which are very important for this plugin.</p>

		<callback event="run"><![CDATA[
int pos;
float shape = 0.0f;

if (shapep < 1.0f && shapep > -1.0f) {
	shape = 1.0f;
} else if (shape < 0) {
	shape = -1.0f / shape;
} else {
	shape = shapep;
}

for (pos = 0; pos < sample_count; pos++) {
	if (input[pos] < 0.0f) {
		buffer_write(output[pos], -pow(-input[pos], shape));
	} else {
		buffer_write(output[pos], pow(input[pos], shape));
	}
}
		]]></callback>

		<port label="shapep" dir="input" type="control" hint="default_0">
			<name>Waveshape</name>
			<p>Positive values have an expanding effect, and negative values have a compressing effect.</p>
			<range min="-10" max="+10"/>
		</port>

		<port label="input" dir="input" type="audio">
			<name>Input</name>
			<range min="-1" max="+1"/>
		</port>

		<port label="output" dir="output" type="audio">
			<name>Output</name>
			<range min="-1" max="+1"/>
		</port>
	</plugin>
</ladspa>

