module Music.Score.Ornaments (
HasTremolo(..),
TremoloT(..),
HasText(..),
TextT(..),
HasHarmonic(..),
HarmonicT(..),
HasSlide(..),
SlideT(..),
tremolo,
text,
harmonic,
artificial,
slide,
) where
import Data.Ratio
import Data.Foldable
import Data.Monoid
import Data.Typeable
import qualified Data.List as List
import Data.VectorSpace
import Data.AffineSpace
import Music.Score.Voice
import Music.Score.Score
import Music.Time
import Music.Score.Part
import Music.Score.Combinators
class HasTremolo a where
setTrem :: Int -> a -> a
newtype TremoloT a = TremoloT { getTremoloT :: (Int, a) }
deriving (Eq, Show, Ord, Functor, Typeable)
class HasText a where
addText :: String -> a -> a
newtype TextT a = TextT { getTextT :: ([String], a) }
deriving (Eq, Show, Ord, Functor, Typeable)
class HasHarmonic a where
setHarmonic :: Int -> a -> a
newtype HarmonicT a = HarmonicT { getHarmonicT :: (Int, a) }
deriving (Eq, Show, Ord, Functor, Typeable)
class HasSlide a where
setBeginGliss :: Bool -> a -> a
setBeginSlide :: Bool -> a -> a
setEndGliss :: Bool -> a -> a
setEndSlide :: Bool -> a -> a
newtype SlideT a = SlideT { getSlideT :: (Bool, Bool, a, Bool, Bool) }
deriving (Eq, Show, Ord, Functor, Typeable)
tremolo :: (Functor s, HasTremolo b) => Int -> s b -> s b
tremolo n = fmap (setTrem n)
text :: (HasEvents s, HasPart' a, HasText a) => String -> s a -> s a
text s = mapPhrase (addText s) id id
slide :: (HasEvents s, HasPart' a, HasSlide a) => s a -> s a
slide = mapPhrase (setBeginSlide True) id (setEndSlide True)
glissando :: (HasEvents s, HasPart' a, HasSlide a) => s a -> s a
glissando = mapPhrase (setBeginGliss True) id (setEndGliss True)
harmonic :: (Functor s, HasHarmonic a) => Int -> s a -> s a
harmonic n = fmap (setHarmonic n)
artificial :: (Functor s, HasHarmonic a) => s a -> s a
artificial = fmap f where f = setHarmonic (4)