prev (21) slide 22 / 33 next (23)
DeriveT
newtype DeriveT m a = DeriveT (DeriveStack m a)
deriving (Functor, Monad, Trans.MonadIO, Error.MonadError DeriveError)
run_derive_t (DeriveT m) = m
type DeriveStack m = Error.ErrorT DeriveError
(Monad.State.StateT State
(Log.LogT m))
data State = State {
-- Environment. These form a dynamically scoped environment that applies
-- to generated events inside its scope.
-- | Derivers can modify it for sub-derivers, or look at it, whether to
-- attach to an Event or to handle internally.
state_controls :: Score.ControlMap
-- | Absolute pitch signal currently in scope.
, state_pitch :: PitchSignal.PitchSignal
, state_instrument :: Maybe Score.Instrument
, state_attributes :: Score.Attributes
, state_warp :: Warp
-- | This is the call stack for events. It's used for error reporting,
-- and attached to events in case they want to emit errors later (say
-- during performance).
, state_stack :: [Warning.StackPos]
, state_log_context :: [String]
-- | Remember the warp signal for each track. A warp usually a applies to
-- a set of tracks, so remembering them together will make the updater more
-- efficient when it inverts them to get playback position.
, state_track_warps :: [TrackWarp]
-- | Constant throughout the derivation. Used to look up tracks and
-- blocks.
, state_ui :: State.State
, state_lookup_deriver :: LookupDeriver
, state_control_op_map :: Map.Map Operator ControlOp
, state_pitch_op_map :: Map.Map Operator PitchOp
, state_call_map :: CallEnv
-- | This is set if the derivation is for a signal deriver. Signal
-- derivers skip all special tempo treatment. Ultimately, this is needed
-- because of the 'add_track_warp' hack. It might be 'add_track_warp' is
-- too error-prone to allow to live...
, state_ignore_tempo :: Bool
}
prev (21) slide 22 / 33 next (23)