#include <Collator.h>
Public Types | |
enum | { DefaultFadeTimeMs = Distiller::DefaultFadeTimeMs, DefaultSilentTimeMs = Distiller::DefaultSilentTimeMs } |
Public Member Functions | |
Collator (double partialFadeTime=Collator::DefaultFadeTimeMs/1000.0, double partialSilentTime=Collator::DefaultSilentTimeMs/1000.0) | |
template<typename Container > | |
Container::iterator | collate (Container &partials) |
template<typename Container > | |
Container::iterator | operator() (Container &partials) |
Function call operator: same as collate( PartialList & partials ). | |
Static Public Member Functions | |
template<typename Container > | |
static Container::iterator | collate (Container &partials, double partialFadeTime, double partialSilentTime) |
Class Collator represents an algorithm for reducing a collection of Partials into the smallest collection of "equivalent" Partials by joining non-overlapping Partials end to end.
Partials that are not labeled, that is, Partials having label 0, are "collated " into groups of non-overlapping (in time) Partials, and fused into a single Partial per group. "Collating" is a bit like "distilling" but non-overlapping Partials are grouped without regard to frequency proximity. This algorithm produces the smallest-possible number of collated Partials. Thanks to Ulrike Axen for providing this optimal algorithm.
Collating modifies the Partial container (a PartialList). Only unlabeled (labeled 0) Partials are affected by the collating operation. Collated Partials are moved to the end of the collection of Partials.
anonymous enum |
DefaultFadeTimeMs |
Default time in milliseconds over which Partials joined by distillation fade to and from zero amplitude. Divide by 1000 to use as a member function parameter. This parameter should be the same in Distiller, Sieve, and Collator. |
DefaultSilentTimeMs |
Default minimum duration in milliseconds of the silent (zero-amplitude) gap between two Partials joined by distillation. Divide by 1000 to use as a member function parameter. This parameter should be the same in Distiller, Sieve, and Collator. |
Loris::Collator::Collator | ( | double | partialFadeTime = Collator::DefaultFadeTimeMs/1000.0 , |
|
double | partialSilentTime = Collator::DefaultSilentTimeMs/1000.0 | |||
) | [explicit] |
Construct a new Collator using the specified fade and gap times between Partials. When two Partials are joined, the collated Partial fades out at the end of the earlier Partial and back in again at the onset of the later one. The fade time is the time over which these fades occur. By default, use a 5 ms fade time. The gap time is the additional time over which a Partial faded out must remain at zero amplitude before it can fade back in. By default, use a gap time of one millisecond, to prevent a pair of arbitrarily close null Breakpoints being inserted. (Defaults are copied from the Distiller.)
partialFadeTime | is the time (in seconds) over which Partials joined by distillation fade to and from zero amplitude. Default is 0.005 (one millisecond). | |
partialSilentTime | is the minimum duration (in seconds) of the silent (zero-amplitude) gap between two Partials joined by distillation. (Default is 0.001 (one millisecond). |
Container::iterator Loris::Collator::collate | ( | Container & | partials, | |
double | partialFadeTime, | |||
double | partialSilentTime | |||
) | [inline, static] |
Static member that constructs an instance and applies it to a sequence of Partials. Collated Partials are labeled beginning with the label one more than the largest label in the orignal Partials.
partials | is the collection of Partials to collate in-place | |
partialFadeTime | is the time (in seconds) over which Partials joined by collating fade to and from zero amplitude. | |
partialSilentTime | is the minimum duration (in seconds) of the silent (zero-amplitude) gap between two Partials joined by collating. |
If compiled with NO_TEMPLATE_MEMBERS defined, then partials must be a PartialList, otherwise it can be any container type storing Partials that supports at least bidirectional iterators.
Static member that constructs an instance and applies it to a sequence of Partials. Collated Partials are labeled beginning with the label one more than the largest label in the orignal Partials.
partials | is the collection of Partials to collate in-place | |
partialFadeTime | is the time (in seconds) over which Partials joined by collating fade to and from zero amplitude. | |
partialSilentTime | is the minimum duration (in seconds) of the silent (zero-amplitude) gap between two Partials joined by collateation. (Default is 0.0001 (one tenth of a millisecond). |
If compiled with NO_TEMPLATE_MEMBERS defined, then partials must be a PartialList, otherwise it can be any container type storing Partials that supports at least bidirectional iterators.
Container::iterator Loris::Collator::collate | ( | Container & | partials | ) | [inline] |
Collate unlabeled (zero-labeled) Partials into the smallest-possible number of Partials that does not combine any overlapping Partials. Collated Partials assigned labels higher than any label in the original list, and appear at the end of the sequence, after all previously-labeled Partials.
Return an iterator refering to the position of the first collated Partial, or the end of the collated collection if there are no collated Partials. Since collating is in-place, the Partials collection may be smaller (fewer Partials) after collating, and any iterators on the collection may be invalidated.
partials | is the collection of Partials to collate in-place |
If compiled with NO_TEMPLATE_MEMBERS defined, then partials must be a PartialList, otherwise it can be any container type storing Partials that supports at least bidirectional iterators.
Collate unlabeled (zero-labeled) Partials into the smallest-possible number of Partials that does not combine any overlapping Partials. Collated Partials assigned labels higher than any label in the original list, and appear at the end of the sequence, after all previously-labeled Partials.
Return an iterator refering to the position of the first collated Partial, or the end of the collated collection if there are no collated Partials. Since collating is in-place, the Partials collection may be smaller (fewer Partials) after collating, and any iterators on the collection may be invalidated.
partials | is the collection of Partials to collate in-place |
If compiled with NO_TEMPLATE_MEMBERS defined, then partials must be a PartialList, otherwise it can be any container type storing Partials that supports at least bidirectional iterators.
Container::iterator Loris::Collator::operator() | ( | Container & | partials | ) | [inline] |
Function call operator: same as collate( PartialList & partials ).
Function call operator: same as collate( PartialList & partials ).