module Music.Score.Meta.RehearsalMark (
RehearsalMark,
rehearsalMark,
rehearsalMarkDuring,
withRehearsalMark,
) where
import Control.Lens (view)
import Control.Monad.Plus
import Data.Foldable (Foldable)
import qualified Data.Foldable as F
import qualified Data.List as List
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
import Data.Semigroup
import Data.Set (Set)
import qualified Data.Set as Set
import Data.String
import Data.Traversable (Traversable)
import qualified Data.Traversable as T
import Data.Typeable
import Music.Pitch.Literal
import Music.Score.Meta
import Music.Score.Part
import Music.Score.Pitch
import Music.Score.Internal.Util
import Music.Time
import Music.Time.Reactive
data RehearsalMark = RehearsalMark (Maybe String) Int
deriving (Eq, Ord, Typeable)
instance Semigroup RehearsalMark where
RehearsalMark n1 l1 <> RehearsalMark n2 l2 = RehearsalMark (n1 <> n2) (l1 `max` l2)
instance Monoid RehearsalMark where
mempty = RehearsalMark Nothing 0
mappend = (<>)
instance Show RehearsalMark where
show (RehearsalMark name level) = "A"
rehearsalMark :: (HasMeta a, HasPosition a) => RehearsalMark -> a -> a
rehearsalMark c x = rehearsalMarkDuring (_era x) c x
rehearsalMarkDuring :: HasMeta a => Span -> RehearsalMark -> a -> a
rehearsalMarkDuring s x = addMetaNote $ view event (s, x)
withRehearsalMark :: (RehearsalMark -> Score a -> Score a) -> Score a -> Score a
withRehearsalMark = withMeta