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

Safe HaskellNone




This layer gives direct wrapped access to the fltk API.

It maintains a map from ViewIds to window pointers, which represents the on screen state. All functions here take ViewIds, and will throw an exception if the view_id isn't in the pointer map. C++ exceptions coming from FLTK should be converted and thrown as haskell exceptions.

TODO exceptions are not implemented yet

There are three methods for sharing data with C++:

  • Note tracks pass a callback, that will return events in the given ScoreTime range. This means the complete map of events exists only on the Haskell side, and changing events means passing a new callback to C++. This is because events change a lot, and it seems wasteful to copy over a whole track of events just because one was added.
  • Rulers have marklists, which are like events but much denser. They're entirely marshalled to a C array so C++ has direct access to the marks. Because many tracks will share the same ruler, marklists use a reference counting scheme so Haskell can allocate the array once, and then C++ and Haskell can cooperate on the memory management.
  • Control signals are just copied, and ownership is given to C++. This is because control signals are large but are already dense arrays so they can be copied very quickly with memcpy. They could use a refcounting scheme like ruler marklists, but they're rarely shared so it's probably not worth it.


view creation

set other attributes

data Selection Source #

This is the low level version of Selection. It only applies to a single track, and has an explicit color.

Block operations

floating input

Track operations

update_track Source #


:: Bool

True if the ruler has changed and should be copied over. It's a bit of a hack to be a separate flag, but rulers are updated rarely and copied over entirely for efficiency.

-> ViewId 
-> TrackNum 
-> Tracklike 
-> [Events] 
-> SetStyle 
-> ScoreTime 
-> ScoreTime 
-> Fltk () 

update_entire_track :: Bool -> ViewId -> TrackNum -> Tracklike -> [Events] -> SetStyle -> Fltk () Source #

Like update_track except update everywhere.

set_track_signal :: ViewId -> TrackNum -> TrackSignal -> Fltk () Source #

Unlike other Fltk functions, this doesn't throw if the ViewId is not found. That's because it's called asynchronously when derivation is complete.