Safe Haskell | Safe-Inferred |
---|
Synopsis
- data Marklist
- type MarklistVector = TimeVector.Boxed Mark
- marklist :: [PosMark] -> Marklist
- marklist_from_vector :: MarklistVector -> Marklist
- empty :: Marklist
- to_list :: Marklist -> [PosMark]
- ascending :: ScoreTime -> Marklist -> [PosMark]
- descending :: ScoreTime -> Marklist -> [PosMark]
- end :: Marklist -> ScoreTime
- start :: Marklist -> ScoreTime
- insert_mark :: ScoreTime -> Mark -> Marklist -> Marklist
- data Mark = Mark {
- mark_rank :: !Meter.Rank
- mark_width :: !Int
- mark_color :: !Color.Color
- mark_name :: !Label
- mark_name_zoom_level :: !Double
- mark_zoom_level :: !Double
- type Label = Text
- newtype MarklistPtr = MarklistPtr (MVar.MVar (Either MarklistVector (ForeignPtr Marklist)))
- marklist_vec :: Marklist -> MarklistVector
- marklist_fptr :: Marklist -> MarklistPtr
Documentation
type MarklistVector = TimeVector.Boxed Mark Source #
ascending :: ScoreTime -> Marklist -> [PosMark] Source #
Marks starting at the first mark >= the given pos, to the end.
descending :: ScoreTime -> Marklist -> [PosMark] Source #
Marks starting at the first mark below the given pos, to the beginning.
Mark | |
|
for RulerC's eyes only
newtype MarklistPtr Source #
This should be opaque, but it needs to be exported for RulerC. Don't look inside if you're not RulerC, OK?
The Left value is actually not used, but prevents the unsafePerformIO from being floated out of the lambda.
I used to just copy the ruler each time, but it was actually pretty big.
Rulers can have lots of marks, there are many rulers per block since each
track has one. But many tracks share the same ruler, and they change
rarely. All of these differences from Events
push for passing
by pointer rather than copying over the whole thing each time (as with the
signal), or passing a callback that fetches the required range (as with
events).
TODO I could share the memory by making MarklistVector into Vector.Storable PosMark. It's otherwise equivalant though, and the number of distinct rulers is probably small, so the memory savings doesn't seem that compelling.
marklist_fptr :: Marklist -> MarklistPtr Source #
This is a cache for the C-marshalled version of the marklist. It will be allocated if the Marklist is passed to C, and is managed with its own reference count.
I think this should be safe as long as marklist
is the only
constructor.