Copyright | (c) Hans Hoglund 2012-2014 |
---|---|

License | BSD-style |

Maintainer | hans@hanshoglund.se |

Stability | experimental |

Portability | non-portable (TF,GNTD) |

Safe Haskell | None |

Language | Haskell2010 |

- class Alignable a where
- align :: LocalDuration -> a -> a

- data Aligned v
- aligned :: Time -> LocalDuration -> v -> Aligned v
- realign :: (HasDuration a, Transformable a) => LocalDuration -> Aligned a -> Aligned a
- renderAligned :: (HasDuration a, Transformable a) => (Span -> a -> b) -> Aligned a -> b
- renderAlignedVoice :: Aligned (Voice a) -> Score a
- renderAlignedNote :: Aligned (Note a) -> Event a
- renderAlignedDuration :: Aligned Duration -> Span

# Alignable class

class Alignable a where Source

align :: LocalDuration -> a -> a Source

# Aligned values

`Aligned`

places a vector-like object in space, by fixing a local duration interpolating
the vector to a specific point in time. The aligned value must be an instance of
`HasDuration`

, with

providing the size of the vector.`view`

`duration`

This is analogous to alignment in a graphical program. To align something at onset, midpoint or offset, use 0, 0.5 or 1 as the local duration value.

Functor Aligned | |

Foldable Aligned | |

Traversable Aligned | |

Eq v => Eq (Aligned v) | |

Ord v => Ord (Aligned v) | |

Show a => Show (Aligned a) | |

ToJSON a => ToJSON (Aligned a) | |

Wrapped (Aligned v) | |

Transformable v => Transformable (Aligned v) | |

(HasDuration v, Transformable v) => HasDuration (Aligned v) | |

(HasDuration v, Transformable v) => HasPosition (Aligned v) | |

Alignable (Aligned a) | |

Rewrapped (Aligned a) (Aligned b) | |

HasParts a b => HasParts (Aligned a) (Aligned b) | |

HasPitches a b => HasPitches (Aligned a) (Aligned b) | |

HasDynamics a b => HasDynamics (Aligned a) (Aligned b) | |

type SetPart b (Aligned a) = Aligned (SetPart b a) | |

type SetPitch b (Aligned a) = Aligned (SetPitch b a) | |

type SetDynamic b (Aligned a) = Aligned (SetDynamic b a) | |

type Unwrapped (Aligned v) = ((Time, LocalDuration), v) | |

type Part (Aligned a) = Part a | |

type Pitch (Aligned a) = Pitch a | |

type Dynamic (Aligned a) = Dynamic a |

aligned :: Time -> LocalDuration -> v -> Aligned v Source

Align the given value so that its local duration occurs at the given time.

realign :: (HasDuration a, Transformable a) => LocalDuration -> Aligned a -> Aligned a Source

renderAligned :: (HasDuration a, Transformable a) => (Span -> a -> b) -> Aligned a -> b Source

Render an aligned value. The given span represents the actual span of the aligned value.

renderAlignedVoice :: Aligned (Voice a) -> Score a Source

Convert an aligned voice to a score.

renderAlignedNote :: Aligned (Note a) -> Event a Source

Convert an aligned note to an event.

renderAlignedDuration :: Aligned Duration -> Span Source

Convert an aligned duration to a span.