summaryrefslogtreecommitdiffstats
path: root/arts/modules/effects/synth_stereo_pitch_shift_fft_impl.cpp
blob: 390fd04eb0fe8d2d5d2c816a159f1d6dcbb8167c (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
52
53
54
55
56
57
58
59
60
61
62
63
#include "flowsystem.h"
#include "artsmoduleseffects.h"
#include "stdsynthmodule.h"

using namespace Arts;

class Synth_STEREO_PITCH_SHIFT_FFT_impl : virtual public Synth_STEREO_PITCH_SHIFT_FFT_skel,
									  virtual public StdSynthModule
{
protected:
	Synth_PITCH_SHIFT_FFT leftPitchShift, rightPitchShift;
	
public:
	float speed() { return leftPitchShift.speed(); }
	void speed(float newSpeed)
	{
		leftPitchShift.speed(newSpeed);
		rightPitchShift.speed(newSpeed);
	}

	float scaleFactor() { return leftPitchShift.scaleFactor(); }
	void scaleFactor(float newScaleFactor)
	{
		leftPitchShift.scaleFactor(newScaleFactor);
		rightPitchShift.scaleFactor(newScaleFactor);
	}

	long frameSize() { return leftPitchShift.frameSize(); }
	void frameSize(long newFrameSize)
	{
		leftPitchShift.frameSize(newFrameSize);
		rightPitchShift.frameSize(newFrameSize);
	}

	long oversample() { return leftPitchShift.oversample(); }
	void oversample(long newOversample)
	{
		leftPitchShift.oversample(newOversample);
		rightPitchShift.oversample(newOversample);
	}

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

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

REGISTER_IMPLEMENTATION(Synth_STEREO_PITCH_SHIFT_FFT_impl);