Renaming etc
このコミットが含まれているのは:
		
						コミット
						2cfe624ff7
					
				| @ -1,19 +1,107 @@ | ||||
| // Class for binding to a TouchOSC interface | ||||
| // | ||||
| //  I don't feel well enough to actually code this today so here are some notes. | ||||
| //  - bind a /url to a function | ||||
| //  - provide builtins for linear and exponential controls | ||||
| //  - provide builtins for X-Y and modal/radio buttons | ||||
| // | ||||
| // | ||||
| 
 | ||||
| 
 | ||||
| TouchOSC { | ||||
| 	var <>ip, <>port; | ||||
| 	var <ip, <port=9000, controls; | ||||
| 
 | ||||
| 	*new { | ip, port | | ||||
| 		^super.new.init(ip, port) | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 	init { | aip, aport | | ||||
| 		ip = aip; | ||||
| 		port = aport; | ||||
| 		controls = (); | ||||
| 	} | ||||
| 
 | ||||
|     add { | name, control | | ||||
|         controls.put(name, control) | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| // // TODO: each of these needs to be able to write its value back | ||||
| // // to its TouchOSC control - this should be a fairly simple | ||||
| // // method like ~ctrlset and ~ctrlget | ||||
| // | ||||
| // // then call all of those on an iterator at startup to write the | ||||
| // // defaults to the controller | ||||
| // | ||||
| // ~mset = { | ||||
| // | name, oscurl, min, max, default, apply=({}), ctrlset=(~ctrlset), ctrlget=(~ctrlget), ctrlsend=(~ctrlsend) | | ||||
| // ~sets.put(name, ( | ||||
| // name: name, | ||||
| // oscurl: oscurl, | ||||
| // default: default, | ||||
| // min: min, | ||||
| // max: max, | ||||
| // v: default, | ||||
| // ctrlset: ctrlset, | ||||
| // ctrlget: ctrlget, | ||||
| // ctrlsend: ctrlsend, | ||||
| // apply: apply | ||||
| // )); | ||||
| // OSCdef.new( | ||||
| // 'osc' ++ name, | ||||
| // { | msg | | ||||
| // ~sets.at(name).ctrlset(msg); | ||||
| // ~sets.at(name).apply() }, | ||||
| // oscurl | ||||
| // ); | ||||
| // }; | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // } | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // ~sets = (); | ||||
| // | ||||
| // // The following two functions are the default methods for going from | ||||
| // // touchOSC control settings (0-1) to setting values as defined by min,max. | ||||
| // // Default uses linlin - for linexp or fancier stuff, override them. | ||||
| // // It's up to you to make sure they're mathematically inverse. | ||||
| // | ||||
| // | ||||
| // | ||||
| // ~ctrlset = { | self, msg | self.v = msg[1].linlin(0, 1, self.min, self.max); }; | ||||
| // | ||||
| // ~ctrlget = { | self |        self.v.linlin(self.min, self.max, 0, 1) }; | ||||
| // | ||||
| // ~ctrlexpset = { | self, msg | self.v = msg[1].linexp(0, 1, self.min, self.max); }; | ||||
| // | ||||
| // ~ctrlexpget = { | self |        self.v.linlin(self.min, self.max, 0, 1) }; | ||||
| // | ||||
| // | ||||
| // // getter and setter for an x-y control - the default, max and min are arrays | ||||
| // // of [ x, y ] pairs | ||||
| // | ||||
| // // note: msg is what we get from the OSC and x = 1, y = 2 | ||||
| // | ||||
| // ~ctrlxyset = { | ||||
| // | self, msg | | ||||
| // self.v[0] = msg[1].linlin(0, 1, self.min[0], self.max[0]); | ||||
| // self.v[1] = msg[2].linlin(0, 1, self.min[1], self.max[1]); | ||||
| // }; | ||||
| // | ||||
| // ~ctrlxyget = { | ||||
| // | self | | ||||
| // var vals = [ 0, 0 ]; | ||||
| // vals[0] = self.v[0].linlin(self.min[0], self.max[0], 0, 1); | ||||
| // vals[1] = self.v[1].linlin(self.min[1], self.max[1], 0, 1); | ||||
| // vals; | ||||
| // }; | ||||
| // | ||||
| // | ||||
| // // ~ctrlsend sends the current self.v back to the TouchOSC control, | ||||
| // // for when we send the defaults or load a patch | ||||
| // | ||||
| // ~ctrlsend = { | ||||
| // | self | | ||||
| // var ctrlval = self.ctrlget(); | ||||
| // [ "ctrlsend", self.oscurl, ctrlval ].postln; | ||||
| // ~touchosc.sendMsg(self.oscurl, ctrlval); | ||||
| // }; | ||||
|  | ||||
							
								
								
									
										45
									
								
								classes/TouchOSCControl.sc
									
									
									
									
									
										ノーマルファイル
									
								
							
							
						
						
									
										45
									
								
								classes/TouchOSCControl.sc
									
									
									
									
									
										ノーマルファイル
									
								
							| @ -0,0 +1,45 @@ | ||||
| 
 | ||||
| // fader, xy, radial, encoder, radar, radio, group, pager, grid | ||||
| 
 | ||||
| 
 | ||||
| // 1d - fader, radial | ||||
| // 2d - xy, radar | ||||
| // button | ||||
| // radio | ||||
| 
 | ||||
| 
 | ||||
| // OSCControl { | ||||
| // var <name, <url, <min, <max, <default, value, apply, set, get, send; | ||||
| // | ||||
| // *new { | name, url, min, max, default, apply | | ||||
| // ^super.new.init(name, url, min, max, default, apply) | ||||
| // } | ||||
| // | ||||
| // init { | aname, aurl, amin, amax, adefault, aapply | | ||||
| // name = aname; | ||||
| // url = aurl; | ||||
| // min = amin; | ||||
| // max = amax; | ||||
| // default = adefault; | ||||
| // apply = aapply; | ||||
| // value = adefault; | ||||
| // OSCdef.new( | ||||
| // 'osc' ++ name, | ||||
| // { | msg | | ||||
| // // msg => value | ||||
| // apply.value(value) | ||||
| // } | ||||
| // } | ||||
| // | ||||
| // | ||||
| // OSCdef.new( | ||||
| // 'osc' ++ name, | ||||
| // { | msg | | ||||
| // settings.at(name).ctrlset(msg); | ||||
| // settings.at(name).apply() }, | ||||
| // url | ||||
| // ); | ||||
| // | ||||
| // | ||||
| // | ||||
| // } | ||||
		読み込み中…
	
	
			
			x
			
			
		
	
		新しいイシューから参照
	
	ユーザーをブロックする