summaryrefslogtreecommitdiffstats
path: root/arts/modules/effects/synth_stereo_pitch_shift_impl.cc
blob: fbf7bb07c26afddbecac4bfb064f862266494ccb (plain)
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
#include "flowsystem.h"
#include "artsmoduleseffects.h"
#include "stdsynthmodule.h"

#include <artsmodulessynth.h>

using namespace Arts;

class Synth_STEREO_PITCH_SHIFT_impl : virtual public Synth_STEREO_PITCH_SHIFT_skel,
                                      virtual public StdSynthModule
{
protected:
	Synth_PITCH_SHIFT leftPitchShift, rightPitchShift;
	
public:
	float speed() { return leftPitchShift.speed(); }
	void speed(float newSpeed)
	{
		leftPitchShift.speed(newSpeed);
		rightPitchShift.speed(newSpeed);
	}

	float frequency() { return leftPitchShift.frequency(); }
	void frequency(float newFrequency)
	{
		leftPitchShift.frequency(newFrequency);
		rightPitchShift.frequency(newFrequency);
	}

	void streamStart()
	{
		leftPitchShift.start();
		rightPitchShift.start();
		_node()->virtualize("inleft",leftPitchShift._node(),"invalue");
		_node()->virtualize("outleft",leftPitchShift._node(),"outvalue");
		_node()->virtualize("inright",rightPitchShift._node(),"invalue");
		_node()->virtualize("outright",rightPitchShift._node(),"outvalue");
	}

	void streamEnd()
	{
		_node()->devirtualize("inleft",leftPitchShift._node(),"invalue");
		_node()->devirtualize("outleft",leftPitchShift._node(),"outvalue");
		_node()->devirtualize("inright",rightPitchShift._node(),"invalue");
		_node()->devirtualize("outright",rightPitchShift._node(),"outvalue");
		leftPitchShift.stop();
		rightPitchShift.stop();
	}
};

REGISTER_IMPLEMENTATION(Synth_STEREO_PITCH_SHIFT_impl);