add ParallelEndTogether

This commit is contained in:
David Rose 2002-09-30 19:31:59 +00:00
parent ffbdb15d47
commit ea208dfdbf

View File

@ -141,12 +141,26 @@ class MetaInterval(CMetaInterval):
def addParallel(self, list, name, relTime, relTo, duration): def addParallel(self, list, name, relTime, relTo, duration):
# Adds the given list of intervals to the MetaInterval to be # Adds the given list of intervals to the MetaInterval to be
# played simultaneously. # played simultaneously; all will start at the same time.
self.pushLevel(name, relTime, relTo) self.pushLevel(name, relTime, relTo)
for ival in list: for ival in list:
self.addInterval(ival, 0.0, TRACK_START) self.addInterval(ival, 0.0, TRACK_START)
self.popLevel(duration) self.popLevel(duration)
def addParallelEndTogether(self, list, name, relTime, relTo, duration):
# Adds the given list of intervals to the MetaInterval to be
# played simultaneously; all will end at the same time, but
# the longest interval will be started first to achieve this.
maxDuration = 0
for ival in list:
maxDuration = max(maxDuration, ival.getDuration())
self.pushLevel(name, relTime, relTo)
for ival in list:
self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START)
self.popLevel(duration)
def addTrack(self, list, name, relTime, relTo, duration): def addTrack(self, list, name, relTime, relTo, duration):
# Adds a "track list". This is a list of tuples of the form: # Adds a "track list". This is a list of tuples of the form:
# #
@ -422,6 +436,11 @@ class Parallel(MetaInterval):
meta.addParallel(self.ivals, self.getName(), meta.addParallel(self.ivals, self.getName(),
relTime, relTo, self.phonyDuration) relTime, relTo, self.phonyDuration)
class ParallelEndTogether(MetaInterval):
def applyIvals(self, meta, relTime, relTo):
meta.addParallelEndTogether(self.ivals, self.getName(),
relTime, relTo, self.phonyDuration)
class Track(MetaInterval): class Track(MetaInterval):
def applyIvals(self, meta, relTime, relTo): def applyIvals(self, meta, relTime, relTo):
meta.addTrack(self.ivals, self.getName(), meta.addTrack(self.ivals, self.getName(),