summaryrefslogtreecommitdiff
path: root/interfaces02.h
blob: 85f2543859506b79a40506d76755c827ba2c5f79 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
requirement driven design

do we store graphs as files or in a db with UUID as key?

do we traverse the graph as direct recursive function calls or programmatically from outside?
or keep a reference to the container graph in each node?

graph parent;
vector<signal_input> signal_inputs;
vector<image_input> image_inputs;

//in input
int input_id;


&image get_ouput()
{
	for (int i=0;i<inputs.size;i++){
		if (inputs[i].input_id) parent.nodes[input_id].get_output(); ///how to find the output in the node? uids for everything?
	}

	render();
	return &image_data;
}

OR

for (int i=0;i<inputs.size;i++){
	if (inputs[i].connection) inputs[i].connection->get_output(); ///methinks this is neater? you can check pointer for NULL, can't be ref
}

NO NODE HAS MORE THAN ONE OUTPUT
WE DON'T LINK TO AN OUTPUT OBJECT WE LINK TO THE NODE - GET_OUTPUT IS THE RENDER FUNCTION

settings - how do we deal with settings being controllable
signal inputs can have a gui representation as well
other gui items don't have an input

scaling to come

time is always in floating points seconds - time has to be requested when rendering - either a preview
what about testing a float for equality?
maybe we should look at time in int (frames) - - what does this imply



*/

#define ROTOR_READY 0
#define ROTOR_ANALYSING_AUDIO 1
#define ROTOR_CREATING_PREVIEW 2
#define ROTOR_RENDERING 3

namespace Rotor {
	class Render_context{							//Poco thread object
												//manages access to the 'patchbay'
												//high level interfaces for the wizard
												//and low level interface onto the graph
		public:
			int get_status();
			float get_progress():
			void cancel();							//interrupt locking process
			int make_preview(int nodeID, float time); 	//starts a frame preview - how to retrieve?
			int load_graph(Poco::UUID uid);
		private:
			int status;
			float progress;							//for a locking process: audio analysis or rendering
			
	}
	class Graph{
		public:
			Poco::UUID uid;						//every version of a graph has a UUID
		private:
			unordered_map<int,Base_node> nodes;
	}
	class Input{
		public:
			Node* connection;
			
	};
	class Image_input: public Base_input{
		public:

	};
	class Signal_input: public Base_input{
		public:

	};
	class Node{
		public:
			Poco::UUID uid;						//every usable node has a UUID
			int id;
			vector<Signal_input> inputs;				//simple node has signal inputs and outputs
			void gather_inputs(float time) {
				for (int i=0;i<inputs.size;i++){
					if (inputs[i].connection) inputs[i].connection->get_output();
				}
			}
			virtual &float get_ouput(float time);
			
	};
	class Image_node: public Node{
		public:
			vector<Image_input> image_inputs;		//image node also has image inputs and outputs
			void gather_inputs(float time) {
				for (int i=0;i<inputs.size;i++){
					if (inputs[i].connection) inputs[i].connection->get_output();
				}
			}
			&Image get_ouput(float time){			//sample implementation
				gather_inputs();
				//do something: i.e
				
				//and then
				return &image_data;
			}
			void get_preview(float time);
		private:
			Image* image; 						//this can be privately allocated or just passed on as the node see fit
			float image_time;
	};
}

/*
coding style
Types begin with a capital, use underscore as a seperator
*/