Karya, built on 2018-02-23T20:23:55 (patch cf8565b7ac832266878af99a942555d139065f12)

Safe HaskellNone




Extract things from the PassedArgs data structure.



prev and next

from ctx_prev_val

prev_val :: PassedArgs a -> Maybe a Source #

Get the previous val. See NOTE [prev-val].

from state_prev_val

prev_note :: Deriver (Maybe Score.Event) Source #

Get the previous note. Unlike prev_val, this always gets the previous Score.Event, even if you're evaluating a control track under the note track.

TODO it doesn't really belong here since it doesn't use PassedArgs, but this is where I would look for a function for the previous value.


lookup_next_pitch :: PassedArgs a -> Deriver (Maybe Pitch) Source #

Pitch at the time of the next event in this track.

lookup_next_note_pitch :: ScoreTime -> Deriver (Maybe Pitch) Source #

Pitch at the time of the next note event of this track's state_note_track.

lookup_pitch_at :: RealTime -> Deriver (Maybe Pitch) Source #

Get a logical pitch at the given time, via state_pitch_map. As documented by state_pitch_map, the pitch map is unset while evaluating the pitch map, so pitch calls that use this shouldn't be surprised if it's Nothing.

lookup_parsed_pitch_at :: (Pitch.Note -> Maybe a) -> RealTime -> Deriver (Maybe a) Source #

Like lookup_pitch_at, except for parsed pitches. Normally you'd pass get_pitch_functions to make a Pitch.Pitch.


eval :: CallableExpr d => Context x -> Event.Event -> [Event.Event] -> Deriver (Stream.Stream d) Source #

Unused, but might be used again if I need to evaluate the next event.

eval_next_pitch :: PitchArgs -> Deriver (Maybe Pitch) Source #

Get the pitch at the time of the next event. Since the pitch hasn't been evaluated yet, it has to be evaluated here. So if it depends on the previous pitch, you won't get a pitch back.

Actually, the pitch likely *has* been evaluated, I just can't get at it here. If it's uninverted then I have the whole pitch track, and if it's inverted then the event at or after the end of the event will be included. But trim_signal will clip that sample off to avoid a spurious pitch change at the end of the note.

event timing

next :: PassedArgs a -> TrackTime Source #

The start of the next event, or the end of the block if there is no next event.

Used by calls to determine their extent, especially control calls, which have no explicit duration.

next_end :: PassedArgs a -> TrackTime Source #

End of the next event, or the end of the block if there is no next event.

next_start :: PassedArgs a -> Maybe TrackTime Source #

Get the start of the next event, if there is one.

This is similar to next, except that it will be Nothing at the end of the block.

prev_start :: PassedArgs a -> Maybe TrackTime Source #

Start time of the previous event.

prev_end :: PassedArgs a -> Maybe TrackTime Source #

End time of the previous event.


set_duration :: TrackTime -> PassedArgs a -> PassedArgs a Source #

Modify the duration of the ctx_event. This is a hack, because calls run in TrackTime, instead of using Derive.place.


range :: PassedArgs a -> (TrackTime, TrackTime) Source #

Range of the called event, i.e. (min, max). Note that range is the minimum to maximum, which is not the same as the start and end if the event has negative duration.

range_or_next :: PassedArgs a -> (TrackTime, TrackTime) Source #

Like range, but if the duration is 0, then the end is next event.

range_or_note_end :: PassedArgs a -> Deriver (TrackTime, TrackTime) Source #

The current event's start and end times.

If the event has a duration, then use that. Otherwise, if there is a EnvKey.note_end, return that. Otherwise, return next. However, if there's an EnvKey.note_start and it's past the event start, then this event isn't contained within the range of its parent note, which means that its expected note end has also passed. In that case, it returns (note_start, note_start), which should cause the call to just emit its final sample at the note-start, which will both get the correct value for the event and not destroy the earlier track signal fragment.

extent :: PassedArgs a -> (TrackTime, TrackTime) Source #

Start and duration of the event. This is probably the right thing for calls that generate a note since it will give a negative duration when appropriate.

range_on_track :: PassedArgs a -> (TrackTime, TrackTime) Source #

Event range as it appears on the track, regardless of slicing.

normalized :: PassedArgs a -> Deriver b -> Deriver b Source #

This normalizes a deriver to start at 0 and have a duration of 1, provided that the deriver is placed at the start and dur of the given args. This is the case if the deriver is a transformer arg, so this is useful for a transformer to manipulate its argument.

normalized_start :: PassedArgs a -> Deriver b -> Deriver b Source #

Like normalized, but only shifts start to 0.