logo       

Re: NRT options Part II: msg#00162

audio.supercollider.devel

Subject: Re: NRT options Part II

Sorry to bug you all about this again, but if the following is fine, could someone please commit the changes ?

///////////

looking at it I think you do modify your original data.
copying an array with .copy does not mean you copy the subarrays, too.

a = [[0,1], [5,6]];
x = a.copy;

x.do { arg me; me[0] = me[0] + 500 };

x.postln;
a.postln;


//// either you can use deepCopy for that or the following:


sectionlist = Array.new;
list.do { arg item;
if(item[0].inclusivelyBetween(start, end)) {
item = item.copy;
item[0] = item[0] - start;
sectionlist = sectionlist.add(item);
}
};



/*

Attached is a copy of Score.sc with the changes.

Thanks again,

Josh


Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0666;
x-mac-creator=53436A6D; name="Score.sc"
Content-Disposition: attachment;
filename=Score.sc

Attachment converted: data:Score.sc 4 (????/----) (00026CAA)

On Aug 18, 2004, at 8:31 PM, Joshua Parmenter wrote:

Thanks James... I think I understand.

Is this closer?

section {arg start = 0.0, end = nil, configevents = nil;
^this.class.section(score, start, end, configevents);
}

*section {arg list, start = 0, end = nil, configevents = nil;
var sectionlist;
end.isNil.if{end = list[list.size - 1][0]};
sectionlist = list.copy;
list.copy.do{arg me;
if((me[0] >= start) && (me[0] <= end), {me[0] = me[0] - start}, {sectionlist.remove(me)})};
sectionlist = sectionlist.add([end - start, [\c_set, 0, 0]]);
if(configevents.notNil,
{if(configevents.isArray,
{if(configevents[0] == 0.0,
{sectionlist = sectionlist.addFirst(configevents)},
{"Configuration events should have a timestamp of 0.0".warn; ^nil})},
{"Configuration events need to be a bundle array: [time, [events]]".warn;
^nil})});
^this.new(sectionlist);
}

recordNRT { arg oscFilePath, outputFilePath, inputFilePath, sampleRate = 44100, headerFormat =
"AIFF", sampleFormat = "int16", options, completionString="", duration = nil;
this.class.recordNRT(
score, oscFilePath, outputFilePath, inputFilePath,
sampleRate, headerFormat, sampleFormat, options, completionString, duration
);
}

*recordNRT { arg list, oscFilePath, outputFilePath, inputFilePath, sampleRate = 44100,
headerFormat = "AIFF", sampleFormat = "int16", options, completionString="", duration = nil;
if(duration.notNil, {list = this.section(list, 0, duration, nil).score});
this.write(list, oscFilePath);
unixCmd(program + " -N" + oscFilePath + (inputFilePath ? "_") + outputFilePath + sampleRate + headerFormat + sampleFormat +
(options ?? {ServerOptions.new}).asOptionsString
+ completionString);
}

Thanks again for your help!

Josh

On Aug 18, 2004, at 7:43 PM, James McCartney wrote:


On Aug 18, 2004, at 7:31 PM, Joshua Parmenter wrote:

if(duration.notNil,
{finallist = Array.new;
list.do{|i| if(i[0] <= duration, { finallist = finallist.add(i)})};
finallist.sort({arg a, b; a[0] < b[0]});
finallist = finallist.add([duration, [\c_set, 0, 0]])},
{finallist = list});
*/
--








.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise