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

[sc-dev] SF.net SVN: quarks:[1304] dewdrop_lib



Revision: 1304
          http://quarks.svn.sourceforge.net/quarks/?rev=1304&view=rev
Author:   jamshark70
Date:     2009-12-29 14:24:31 +0000 (Tue, 29 Dec 2009)

Log Message:
-----------
Fixes for chucklib events for new osc scheduling methods, ModalSpec tuning implementation, cleaner Pdelta, latency handling in voicerNote event type, support susPedal for VoicerProxy

Modified Paths:
--------------
    dewdrop_lib/ddwChucklib/Prototypes/startup01-events.scd
    dewdrop_lib/ddwCommon/Misc/ModalSpec.sc
    dewdrop_lib/ddwPatterns/ddwFilterPatterns.sc
    dewdrop_lib/ddwVoicer/Voicer.sc
    dewdrop_lib/ddwVoicer/VoicerProxy.sc

Modified: dewdrop_lib/ddwChucklib/Prototypes/startup01-events.scd
===================================================================
--- dewdrop_lib/ddwChucklib/Prototypes/startup01-events.scd	2009-12-27 11:05:20 UTC (rev 1303)
+++ dewdrop_lib/ddwChucklib/Prototypes/startup01-events.scd	2009-12-29 14:24:31 UTC (rev 1304)
@@ -236,6 +236,7 @@
 				thisThread.clock.sched(sustain, {
 					Func(\schedEventBundle).doAction(lag, offset, server,
 						[\n_set, nodeID, \gate, releaseGate]);
+					nil
 				});
 			});
 		});
@@ -274,7 +275,7 @@
 	})
 })) => ProtoEvent(\singleSynthTrigger);
 
-ProtoEvent.composite(#[polySynthTrigger, polySynthPlayNotify, singleSynthTrigger, singleSynthPlayNotify]) => ProtoEvent(\monoSupport);
+ProtoEvent.composite(#[singleSynthTrigger, singleSynthPlayNotify, polySynthTrigger, polySynthPlayNotify]) => ProtoEvent(\monoSupport);
 
 
 ProtoEvent(\singleSynthPlayer).v.copy.putAll((
@@ -378,6 +379,7 @@
 				thisThread.clock.sched(sustain, {
 					Func(\schedEventBundle).doAction(latency, offset, server,
 						[\n_set, nodeID, \gate, releaseGate]);
+					nil
 				});
 			});
 		});
@@ -455,7 +457,7 @@
 		
 			// for args array to be valid (argName, value pairs), must have at least 2 items
 		(~args.size < 2).if({ ~args = nil });
-		~voicer !? {
+		if(~voicer.notNil and: { ~nodes.isNil }) {
 			~nodes = ~voicer.prGetNodes(max(~newFreq.size, max(~length.size, ~gate.size)));
 			~voicer.setArgsInEvent(currentEnvironment);
 		};

Modified: dewdrop_lib/ddwCommon/Misc/ModalSpec.sc
===================================================================
--- dewdrop_lib/ddwCommon/Misc/ModalSpec.sc	2009-12-27 11:05:20 UTC (rev 1303)
+++ dewdrop_lib/ddwCommon/Misc/ModalSpec.sc	2009-12-29 14:24:31 UTC (rev 1304)
@@ -9,7 +9,7 @@
 	var	<>scale,			// representation of intervals starting with 0: [0, 2, 4] = do re mi
 		<>stepsPerOctave,	// what's top of scale?
 		<>root,			// semitones above midinote 0
-		<>tuning = 0,		// degree -> key, this is added to output midi note; ignored on unmap
+		<>tuning = 0,		// cpsFunc adds this to output frequency
 		<cpsFunc;		// a function or Tuning object to convert note numbers to cps
 	
 	var	<degToKey, <keyToDeg;	// conversion dictionaries
@@ -51,7 +51,8 @@
 			degToKey.put(v, k);	// reverse lookup
 		});
 		
-		cpsFunc ?? { cpsFunc = _.midicps };
+			// cpsFunc_ provides a default
+		this.cpsFunc = cpsFunc;
 	}
 
 		// note: using object.mapMode(mode) directly is slightly faster
@@ -85,7 +86,7 @@
 			degToKey[degree.asInteger % scale.size] + (num * num.fuzzygcd(1).reciprocal)
 		}))
 			+ ((degree / scale.size).trunc * stepsPerOctave)
-			+ root + tuning;
+			+ root // + tuning;
 	}
 	
 	addSteps { arg degree, steps;	// add steps semitones to degree
@@ -121,7 +122,7 @@
 	}
 	
 	cpsFunc_ { |func|
-		cpsFunc = func ?? { _.midicps };
+		cpsFunc = func ? { |midi| (midi + tuning).midicps };
 	}
 	
 		// transpose the scale so that the root is different but the modal notes are the same

Modified: dewdrop_lib/ddwPatterns/ddwFilterPatterns.sc
===================================================================
--- dewdrop_lib/ddwPatterns/ddwFilterPatterns.sc	2009-12-27 11:05:20 UTC (rev 1303)
+++ dewdrop_lib/ddwPatterns/ddwFilterPatterns.sc	2009-12-29 14:24:31 UTC (rev 1304)
@@ -76,17 +76,18 @@
 		var	stream = pattern.asStream,
 			lastValue, value;
 		(lastValue = stream.next(inval)).isNil.if({ ^inval });
-		inf.do({
-			(value = stream.next(inval)).isNil.if({ ^inval });
-			{ value >= lastValue }.while({
+		loop {
+			while {
+				(value = stream.next(inval)).isNil.if({ ^inval });
+				value >= lastValue
+			} {
 				inval = (value - lastValue).yield;	// these must be numbers obviously
 				lastValue = value;
-				(value = stream.next(inval)).isNil.if({ ^inval });
-			});
+			};
 			lastValue = lastValue - (lastValue - value).roundUp(cycle);
 			inval = (value - lastValue).yield;
 			lastValue = value;
-		});
+		};
 		^inval
 	}
 }

Modified: dewdrop_lib/ddwVoicer/Voicer.sc
===================================================================
--- dewdrop_lib/ddwVoicer/Voicer.sc	2009-12-27 11:05:20 UTC (rev 1303)
+++ dewdrop_lib/ddwVoicer/Voicer.sc	2009-12-29 14:24:31 UTC (rev 1304)
@@ -1,7 +1,7 @@
 
 Voicer {		// collect and manage voicer nodes
 			// H. James Harkins -- jamshark70@xxxxxxxxxxxxxxxxx
-	
+
 	var	<nodes,
 		<voices,		// maximum number of voices
 		<target, <>addAction,
@@ -330,7 +330,7 @@
 	
 	setArgsInEvent { |event|
 		var	build = {
-			var synthDesc, argList, controls, cname,
+			var synthDesc, argList, controls, cname, value,
 					// why? I want VoicerNode's initargs to override parent event defaults
 					// but keys set in the local event should take precedence
 				eventWithoutParent = currentEnvironment.copy.parent_(nil);
@@ -349,13 +349,16 @@
 							(eventWithoutParent[cname].size == 0).if({
 								eventWithoutParent[cname] = eventWithoutParent[cname].asArray;
 							});
+							value = eventWithoutParent[cname].wrapAt(i)
+								?? { node.initArgAt(cname) };
 								// add value: environment overrides node's initarg,
 								// which overrides the SynthDef's default
-							argList.add(cname)
-								.add(eventWithoutParent[cname].wrapAt(i)
-									?? { node.initArgAt(cname) }
-									?? { c.defaultValue }
-								);
+								// used to add synthdef default explicitly (c.defaultValue)
+								// but that breaks t_gate, so now adding only values
+								// that exist in the event or have Voicer-specific defaults
+							if(value.notNil) {
+								argList.add(cname).add(value)
+							};
 						};
 					});
 					argList
@@ -634,10 +637,15 @@
 						var latency, freq, length;
 						
 						latency = i * strum + lag;
+							// backward compatibility: I should NOT add server latency
+							// for newer versions with Julian's schedbundle method
+						if(~addServerLatencyToLag ? false) {
+							latency = latency + (node.server.latency ? 0)
+						};
 						freq = ~freq.wrapAt(i);
 						length = ~sustain.wrapAt(i);
 	
-						~schedBundleArray.(~latency ? 0, ~timingOffset,
+						~schedBundleArray.(latency, ~timingOffset,
 							node.server,
 							node.server.makeBundle(false, {
 								node.trigger(freq, ~gate.wrapAt(i), ~args.wrapAt(i));

Modified: dewdrop_lib/ddwVoicer/VoicerProxy.sc
===================================================================
--- dewdrop_lib/ddwVoicer/VoicerProxy.sc	2009-12-27 11:05:20 UTC (rev 1303)
+++ dewdrop_lib/ddwVoicer/VoicerProxy.sc	2009-12-29 14:24:31 UTC (rev 1304)
@@ -315,4 +315,9 @@
 		^voicer.bus;
 	}
 
+	susPedal { ^voicer.susPedal }
+	sustainPedal { |sustain|
+		moreVoicers.do(_.sustainPedal(sustain));
+		voicer.sustainPedal(sustain);
+	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/