Loris::Collator Class Reference

#include <Collator.h>

List of all members.

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)

Detailed Description

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.


Member Enumeration Documentation

anonymous enum
Enumerator:
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.


Constructor & Destructor Documentation

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.)

Parameters:
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).

Member Function Documentation

template<typename Container >
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.

Parameters:
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.
Returns:
the position of the first collated Partial

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.

Postcondition:
All Partials in the collection are uniquely-labeled, collated Partials are all at the end of the collection (after all labeled Partials).
Parameters:
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).
Returns:
the position of the first collated Partial

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.

template<typename Container >
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.

Parameters:
partials is the collection of Partials to collate in-place
Returns:
the position of the end of the range of labeled Partials, which is either the end of the collection, or the position of the first collated Partial, composed of unlabeled Partials in the original collection.

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.

See also:
Collator::collate( Container & partials )

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.

Parameters:
partials is the collection of Partials to collate in-place
Returns:
the position of the end of the range of labeled Partials, which is either the end of the collection, or the position of the first collated Partial, composed of unlabeled Partials in the original collection.

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.

template<typename Container >
Container::iterator Loris::Collator::operator() ( Container &  partials  )  [inline]

Function call operator: same as collate( PartialList & partials ).

Function call operator: same as collate( PartialList & partials ).

See also:
Collator::collate( Container & partials )

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2