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

[sc-dev] bug in OSCMultiResponder



hallo,

in OSCresponder.sc, can this :

OSCMultiResponder : OSCresponder {
	var <>nodes;
	
	value { arg time, msg;
		var iterlist;
		iterlist = nodes.copy;
		iterlist.do({ arg node; node.action.value(time, node, msg) });
	}
	isEmpty { ^nodes.size == 0 }
	
}

... be changed into this :

OSCMultiResponder : OSCresponder {
	var <>nodes;
	
	value { arg time, msg, addr;
		var iterlist;
		iterlist = nodes.copy;
		iterlist.do({ arg node; node.value(time, msg, addr) });
	}
	isEmpty { ^nodes.size == 0 }
	
}


such as to pass the sender's NetAddr so OSCresponderNode s. i think calling node.value is more appropriate than node.action.value since this would allow subclasses to do things slightly different in their own value methods!

likewise, in OSCpathResponder.sc -> OSCpathDispatcher  : old :

	value { arg time, msg;
		var cmdPath, match, responder;
		super.value(time, msg);
		if (pathIndices.notNil, {
			cmdPath = [cmdName] ++ pathIndices.collect({ arg i; msg.at(i) });
			responder = OSCpathResponder(addr, cmdPath);
			match = pathResponders.findMatch(responder);
			if (match.notNil, {
				match.value(time, msg);
			});
			pathIndices.size.do({ arg i;
				responder.path.put(i,nil);
				match = pathResponders.findMatch(responder);
				if (match.notNil, {
					match.value(time, msg);
				});
			});
		});
	}	

new:

	value { arg time, msg, replyAddr;
		var cmdPath, match, responder;
		super.value(time, msg, replyAddr);
		if (pathIndices.notNil, {
			cmdPath = [cmdName] ++ pathIndices.collect({ arg i; msg.at(i) });
			responder = OSCpathResponder(addr, cmdPath);
			match = pathResponders.findMatch(responder);
			if (match.notNil, {
				match.value(time, msg, replyAddr);
			});
			pathIndices.size.do({ arg i;
				responder.path.put(i,nil);
				match = pathResponders.findMatch(responder);
				if (match.notNil, {
					match.value(time, msg, replyAddr);
				});
			});
		});
	}	



on a related thing, OSCpathResponder is broken for commands other than found in OSCpathDispatcher.cmdPathIndices . i tried to quickly find a fix, but the whole mechanism is so extremely tricky with methods jumping forth and backwards between super / sub / helper classes that i gave up. this should be probably rewritten in a more clear way.

thx, -sciss-