Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Derive.Args

Contents

Description

Extract things from the PassedArgs data structure.

Synopsis

Documentation

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.

state_pitch_map

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

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

lookup_next_note_pitch :: PassedArgs a -> 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

eval :: Callable 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.

modify

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

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.