Karya, built on 2018-03-16T03:22:32 (patch df7306861219887e676081746f4a4edfe05eb0b5)

Safe HaskellNone





default_rect :: Rect.Rect Source #

(10, 50) seems to be the smallest x,y OS X will accept. Apparently fltk's sizes don't take the menu bar into account, which is about 44 pixels high, so a y of 44 is the minimum.


fmt_events :: [EventSpec] -> Text Source #

Visualize event ranges. This can be used with Testing.equal_fmt.

right_fst :: (a -> Text) -> Either x (a, y) -> Text Source #

Extract and fmt the fst . right element. Many DeriveTest extractors return Either Error (val, [log]).

monadic mk- functions

type BlockSpec = (Text, [TrackSpec]) Source #

(block_id, tracks)

If the name ends with =ruler, then the length of the ruler is derived from the events inside, rather than being hardcoded. This is convenient for tests and lets them avoid hardcoding the default_ruler end.

Also, if the name contains --, the text after it becomes the block title.

type TrackSpec = (Text, [EventSpec]) Source #

(track_title, events)

parse_block_spec :: Text -> (Id.BlockId, Text, Bool) Source #

Parse a block spec, which looks like name[=ruler] [-- title]

default_block_id :: Id.BlockId Source #

Often tests work with a single block, or a single view. To make them less verbose, there is a default block and view so functions can omit the parameter if convenient.

run :: CallStack.Stack => Ui.State -> Ui.StateId a -> (a, Ui.State) Source #

Return the val and state, throwing an IO error on an exception. Intended for tests that don't expect to fail here.

mkblock_ruler :: Ui.M m => Id.RulerId -> Id.BlockId -> Text -> [TrackSpec] -> m (Id.BlockId, [Id.TrackId]) Source #

Like mkblock, but uses the provided ruler instead of creating its own. Important if you are creating multiple blocks and don't want a separate ruler for each.

mk_tid :: Types.TrackNum -> Id.TrackId Source #

Make a TrackId as mkblock does. This is so tests can independently come up with the track IDs mkblock created just by knowing their tracknum.

tid_tracknum :: Id.TrackId -> Types.TrackNum Source #

Get a TrackNum back out of a mk_tid call.


make specs

type NoteSpec = (Text, [EventSpec], [(Text, [(ScoreTime.ScoreTime, Text)])]) Source #

This is a simplification of TrackSpec that assumes one pitch per note. It hardcodes the scale to * and all the control tracks are under a single note track, but in exchange it's easier to write than full TrackSpecs.

(inst, [(t, dur, pitch)], [(control, [(t, val)])])

If the pitch looks like "a -- 4c" then "a" is the note track's event and "4c" is the pitch track's event. If the pitch is missing, the empty pitch event is filtered out. This doesn't happen for the note event since empty note event has a meaning.

note_track :: [EventSpec] -> [TrackSpec] Source #

Abbreviation for note_spec where the inst and controls are empty.

note_track1 :: [Text] -> [TrackSpec] Source #

Like note_track, but all notes have a duration of 1.

to_note_spec :: [TrackSpec] -> [NoteSpec] Source #

Parse a TrackSpec back out to a NoteSpec.

to_pitch_spec :: [NoteSpec] -> [[EventSpec]] Source #

Like to_note_spec but expect just notes and pitches, no controls.

state to spec

extract_tracks_of :: Id.BlockId -> Ui.State -> [TrackSpec] Source #

Like dump_block but strip out everything but the tracks.

extract_tracks :: Ui.State -> [TrackSpec] Source #

Get the names and tracks of the default block.


non-monadic make_- functions




step1 :: TimeStep.TimeStep Source #

TimeStep to step by 1 ScoreTime on the default ruler.

mkruler_44 :: Int -> ScoreTime.ScoreTime -> Ruler.Ruler Source #

Create a ruler with a 4/4 "meter" marklist with the given number of marks at the given distance. Marks are rank [1, 2, 2, ...].

The end of the ruler should be at marks*dist. An extra mark is created since marks start at 0.


allocations :: [(Text, Text, [Midi.Channel])] -> UiConfig.Allocations Source #

Make Simple.Allocations from (inst, qualified, [chan]).

instrument db