inheritance tree
NonType Reflection
| |
`-----+--'
|
ScoreObject
|
|
|
Parameter
|
|
|
TimeParameter
class definition
class TimeParameter (Inheritance-free)
feat !ScoreObjectType label
attr heuristics id info item unit value
- addHeuristic(constraint:Constraint parameters:Params weight:Weight)
[destructive method] Adds a heuristic constraint to the parameter. Constraint is a heuristic constraint (a function expecting n integers and returning an integer), Params is the list of parameter objects to which the constraint is applied (including self), and Weight (int) is the weight of the constraint (the factor applied to it).
Note: Instead of calling this method directly, better use Score.apply_H instead.
- addInfo(X)
[destructive method] Adds X to list in attribute info. The tail of the list at attribute info is the info that was specified before with addInfo and was give at the init method (default is nil).
- addInfos(Xs)
[destructive method] Adds every element in list Xs to list in attribute info.
- getAttr($ A)
Returns the value at attribute A.
- getAttrNames($)
Returns a list of all attributes (atoms) defined for self.
- getAttrSources($)
Alias for getAttrNames.
*/
meth getAttributes($) {self getAttrNames($)} end
/** %% Returns a record where the features are the attributes defined for self and the values are the classes which define these attributes.
- getClass($)
- getClassName($)
Returns the print name of the class of self as specified in its definition. The name is an atom derived from a variable and thus starting with a capital letter, e.g., 'ScoreObject'.
- getFeat($ F)
Returns the value at feature F.
- getFeatNames($)
Returns a list of all features (atoms) defined for self.
- getFeatSources($)
Returns a record where the features are the features defined for self and the values are the classes which define these features.
- getFeatures($)
Alias for getFeatNames.
- getHeuristics(X)
Return the list of heuristic constraints applied to the parameter. A heuristic is a record of the following form (see the doc of getHeuristics for the meaning of the variables).
heuristic(constraint:Constraint parameters: Params weight:Weight)
Note: Instead of calling this method directly, better use Score.apply_H instead.
- getID(X)
- getInfo(X)
- getInfoRecord($ L)
Returns first record with label L in the list in attribute info.
- getInitArgDefaults($)
Returns a record where the features are all supported arguments of the init method of self with their default as value (_ indicates that no default exist).
NB: this method relies on the correct implementation of the method getInitArgs for its class and all its superclasses.
- getInitArgSources($)
- getInitClasses(Classes)
Collects all classes of the objects in self in the format expected by the second argument of Score.makeScore, i.e., a record of the form unit(label1:Class1 ... labelN:ClassN)
- getInitClassesVS($)
Like getInitClasses, getInitClassesVS collects all classes of the objects in self in the format expected by the second argument of Score.makeScore. However, the result record is returned as a VS (e.g., for outputting into Oz source text files). The Strasheela classes are specified by accessing them in Strasheela functors (e.g., Strasheeala.score.note). The toplevel Strasheela functors are taken from {Init.getStrasheelaEnv strasheelaFunctors}.
NB: getInitClassesVS examines every class in these functors (and their subfunctors) and requires that whenever a class defines an init method, all init method arguments must be optional.
- getInitInfo($ ...)
Individual parameters cannot be created with Score.make and friends, so the notion of their init record is somewhat missleading. Nevertheless, it is useful to translate the essential parameter data into a concise "textual" representation.
- getItem(X)
- getMethNames($)
Returns a list of all methods (atoms) defined for self.
- getMethSources($)
Returns a record where the features are the methods defined for self and the values are the classes which define these methods.
- getUnit(X)
- getValue(X)
- getValueInBeats(X)
Returns the parameter value translated to a float representing seconds. The translation uses the parameter unit which must be bound (otherwise the method suspends). Supported units are (represented by these atoms): seconds/secs, milliseconds/msecs, and beats (a relative duration, e.g., a quarter note). The unit specification beats(N) means the parameter value of N is a single beat. beats(N) may be used to express tuplets, e.g., for beat(3) the value 1 means a third beat i.e. a triplet. N must be an integer and defaults to 1. The translation between seconds and beats uses Init.getBeatDuration.
*/
meth getValueInSeconds(?X)
Unit = {self getUnit($)}
in
NOTE: IsDet does not wait for binding -- quasi side effect. But most
often this is called for output and timeUnit is sometimes
forgotten by user...
if {Not {IsDet Unit}}
then {GUtils.warnGUI "unit of temporal parameter(s) unbound -- computation blocks!"}
end
parameter value is float
NOTE: inefficient to always check there two cases first,
as they are particualy rare
X = case Unit
of secsF then {self getValue($)}
[] msecsF then {self getValue($)} / 1000.0
else
parameter value is integer
Value = {IntToFloat {self getValue($)}}
in
case Unit
of seconds then Value
[] secs then Value
[] milliseconds then Value / 1000.0
[] msecs then Value / 1000.0
[] beats then Value * {Init.getBeatDuration}
[] beats(N) then Value * {Init.getBeatDuration} / {IntToFloat N}
else
{Exception.raiseError
strasheela(illParameterUnit Unit self
"Supported units are seconds (or secs), millisecond (or msecs), beats, and beats(N) (where N is an integer).")}
unit % never returned
end
end
end
/** %% Returns the parameter value translated to a float representing beats. The translation uses the parameter unit which must be bound (otherwise the method suspends). Supported units are (represented by these atoms): seconds/secs, milliseconds/msecs, and beats. The unit specification beats(N) means the parameter value of N is a single beat. N must be an integer and defaults to 1. The translation between seconds and beats uses Init.getBeatDuration.
- getValueInSeconds(X)
Returns the parameter value translated to a float representing seconds. The translation uses the parameter unit which must be bound (otherwise the method suspends). Supported units are (represented by these atoms): seconds/secs, milliseconds/msecs, and beats (a relative duration, e.g., a quarter note). The unit specification beats(N) means the parameter value of N is a single beat. beats(N) may be used to express tuplets, e.g., for beat(3) the value 1 means a third beat i.e. a triplet. N must be an integer and defaults to 1. The translation between seconds and beats uses Init.getBeatDuration.
Additionally, hierachic tempo curves and time shift functions are taken into account.
- hasThisInfo(B Info)
Returns boolean whether the list at the attr info of self contains Info. In case some info value is a record, then it is checked whether its label is Info.
- init(unit:Unit value:Value ...)
- initFD(Spec)
Bind the parameter value to a FD variable
- initFS(Spec)
Bind the parameter value to a FS variable
- isAbstractElement(B)
- isAmplitude(B)
- isAspect(B)
- isContainer(B)
- isDet($)
Returns true if parameter value is determined, false otherwise.
- isElement(B)
- isEvent(B)
- isItem(B)
- isModifier(B)
- isNote(B)
- isParameter(B)
- isPause(B)
- isPitch(B)
- isScoreObject(B)
- isSequential(B)
- isSimultaneous(B)
- isTemporalAspect(B)
- isTemporalElement(B)
- isTimeInterval(B)
- isTimeMixin(B)
- isTimeParameter(B)
- isTimePoint(B)
- makeInitRecord(X Attrs)
[aux method for toInitRecord]: returns a record intended to facilitate the init method creation of an object for archive purposes. Attrs has the form [Key1#Accessor1#Default1 ...], keys are the record features of the init record, accessors the respective accessor for some object attributes (unary function or method), defaults are the respective attribute default values (the special default value noMatch matches nothing).
- makePPrintRecord(X Features Slots Excluded functions:Fns)
[aux method for toPPrintRecord] Returns a record with the label of self (the value at the feature label of self) and the values of selected features/attributes of self at record labels. All atoms in the list Features which are member in the list Slots are features of the returned record.
Usually, the record feature is just bound to the value at the features/attributes of self. However, for certain features/attributes there are special access functions defined. The return value of these functions will be bound to the record features. These features and their functions are either given in a record to the optional method feature functions. Other features and their functions are predefined in the variable PPrintRecordFns.
- setAttribute(A X)
[destructive method] Statefully sets attribute A to value X. The method is indented for editing a score after search, the search itself is indented to be fully stateless.
- setParameterValue(Param X)
[destructive method, for experts only] Statefully sets the value of parameter Param to value X (there must be an attribute Param). Remember that the search itself is indented to be fully stateless.
- toFullRecord(X exclude:Exclude unbind:Unbind)
Outputs the whole score object tree as a record with the the object label as record label and with all the object attributes and object features as record features. All attributes/features containing score objects themself are called recursively, dictionaries and extendable lists (see LUtils) are transformed to records resp. lists.
Args:
'exclude' (default nil): list of attribute names (list of atoms) recursively excluded in the output.
'unbind' (default nil): list of attribute names (list of atoms) which are output, but whose value is set to a free variable.
!! Temp: The attributes 'item' and 'containers' are always excluded to avoid endless loops. Therefore, score graphs with items having more then a single container can not be shown.
- toInitRecord($ clauses:Clauses exclude:Excluded)
Outputs the full init record for self which allows to re-create the score.
Excluded is a list of arguments (atoms) which must be excluded concurrently.
Clauses is a list of pairs TestI#FunI which can be used to overwrite the default init record creation (defined by the class' method getInitInfo) of specific score objects. TestI is a Boolean function or method, and FunI is a unary function expecting a score object and returning a record. For each object for which some TestI returns true, the corresponding FunI will be used for creating the init records for this object.
NB: toInitRecord depends on correct definitions of the method getInitInfo for all subclasses with specific inialisiation arguments.
NB: toInitRecord presently only works properly for tree-form score topologys (e.g. score graphs are not supported yet).
*
- toPPrintRecord(?X excluded:Excluded features:Features)
Is the parameter value determined?
*/
meth isValDet(?B) B={IsDet @value} end
/** %% Method returns a record with essential data of self. The method is intended to view self uncluttered. The method feature features
allows to freely select a list of score object features/attributes to include.
- unify(ScoreObject derive:Derive exclude:Exclude overwrite:Overwrite)
Effectively unifies self and ScoreObject. This method is useful for constraining various forms of repetitions. Stateful data (including class instances) can not be unified in Oz. So, unify transforms self and ScoreObject to records (using toFullRecord) and unifies those records.
Args:
'exclude' (default [startTime endTime]): list of attribute names (list of atoms) to ignore, see arg 'exclude' for toFullRecord. (The internal attributes 'parameters' and 'flags' are always excluded.)
'overwrite' (default nil): list of attribute names (list of atoms) to keep as declared in self (i.e. the setting in ScoreObject is quasi overwritten).
'derive' (default nil): for unifying derived score information (e.g., exclude the pitches, but unify pitch intervals, see example below). List of unary functions expecting the full score (self or ScoreObject) and returning a data structure to unify.
Example:
{Score1 unify(Score2
exclude:[pitch]
derive:[proc {$ MyScore Intervals}
Ps = {MyScore mapItems($ getPitch)}
in
Intervals = {Pattern.map2Neighbours Ps
proc {$ P1 P2 ?Interval}
Interval = {FD.decl}
P2 - P1 + 100000 =: Interval
end}
end])}
NB: only works properly for tree-form score topologys (because of limitation of toFullRecord).
end