File: LV2NetworkPlayer.hxx

package info (click to toggle)
clam 1.4.0-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 17,836 kB
  • ctags: 20,981
  • sloc: cpp: 92,504; python: 9,721; ansic: 1,602; xml: 444; sh: 239; makefile: 153; perl: 54; asm: 15
file content (86 lines) | stat: -rw-r--r-- 2,198 bytes parent folder | download | duplicates (2)
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
#ifndef LV2NetworkPlayer_hxx
#define LV2NetworkPlayer_hxx
#include <vector>
#include <lv2.h>
#include <math.h>
#include <iostream>

#include <CLAM/Network.hxx>
#include <CLAM/AudioSource.hxx>
#include <CLAM/AudioSink.hxx>
#include <CLAM/ControlSource.hxx>
#include <CLAM/ControlSink.hxx>
#include <CLAM/PushFlowControl.hxx>
#include <CLAM/XMLStorage.hxx>
#include <CLAM/NetworkPlayer.hxx>

namespace CLAM
{

class LV2NetworkPlayer : public NetworkPlayer
{
	template<class T>
		class LV2Info
		{
		public:
			std::string name;
			T* processing;
			float *dataBuffer;
			unsigned port;
		};

private:
	typedef std::vector<float * > Buffers;
	Buffers _sourceBuffers;
	Buffers _sinkBuffers;
	Buffers _inControlBuffers;
	Buffers _outControlBuffers;

	typedef std::vector<CLAM::ControlSource*> InControlList;
	typedef std::vector<CLAM::ControlSink*> OutControlList;
private:
	typedef std::vector< LV2Info<CLAM::ControlSource> > LV2InControlList;
	typedef std::vector< LV2Info<CLAM::ControlSink> > LV2OutControlList;

	CLAM::Network _network;
	LV2InControlList mInControlList;
	LV2OutControlList mOutControlList;

	unsigned long mClamBufferSize;
	unsigned long mExternBufferSize;
		
public:
	LV2NetworkPlayer(const LV2_Descriptor * descriptor);
	~LV2NetworkPlayer();

	void ActivateExporter();
	void DeactivateExporter();
	void CleanupExporter();
	void InstantiateExporter();
	void ConnectPortExporter(uint32_t port, void *data);
	void RunExporter(uint32_t nframes);
	static LV2_Descriptor * CreateLV2Descriptor(
		const std::string & networkXmlContent,
		const std::string & uri
	);

	void ProcessOutControlValues();
	void SetAudioSinkBuffers(const unsigned long nframes);
	void SetAudioSourceBuffers(const unsigned long nframes);
	void UpdatePortFrameAndHopSize();	
	void ProcessInControlValues();
	void LocateConnections();
public: // NetworkPlayer interface
	virtual bool IsWorking() { return true; }
	virtual std::string NonWorkingReason() { return ""; }
	virtual void Start() {}
	virtual void Stop() {}
//	virtual void Pause() {}
	virtual bool IsRealTime() const { return true; }
//	virtual unsigned BackendBufferSize();
//	virtual unsigned BackendSampleRate();

};
}

#endif //LV2NetworkPlayer_hxx