[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] CocoaBridge bug



Hi,

On Feb 23, 2008, at 12:13 AM, thelych wrote:

Hi all,

seems i'm the only one playing with CocoaBridge (or Midi
Sysex :-))... i am not very up-to-date but.. anyway

probably, because since Ryan's excellent CocoaCollider < http:// www.wabdo.com/CocoaCollider/index.html > there wasn't any further development of the CocoaBridge. Probably it should be removed.

Best,
Jan




Jan, 'double's do not pass well to cocoa objects when using invocation

example: (from the doc)

(
var winname = "cocoa test", win, nsname, slider;
nsname = SCNSObject("NSString","initWithCString:length:", [winname,
winname.size], false);

win = SCNSObject("NSWindow",
"initWithContentRect:styleMask:backing:defer:",
	[Rect(100,140,400,30), 10, 2, 1]);
win.setDelegate.action_({
	"closing window, releasing objects".postln;
	[winname,nsname,slider,e].do{|it| it.release};
});

slider = SCNSObject("NSSlider", "initWithFrame:", [Rect(0,0,390,20)]);
e = SCNSObject("SCGraphView", "initWithFrame:", [Rect(0,0,400,30)]);

win.invoke("setContentView:", [e], true);
e.invoke("addSubview:", [slider], true);

slider.invoke("setFloatValue:", [0.5]);	// OK for FLOATs
slider.invoke("setMaxValue:", [300.0]);	// Here Problems for double
values -> zeroed
slider.invoke("setMinValue:", [10.0]);	// Same here....

slider.invoke("maxValue").postln;	 // Result is 0
slider.invoke("minValue").postln;	// Result is 0

win.invoke("makeKeyAndOrderFront:", [nil], true);
win.invoke("setTitle:", [nsname]);

{a = slider.initAction;
a.action_({|v,val| val.postln});}.defer(0.1); // WELL... ZERO...
)


//// in CocoaBridgePrimitives.M:278
if(!(*cType == _C_FLT || *cType == _C_DBL)){post("wrong type at arg: %
i excepted float\n", i); return errWrongType;}
float val;
slotFloatVal(slot, &val);				
[anInvocation setArgument: &val atIndex: i+2];  /// <---  if _C_DBL
we should pass a reference to a double, the reference to a float  do
not work for this case.


Best,

thelych
_______________________________________________
sc-dev mailing list
sc-dev@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-dev