-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.scd
140 lines (109 loc) · 3.96 KB
/
main.scd
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
129
130
131
132
133
134
135
136
137
138
139
140
topEnvironment.push; // this must be always executed in the toplevel Environment (FIXME: break current project when reinitilized)
////////////////////////////
// - used by Veco class to load projects
// - each project sit in its own environment, class_project_manager always manage the current project in the current environment
// - if you load a project when there is already a project loaded in the environment, the old one is destructed (free resources)
// - a project is a class_veco_sceneset (~veco, Veco.main) and a class_score_manager (~score_storage)
// - open_project in fact use ~veco.open_project which load all node (1.scd, etc) file then init file (init.scd)
// - when the view (launchpad) request a clip, it ask the node which create it from the associated file (1.1.scd) on demand
//
// - class_project_manager is a kind of project slot handler that free previous project when a new one is loaded
// - switching projects is just replacing the launchpad midi responder with one of a different project and pushing the project env
///////////////////////////
// following variables deprecated, use Veco.extension_path and Veco.user_path
//~veco_dir_path = Platform.userExtensionDir +/+ "seco/seco/veco";
//~veco_code_path = "~/code/sc/seco/vlive/".standardizePath;
"=======================================================================".inform;
"loading Veco...".inform;
"=======================================================================".inform;
~make_class_responder = { arg self, parent, model, list, auto_refresh=true;
var controller;
controller = SimpleController(model);
list.do { arg method;
controller.put(method, { arg ... args; self[method].(self, *args) });
};
parent.onClose = parent.onClose.addFunc { controller.remove };
if(auto_refresh) { model.refresh() };
controller;
};
VecoLib.load_lib;
"~/seco/seco/synth.scd".standardizePath.load;
"~/.local/share/SuperCollider/Extensions/seco/seco/eventscore.scd".standardizePath.load;
[
//"tile",
"recorder",
"buffer",
"launchpad",
"score",
"sdef",
"launchpad_editor",
"launchpad_gui",
"inline_editor",
"sendpad",
].do { arg file;
("Loading " ++ file ++".scd...").inform;
(Veco.extension_path +/+ file++".scd").load;
};
"Done loading.".inform;
//~veco = ~class_veco_buffer_manager.new;
//~veco = ~class_veco.new;
~closer_responder = { arg view, char, modifiers, u, k;
//["tempo", modifiers, u].debug("KEYBOARD INPUT");
if( u == 27 ) { view.close() };
//if( u == ~keycode.kbspecial.enter ) { validate_action.(); close_window.(); };
};
BusDef(\null, \audio);
BusDef(\zero, \audio);
~scenestate = (
state_edit: 0,
//state_seq: Array2D.new(8,8),
state_leds: Array2D.new(9,8),
state_seq: Array2D.fromArray(8,8, Array.fill(8*8, 1)),
state_mode_leds: Array.fill(8, \off),
state_play: Array2D.new(8,8),
state_buffers: Array2D.new(8,8),
state_subbuffers: Array2D.new(8,8),
cleanup_function: {
//~sceneset.tile.reset_play_state
}
);
//~sceneset = (
// tile: ~launchpad_scene_tile.new,
// subbuffer: ~launchpad_scene_subbuffer.new,
// seq: ~launchpad_scene_seq.new,
// active_row: 1,
//).putAll(~scenestate);
~class_project_manager = (
new: { arg self;
self = self.deepCopy;
self;
},
reset_board: {
if(~veco.notNil) {
~veco.project_destructor;
};
~veco = ~class_veco_sceneset.new;
~veco.putAll(~scenestate);
//Veco.main = ~veco;
~score_storage = ~class_score_manager.new;
},
open_project: { arg self, path, activate=true;
path.debug("=========================######### Start loading project");
self.reset_board;
~veco.open_project(path);
if(activate != false) {
~veco.clip.activate;
};
path.debug("=========================######### End loading project");
},
open_side_project: { arg self, path;
// NOT USED!
self.reset_side_slot(path);
self.side_slot(path).open_project(path);
if(self.projects[path].notNil) {
};
self.projects[path] = Environment.new;
},
);
~veco_project_manager = ~class_project_manager.new;
//~veco_project_manager.reset_board;