Safe Haskell | Safe-Inferred |
---|
State.Config and State.Default, in their own module to avoid circular imports with State.Update. Everyone else should pretend they're defined in Ui.State.
Synopsis
- data Config = Config {}
- empty_config :: Config
- namespace_ :: Config :-> Id.Namespace
- meta :: Config :-> Meta
- root :: Config :-> Maybe Id.BlockId
- allocations :: Config :-> Allocations
- lilypond :: Config :-> Lilypond.Config
- default_ :: Config :-> Default
- saved_views :: Config :-> SavedViews
- ky :: Config :-> Text
- tscore :: Config :-> Text
- allocations_map :: Lens.Lens Config (Map ScoreT.Instrument Allocation)
- allocate :: Inst.Backend -> ScoreT.Instrument -> Allocation -> Allocations -> Either Text Allocations
- verify_allocation :: Allocations -> Inst.Backend -> ScoreT.Instrument -> Allocation -> Maybe Text
- newtype Allocations = Allocations (Map ScoreT.Instrument Allocation)
- unallocations :: Allocations -> Map ScoreT.Instrument Allocation
- make_allocations :: [(ScoreT.Instrument, Allocation)] -> Allocations
- midi_allocations :: [(ScoreT.Instrument, (InstT.Qualified, Patch.Config))] -> Allocations
- modify_allocation :: ScoreT.Instrument -> (Allocation -> Either Text Allocation) -> Allocations -> Either Text Allocations
- data Allocation = Allocation {}
- allocation :: InstT.Qualified -> Backend -> Allocation
- has_im :: Allocations -> Bool
- has_midi :: Allocations -> Bool
- has_sc :: Allocations -> Bool
- is_im_allocation :: Allocation -> Bool
- is_midi_allocation :: Allocation -> Bool
- play_cache :: InstT.Qualified
- data Backend
- backend_name :: Backend -> Text
- midi_config :: Backend -> Maybe Patch.Config
- convert_backend :: Inst.Backend -> Backend
- data Meta = Meta {}
- empty_meta :: Meta
- creation :: Meta :-> UTCTime
- last_save :: Meta :-> UTCTime
- notes :: Meta :-> Text
- midi_performances :: Meta :-> Map Id.BlockId MidiPerformance
- lilypond_performances :: Meta :-> Map Id.BlockId LilypondPerformance
- im_performances :: Meta :-> Map Id.BlockId ImPerformance
- type MidiPerformance = Performance (Vector.Vector Midi.WriteMessage)
- type LilypondPerformance = Performance Text
- type ImPerformance = Performance (Vector.Vector Shared.Note.Note)
- data Performance a = Performance {
- perf_events :: !a
- perf_creation :: !UTCTime
- perf_commit :: !Text
- make_performance :: a -> IO (Performance a)
- data Default = Default {}
- tempo :: Default :-> Signal.Y
- type SavedViews = Map Text (Map Id.ViewId Block.View, Maybe Id.ViewId)
Documentation
Miscellaneous config data.
Config | |
|
allocations_map :: Lens.Lens Config (Map ScoreT.Instrument Allocation) Source #
Unwrap the newtype for convenience.
:: Inst.Backend | This should the result of looking up
|
-> ScoreT.Instrument | |
-> Allocation | |
-> Allocations | |
-> Either Text Allocations |
Insert an allocation into config_allocations
while checking it for
validity.
TODO Of course there's no enforcement for this. I could get rid of the
lens, but there is still uncontrolled access through modify_config
.
On the other hand, it might not really matter, and I do use unchecked
modification when the backend doesn't change.
verify_allocation :: Allocations -> Inst.Backend -> ScoreT.Instrument -> Allocation -> Maybe Text Source #
newtype Allocations Source #
Instances
Monoid Allocations Source # | |
Defined in Ui.UiConfig mempty :: Allocations # mappend :: Allocations -> Allocations -> Allocations # mconcat :: [Allocations] -> Allocations # | |
Semigroup Allocations Source # | |
Defined in Ui.UiConfig (<>) :: Allocations -> Allocations -> Allocations # sconcat :: NonEmpty Allocations -> Allocations # stimes :: Integral b => b -> Allocations -> Allocations # | |
Show Allocations Source # | |
Defined in Ui.UiConfig showsPrec :: Int -> Allocations -> ShowS # show :: Allocations -> String # showList :: [Allocations] -> ShowS # | |
Eq Allocations Source # | |
Defined in Ui.UiConfig (==) :: Allocations -> Allocations -> Bool # (/=) :: Allocations -> Allocations -> Bool # | |
Pretty.Pretty Allocations Source # | |
Defined in Ui.UiConfig pretty :: Allocations -> Text Source # format :: Allocations -> Doc Source # formatList :: [Allocations] -> Doc Source # | |
Serialize Allocations Source # | |
Defined in Cmd.Serialize put :: Putter Allocations Source # get :: Get Allocations Source # |
make_allocations :: [(ScoreT.Instrument, Allocation)] -> Allocations Source #
Make Allocations with no verification. This should probably only be used
for tests, allocations from user input should use allocate
.
midi_allocations :: [(ScoreT.Instrument, (InstT.Qualified, Patch.Config))] -> Allocations Source #
This is make_allocations
specialized for MIDI instruments. Like
make_allocations
, it also does no verification.
modify_allocation :: ScoreT.Instrument -> (Allocation -> Either Text Allocation) -> Allocations -> Either Text Allocations Source #
data Allocation Source #
This is the root of the dynamic (per-score) instrument config. It's divided into common and backend-specific configuration.
How instruments work:
The terminology is a bit inconsistent, but the intention is:
Inst.Synth
- Container for Patches.
Patch - Statically declared as haskell source, contains backend-specific
configuration, as well as common config in Common.Common
. They are
grouped with the unfortunately named Inst.Inst
, and the backend is
Inst.Backend
. They all have a unique name which is InstT.Qualified
and looks like "synth/patch-name".
Allocation - An instantiation of a Patch in a particular score, and
associates it with an Instrument. Like Patch, it also has common
config in Common.Config
and backend-specific config in
Backend
. Backend-specific config may be midi devices and
channels for midi, and Common.Config can override settings from the Patch's
Common.Common
. E.g. allocate "vln1" to "vsl/solo-violin" on MIDI chan 1.
Instrument - The is a bit overloaded, but generally should mean
ScoreT.Instrument
, which is just a string used to look up an Allocation.
Both the Patch and Allocation have Backends and they should match, but this
can't be statically ensured because Patch is statically declared in the
source while Allocation is dynamic data which is saved to and loaded from
the score files. verify_backends_match
will check on allocation and
resolve_instrument
will crash if it notices mismatched backends
don't match.
There is an additional Dummy backend. This is for instruments which are
more abstract and don't correspond to a single Patch, but they can still
have Patch level config such as special notation or env vars. For
instance, pemade or gangsa can refer to a whole section, and must be
expanded into specific instruments at the derive level. You can either
allocate a Dummy from a Patch with Inst.Dummy
backend, or allocate one
from InstT.dummy, which will resolve to an empty Patch.
Instances
Show Allocation Source # | |
Defined in Ui.UiConfig showsPrec :: Int -> Allocation -> ShowS # show :: Allocation -> String # showList :: [Allocation] -> ShowS # | |
Eq Allocation Source # | |
Defined in Ui.UiConfig (==) :: Allocation -> Allocation -> Bool # (/=) :: Allocation -> Allocation -> Bool # | |
Pretty.Pretty Allocation Source # | |
Defined in Ui.UiConfig pretty :: Allocation -> Text Source # format :: Allocation -> Doc Source # formatList :: [Allocation] -> Doc Source # | |
Serialize Allocation Source # | |
Defined in Cmd.Serialize put :: Putter Allocation Source # get :: Get Allocation Source # |
allocation :: InstT.Qualified -> Backend -> Allocation Source #
has_im :: Allocations -> Bool Source #
has_midi :: Allocations -> Bool Source #
has_sc :: Allocations -> Bool Source #
is_im_allocation :: Allocation -> Bool Source #
is_midi_allocation :: Allocation -> Bool Source #
Backend-specific config. This should match the Inst.Backend
of the
instrument in question, ensured by verify_allocation
.
I can't think of a way to ensure this statically, since the instrument and config are saved in instrument db and score respectively, and only come together when a new score is loaded.
Midi !Patch.Config | |
Im | |
Sc | |
Dummy !Text | This is for instruments without a backend. For example a paired
instrument might be written as one instrument, but realized as two
different ones. It should be resolved to concrete instruments during
derivation, and includes an error msg show if that doesn't happen.
If it's "", inherit the msg from its |
backend_name :: Backend -> Text Source #
Local Backend
version of Inst.backend_name
, keep them consistent.
midi_config :: Backend -> Maybe Patch.Config Source #
Extra data that doesn't have any effect on the score.
Meta | |
|
Instances
empty_meta :: Meta Source #
type LilypondPerformance = Performance Text Source #
data Performance a Source #
A record of the last successful performance that sounded as expected. You can compare this with the current performance to see if code changes have messed things up.
I'm ambivalent about including this in the save file, since it will be saved
and loaded all the time when it should rarely change. But it seems like the
only reliable way to keep the score and performance in sync. Besides, it
shouldn't actually be that large, and if it is, the git repo save should
only save it when Config
changes. I could also split it into its own
file.
Performance | |
|
Instances
make_performance :: a -> IO (Performance a) Source #
Initial values for derivation.
This used to have other fields, but they were replaced by the more general
ky
and the implicit GLOBAL call. I haven't removed tempo yet because it's
the only way to change the speed for tempo-less blocks, and doesn't affect
(or rather, is undone automatically) for integrated blocks.
Default | |
|
type SavedViews = Map Text (Map Id.ViewId Block.View, Maybe Id.ViewId) Source #
This is a place to save sets of views so you can switch between them. The ViewId is the one with focus.