{-# OPTIONS_GHC -threaded #-}
{-# LANGUAGE FlexibleInstances #-}
module DobutokO.Sound.Effects.Stat where
import Numeric (showFFloat)
import DobutokO.Sound.Effects.Misc (MscS(..))
data StatP a = S a | RMS | V | Freq | D deriving Eq
instance Show (StatP Float) where
show (S x) = mconcat ["-s ", showFFloat Nothing x " "]
show RMS = "-rms "
show V = "-v "
show D = "-d "
show _ = "-freq "
type StatP1 = StatP Float
statPC :: StatP a -> String
statPC (S _) = "S"
statPC RMS = "RMS"
statPC V = "V"
statPC D = "D"
statPC _ = "Freq"
statP1 :: StatP a -> Maybe a
statP1 (S x) = Just x
statP1 _ = Nothing
statPSet1 :: a -> StatP a
statPSet1 = S
data Stat1 a = ST (MscS a) deriving Eq
instance Show (Stat1 StatP1) where
show (ST (Msc xs)) = mconcat ["stat ", show (Msc xs)]
type Stat = Stat1 StatP1
stat11 :: Stat1 a -> [a]
stat11 (ST (Msc xs)) = xs
stat1Set1 :: [a] -> Stat1 a
stat1Set1 xs = ST (Msc xs)
showSTQ :: Stat -> [String]
showSTQ = words . show