-- | Server input enumerations.
module Sound.Sc3.Server.Enum where

import Data.Maybe {- base -}

{- | Enumeration of possible locations to add new nodes (s_new and g_new).

>>> fromEnum AddToTail
1
-}
data AddAction
  = AddToHead
  | AddToTail
  | AddBefore
  | AddAfter
  | AddReplace
  deriving (AddAction -> AddAction -> Bool
(AddAction -> AddAction -> Bool)
-> (AddAction -> AddAction -> Bool) -> Eq AddAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddAction -> AddAction -> Bool
== :: AddAction -> AddAction -> Bool
$c/= :: AddAction -> AddAction -> Bool
/= :: AddAction -> AddAction -> Bool
Eq, Int -> AddAction -> ShowS
[AddAction] -> ShowS
AddAction -> String
(Int -> AddAction -> ShowS)
-> (AddAction -> String)
-> ([AddAction] -> ShowS)
-> Show AddAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddAction -> ShowS
showsPrec :: Int -> AddAction -> ShowS
$cshow :: AddAction -> String
show :: AddAction -> String
$cshowList :: [AddAction] -> ShowS
showList :: [AddAction] -> ShowS
Show, Int -> AddAction
AddAction -> Int
AddAction -> [AddAction]
AddAction -> AddAction
AddAction -> AddAction -> [AddAction]
AddAction -> AddAction -> AddAction -> [AddAction]
(AddAction -> AddAction)
-> (AddAction -> AddAction)
-> (Int -> AddAction)
-> (AddAction -> Int)
-> (AddAction -> [AddAction])
-> (AddAction -> AddAction -> [AddAction])
-> (AddAction -> AddAction -> [AddAction])
-> (AddAction -> AddAction -> AddAction -> [AddAction])
-> Enum AddAction
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: AddAction -> AddAction
succ :: AddAction -> AddAction
$cpred :: AddAction -> AddAction
pred :: AddAction -> AddAction
$ctoEnum :: Int -> AddAction
toEnum :: Int -> AddAction
$cfromEnum :: AddAction -> Int
fromEnum :: AddAction -> Int
$cenumFrom :: AddAction -> [AddAction]
enumFrom :: AddAction -> [AddAction]
$cenumFromThen :: AddAction -> AddAction -> [AddAction]
enumFromThen :: AddAction -> AddAction -> [AddAction]
$cenumFromTo :: AddAction -> AddAction -> [AddAction]
enumFromTo :: AddAction -> AddAction -> [AddAction]
$cenumFromThenTo :: AddAction -> AddAction -> AddAction -> [AddAction]
enumFromThenTo :: AddAction -> AddAction -> AddAction -> [AddAction]
Enum)

-- | Enumeration of flags for '/b_gen' command.
data B_Gen = Normalise | Wavetable | Clear
  deriving (B_Gen -> B_Gen -> Bool
(B_Gen -> B_Gen -> Bool) -> (B_Gen -> B_Gen -> Bool) -> Eq B_Gen
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: B_Gen -> B_Gen -> Bool
== :: B_Gen -> B_Gen -> Bool
$c/= :: B_Gen -> B_Gen -> Bool
/= :: B_Gen -> B_Gen -> Bool
Eq, Int -> B_Gen
B_Gen -> Int
B_Gen -> [B_Gen]
B_Gen -> B_Gen
B_Gen -> B_Gen -> [B_Gen]
B_Gen -> B_Gen -> B_Gen -> [B_Gen]
(B_Gen -> B_Gen)
-> (B_Gen -> B_Gen)
-> (Int -> B_Gen)
-> (B_Gen -> Int)
-> (B_Gen -> [B_Gen])
-> (B_Gen -> B_Gen -> [B_Gen])
-> (B_Gen -> B_Gen -> [B_Gen])
-> (B_Gen -> B_Gen -> B_Gen -> [B_Gen])
-> Enum B_Gen
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: B_Gen -> B_Gen
succ :: B_Gen -> B_Gen
$cpred :: B_Gen -> B_Gen
pred :: B_Gen -> B_Gen
$ctoEnum :: Int -> B_Gen
toEnum :: Int -> B_Gen
$cfromEnum :: B_Gen -> Int
fromEnum :: B_Gen -> Int
$cenumFrom :: B_Gen -> [B_Gen]
enumFrom :: B_Gen -> [B_Gen]
$cenumFromThen :: B_Gen -> B_Gen -> [B_Gen]
enumFromThen :: B_Gen -> B_Gen -> [B_Gen]
$cenumFromTo :: B_Gen -> B_Gen -> [B_Gen]
enumFromTo :: B_Gen -> B_Gen -> [B_Gen]
$cenumFromThenTo :: B_Gen -> B_Gen -> B_Gen -> [B_Gen]
enumFromThenTo :: B_Gen -> B_Gen -> B_Gen -> [B_Gen]
Enum, B_Gen
B_Gen -> B_Gen -> Bounded B_Gen
forall a. a -> a -> Bounded a
$cminBound :: B_Gen
minBound :: B_Gen
$cmaxBound :: B_Gen
maxBound :: B_Gen
Bounded, Int -> B_Gen -> ShowS
[B_Gen] -> ShowS
B_Gen -> String
(Int -> B_Gen -> ShowS)
-> (B_Gen -> String) -> ([B_Gen] -> ShowS) -> Show B_Gen
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> B_Gen -> ShowS
showsPrec :: Int -> B_Gen -> ShowS
$cshow :: B_Gen -> String
show :: B_Gen -> String
$cshowList :: [B_Gen] -> ShowS
showList :: [B_Gen] -> ShowS
Show)

{- | 'B_Gen' to bit number.

>>> map b_gen_bit [minBound .. maxBound]
[0,1,2]
-}
b_gen_bit :: B_Gen -> Int
b_gen_bit :: B_Gen -> Int
b_gen_bit = B_Gen -> Int
forall a. Enum a => a -> Int
fromEnum

{- | Set of 'B_Gen' to flag.

>>> b_gen_flag [minBound .. maxBound]
7
-}
b_gen_flag :: [B_Gen] -> Int
b_gen_flag :: [B_Gen] -> Int
b_gen_flag = [Int] -> Int
forall a. Num a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum ([Int] -> Int) -> ([B_Gen] -> [Int]) -> [B_Gen] -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (B_Gen -> Int) -> [B_Gen] -> [Int]
forall a b. (a -> b) -> [a] -> [b]
map ((Int
2 Int -> Int -> Int
forall a b. (Num a, Integral b) => a -> b -> a
^) (Int -> Int) -> (B_Gen -> Int) -> B_Gen -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. B_Gen -> Int
b_gen_bit)

-- | Error posting scope.
data ErrorScope
  = -- | Global scope
    Globally
  | -- | Bundle scope
    Locally
  deriving (ErrorScope -> ErrorScope -> Bool
(ErrorScope -> ErrorScope -> Bool)
-> (ErrorScope -> ErrorScope -> Bool) -> Eq ErrorScope
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ErrorScope -> ErrorScope -> Bool
== :: ErrorScope -> ErrorScope -> Bool
$c/= :: ErrorScope -> ErrorScope -> Bool
/= :: ErrorScope -> ErrorScope -> Bool
Eq, Int -> ErrorScope -> ShowS
[ErrorScope] -> ShowS
ErrorScope -> String
(Int -> ErrorScope -> ShowS)
-> (ErrorScope -> String)
-> ([ErrorScope] -> ShowS)
-> Show ErrorScope
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ErrorScope -> ShowS
showsPrec :: Int -> ErrorScope -> ShowS
$cshow :: ErrorScope -> String
show :: ErrorScope -> String
$cshowList :: [ErrorScope] -> ShowS
showList :: [ErrorScope] -> ShowS
Show, Int -> ErrorScope
ErrorScope -> Int
ErrorScope -> [ErrorScope]
ErrorScope -> ErrorScope
ErrorScope -> ErrorScope -> [ErrorScope]
ErrorScope -> ErrorScope -> ErrorScope -> [ErrorScope]
(ErrorScope -> ErrorScope)
-> (ErrorScope -> ErrorScope)
-> (Int -> ErrorScope)
-> (ErrorScope -> Int)
-> (ErrorScope -> [ErrorScope])
-> (ErrorScope -> ErrorScope -> [ErrorScope])
-> (ErrorScope -> ErrorScope -> [ErrorScope])
-> (ErrorScope -> ErrorScope -> ErrorScope -> [ErrorScope])
-> Enum ErrorScope
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ErrorScope -> ErrorScope
succ :: ErrorScope -> ErrorScope
$cpred :: ErrorScope -> ErrorScope
pred :: ErrorScope -> ErrorScope
$ctoEnum :: Int -> ErrorScope
toEnum :: Int -> ErrorScope
$cfromEnum :: ErrorScope -> Int
fromEnum :: ErrorScope -> Int
$cenumFrom :: ErrorScope -> [ErrorScope]
enumFrom :: ErrorScope -> [ErrorScope]
$cenumFromThen :: ErrorScope -> ErrorScope -> [ErrorScope]
enumFromThen :: ErrorScope -> ErrorScope -> [ErrorScope]
$cenumFromTo :: ErrorScope -> ErrorScope -> [ErrorScope]
enumFromTo :: ErrorScope -> ErrorScope -> [ErrorScope]
$cenumFromThenTo :: ErrorScope -> ErrorScope -> ErrorScope -> [ErrorScope]
enumFromThenTo :: ErrorScope -> ErrorScope -> ErrorScope -> [ErrorScope]
Enum)

-- | Error posting mode.
data ErrorMode
  = -- | Turn error posting off
    ErrorsOff
  | -- | Turn error posting on
    ErrorsOn
  deriving (ErrorMode -> ErrorMode -> Bool
(ErrorMode -> ErrorMode -> Bool)
-> (ErrorMode -> ErrorMode -> Bool) -> Eq ErrorMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ErrorMode -> ErrorMode -> Bool
== :: ErrorMode -> ErrorMode -> Bool
$c/= :: ErrorMode -> ErrorMode -> Bool
/= :: ErrorMode -> ErrorMode -> Bool
Eq, Int -> ErrorMode -> ShowS
[ErrorMode] -> ShowS
ErrorMode -> String
(Int -> ErrorMode -> ShowS)
-> (ErrorMode -> String)
-> ([ErrorMode] -> ShowS)
-> Show ErrorMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ErrorMode -> ShowS
showsPrec :: Int -> ErrorMode -> ShowS
$cshow :: ErrorMode -> String
show :: ErrorMode -> String
$cshowList :: [ErrorMode] -> ShowS
showList :: [ErrorMode] -> ShowS
Show, Int -> ErrorMode
ErrorMode -> Int
ErrorMode -> [ErrorMode]
ErrorMode -> ErrorMode
ErrorMode -> ErrorMode -> [ErrorMode]
ErrorMode -> ErrorMode -> ErrorMode -> [ErrorMode]
(ErrorMode -> ErrorMode)
-> (ErrorMode -> ErrorMode)
-> (Int -> ErrorMode)
-> (ErrorMode -> Int)
-> (ErrorMode -> [ErrorMode])
-> (ErrorMode -> ErrorMode -> [ErrorMode])
-> (ErrorMode -> ErrorMode -> [ErrorMode])
-> (ErrorMode -> ErrorMode -> ErrorMode -> [ErrorMode])
-> Enum ErrorMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ErrorMode -> ErrorMode
succ :: ErrorMode -> ErrorMode
$cpred :: ErrorMode -> ErrorMode
pred :: ErrorMode -> ErrorMode
$ctoEnum :: Int -> ErrorMode
toEnum :: Int -> ErrorMode
$cfromEnum :: ErrorMode -> Int
fromEnum :: ErrorMode -> Int
$cenumFrom :: ErrorMode -> [ErrorMode]
enumFrom :: ErrorMode -> [ErrorMode]
$cenumFromThen :: ErrorMode -> ErrorMode -> [ErrorMode]
enumFromThen :: ErrorMode -> ErrorMode -> [ErrorMode]
$cenumFromTo :: ErrorMode -> ErrorMode -> [ErrorMode]
enumFromTo :: ErrorMode -> ErrorMode -> [ErrorMode]
$cenumFromThenTo :: ErrorMode -> ErrorMode -> ErrorMode -> [ErrorMode]
enumFromThenTo :: ErrorMode -> ErrorMode -> ErrorMode -> [ErrorMode]
Enum)

-- | Enumeration of Message printer types.
data PrintLevel
  = NoPrinter
  | TextPrinter
  | HexPrinter
  | AllPrinter
  deriving (PrintLevel -> PrintLevel -> Bool
(PrintLevel -> PrintLevel -> Bool)
-> (PrintLevel -> PrintLevel -> Bool) -> Eq PrintLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrintLevel -> PrintLevel -> Bool
== :: PrintLevel -> PrintLevel -> Bool
$c/= :: PrintLevel -> PrintLevel -> Bool
/= :: PrintLevel -> PrintLevel -> Bool
Eq, Int -> PrintLevel -> ShowS
[PrintLevel] -> ShowS
PrintLevel -> String
(Int -> PrintLevel -> ShowS)
-> (PrintLevel -> String)
-> ([PrintLevel] -> ShowS)
-> Show PrintLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrintLevel -> ShowS
showsPrec :: Int -> PrintLevel -> ShowS
$cshow :: PrintLevel -> String
show :: PrintLevel -> String
$cshowList :: [PrintLevel] -> ShowS
showList :: [PrintLevel] -> ShowS
Show, Int -> PrintLevel
PrintLevel -> Int
PrintLevel -> [PrintLevel]
PrintLevel -> PrintLevel
PrintLevel -> PrintLevel -> [PrintLevel]
PrintLevel -> PrintLevel -> PrintLevel -> [PrintLevel]
(PrintLevel -> PrintLevel)
-> (PrintLevel -> PrintLevel)
-> (Int -> PrintLevel)
-> (PrintLevel -> Int)
-> (PrintLevel -> [PrintLevel])
-> (PrintLevel -> PrintLevel -> [PrintLevel])
-> (PrintLevel -> PrintLevel -> [PrintLevel])
-> (PrintLevel -> PrintLevel -> PrintLevel -> [PrintLevel])
-> Enum PrintLevel
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: PrintLevel -> PrintLevel
succ :: PrintLevel -> PrintLevel
$cpred :: PrintLevel -> PrintLevel
pred :: PrintLevel -> PrintLevel
$ctoEnum :: Int -> PrintLevel
toEnum :: Int -> PrintLevel
$cfromEnum :: PrintLevel -> Int
fromEnum :: PrintLevel -> Int
$cenumFrom :: PrintLevel -> [PrintLevel]
enumFrom :: PrintLevel -> [PrintLevel]
$cenumFromThen :: PrintLevel -> PrintLevel -> [PrintLevel]
enumFromThen :: PrintLevel -> PrintLevel -> [PrintLevel]
$cenumFromTo :: PrintLevel -> PrintLevel -> [PrintLevel]
enumFromTo :: PrintLevel -> PrintLevel -> [PrintLevel]
$cenumFromThenTo :: PrintLevel -> PrintLevel -> PrintLevel -> [PrintLevel]
enumFromThenTo :: PrintLevel -> PrintLevel -> PrintLevel -> [PrintLevel]
Enum)

-- | Sound file format.
data SoundFileFormat = Aiff | Flac | Ircam | Next | Raw | Wave
  deriving (Int -> SoundFileFormat
SoundFileFormat -> Int
SoundFileFormat -> [SoundFileFormat]
SoundFileFormat -> SoundFileFormat
SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
SoundFileFormat
-> SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
(SoundFileFormat -> SoundFileFormat)
-> (SoundFileFormat -> SoundFileFormat)
-> (Int -> SoundFileFormat)
-> (SoundFileFormat -> Int)
-> (SoundFileFormat -> [SoundFileFormat])
-> (SoundFileFormat -> SoundFileFormat -> [SoundFileFormat])
-> (SoundFileFormat -> SoundFileFormat -> [SoundFileFormat])
-> (SoundFileFormat
    -> SoundFileFormat -> SoundFileFormat -> [SoundFileFormat])
-> Enum SoundFileFormat
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: SoundFileFormat -> SoundFileFormat
succ :: SoundFileFormat -> SoundFileFormat
$cpred :: SoundFileFormat -> SoundFileFormat
pred :: SoundFileFormat -> SoundFileFormat
$ctoEnum :: Int -> SoundFileFormat
toEnum :: Int -> SoundFileFormat
$cfromEnum :: SoundFileFormat -> Int
fromEnum :: SoundFileFormat -> Int
$cenumFrom :: SoundFileFormat -> [SoundFileFormat]
enumFrom :: SoundFileFormat -> [SoundFileFormat]
$cenumFromThen :: SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
enumFromThen :: SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
$cenumFromTo :: SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
enumFromTo :: SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
$cenumFromThenTo :: SoundFileFormat
-> SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
enumFromThenTo :: SoundFileFormat
-> SoundFileFormat -> SoundFileFormat -> [SoundFileFormat]
Enum, SoundFileFormat -> SoundFileFormat -> Bool
(SoundFileFormat -> SoundFileFormat -> Bool)
-> (SoundFileFormat -> SoundFileFormat -> Bool)
-> Eq SoundFileFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SoundFileFormat -> SoundFileFormat -> Bool
== :: SoundFileFormat -> SoundFileFormat -> Bool
$c/= :: SoundFileFormat -> SoundFileFormat -> Bool
/= :: SoundFileFormat -> SoundFileFormat -> Bool
Eq, ReadPrec [SoundFileFormat]
ReadPrec SoundFileFormat
Int -> ReadS SoundFileFormat
ReadS [SoundFileFormat]
(Int -> ReadS SoundFileFormat)
-> ReadS [SoundFileFormat]
-> ReadPrec SoundFileFormat
-> ReadPrec [SoundFileFormat]
-> Read SoundFileFormat
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SoundFileFormat
readsPrec :: Int -> ReadS SoundFileFormat
$creadList :: ReadS [SoundFileFormat]
readList :: ReadS [SoundFileFormat]
$creadPrec :: ReadPrec SoundFileFormat
readPrec :: ReadPrec SoundFileFormat
$creadListPrec :: ReadPrec [SoundFileFormat]
readListPrec :: ReadPrec [SoundFileFormat]
Read, Int -> SoundFileFormat -> ShowS
[SoundFileFormat] -> ShowS
SoundFileFormat -> String
(Int -> SoundFileFormat -> ShowS)
-> (SoundFileFormat -> String)
-> ([SoundFileFormat] -> ShowS)
-> Show SoundFileFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SoundFileFormat -> ShowS
showsPrec :: Int -> SoundFileFormat -> ShowS
$cshow :: SoundFileFormat -> String
show :: SoundFileFormat -> String
$cshowList :: [SoundFileFormat] -> ShowS
showList :: [SoundFileFormat] -> ShowS
Show)

-- | Sample format.
data SampleFormat
  = PcmInt8
  | PcmInt16
  | PcmInt24
  | PcmInt32
  | PcmFloat
  | PcmDouble
  | PcmMulaw
  | PcmAlaw
  deriving (Int -> SampleFormat
SampleFormat -> Int
SampleFormat -> [SampleFormat]
SampleFormat -> SampleFormat
SampleFormat -> SampleFormat -> [SampleFormat]
SampleFormat -> SampleFormat -> SampleFormat -> [SampleFormat]
(SampleFormat -> SampleFormat)
-> (SampleFormat -> SampleFormat)
-> (Int -> SampleFormat)
-> (SampleFormat -> Int)
-> (SampleFormat -> [SampleFormat])
-> (SampleFormat -> SampleFormat -> [SampleFormat])
-> (SampleFormat -> SampleFormat -> [SampleFormat])
-> (SampleFormat -> SampleFormat -> SampleFormat -> [SampleFormat])
-> Enum SampleFormat
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: SampleFormat -> SampleFormat
succ :: SampleFormat -> SampleFormat
$cpred :: SampleFormat -> SampleFormat
pred :: SampleFormat -> SampleFormat
$ctoEnum :: Int -> SampleFormat
toEnum :: Int -> SampleFormat
$cfromEnum :: SampleFormat -> Int
fromEnum :: SampleFormat -> Int
$cenumFrom :: SampleFormat -> [SampleFormat]
enumFrom :: SampleFormat -> [SampleFormat]
$cenumFromThen :: SampleFormat -> SampleFormat -> [SampleFormat]
enumFromThen :: SampleFormat -> SampleFormat -> [SampleFormat]
$cenumFromTo :: SampleFormat -> SampleFormat -> [SampleFormat]
enumFromTo :: SampleFormat -> SampleFormat -> [SampleFormat]
$cenumFromThenTo :: SampleFormat -> SampleFormat -> SampleFormat -> [SampleFormat]
enumFromThenTo :: SampleFormat -> SampleFormat -> SampleFormat -> [SampleFormat]
Enum, SampleFormat -> SampleFormat -> Bool
(SampleFormat -> SampleFormat -> Bool)
-> (SampleFormat -> SampleFormat -> Bool) -> Eq SampleFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SampleFormat -> SampleFormat -> Bool
== :: SampleFormat -> SampleFormat -> Bool
$c/= :: SampleFormat -> SampleFormat -> Bool
/= :: SampleFormat -> SampleFormat -> Bool
Eq, ReadPrec [SampleFormat]
ReadPrec SampleFormat
Int -> ReadS SampleFormat
ReadS [SampleFormat]
(Int -> ReadS SampleFormat)
-> ReadS [SampleFormat]
-> ReadPrec SampleFormat
-> ReadPrec [SampleFormat]
-> Read SampleFormat
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS SampleFormat
readsPrec :: Int -> ReadS SampleFormat
$creadList :: ReadS [SampleFormat]
readList :: ReadS [SampleFormat]
$creadPrec :: ReadPrec SampleFormat
readPrec :: ReadPrec SampleFormat
$creadListPrec :: ReadPrec [SampleFormat]
readListPrec :: ReadPrec [SampleFormat]
Read, Int -> SampleFormat -> ShowS
[SampleFormat] -> ShowS
SampleFormat -> String
(Int -> SampleFormat -> ShowS)
-> (SampleFormat -> String)
-> ([SampleFormat] -> ShowS)
-> Show SampleFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SampleFormat -> ShowS
showsPrec :: Int -> SampleFormat -> ShowS
$cshow :: SampleFormat -> String
show :: SampleFormat -> String
$cshowList :: [SampleFormat] -> ShowS
showList :: [SampleFormat] -> ShowS
Show)

-- | Sample format to standard file extension name.
soundFileFormatString :: SoundFileFormat -> String
soundFileFormatString :: SoundFileFormat -> String
soundFileFormatString SoundFileFormat
f =
  case SoundFileFormat
f of
    SoundFileFormat
Aiff -> String
"aiff"
    SoundFileFormat
Flac -> String
"flac"
    SoundFileFormat
Ircam -> String
"ircam"
    SoundFileFormat
Next -> String
"next"
    SoundFileFormat
Raw -> String
"raw"
    SoundFileFormat
Wave -> String
"wav"

-- | Infer sample format from file extension name.
soundFileFormat_from_extension :: String -> Maybe SoundFileFormat
soundFileFormat_from_extension :: String -> Maybe SoundFileFormat
soundFileFormat_from_extension =
  let tbl :: [(String, SoundFileFormat)]
tbl =
        [ (String
"aif", SoundFileFormat
Aiff)
        , (String
"aiff", SoundFileFormat
Aiff)
        , (String
"flac", SoundFileFormat
Flac)
        , (String
"ircam", SoundFileFormat
Ircam)
        , (String
"next", SoundFileFormat
Next)
        , (String
"raw", SoundFileFormat
Raw)
        , (String
"wav", SoundFileFormat
Wave)
        ]
  in (String -> [(String, SoundFileFormat)] -> Maybe SoundFileFormat)
-> [(String, SoundFileFormat)] -> String -> Maybe SoundFileFormat
forall a b c. (a -> b -> c) -> b -> a -> c
flip String -> [(String, SoundFileFormat)] -> Maybe SoundFileFormat
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup [(String, SoundFileFormat)]
tbl

-- | Erroring variant.
soundFileFormat_from_extension_err :: String -> SoundFileFormat
soundFileFormat_from_extension_err :: String -> SoundFileFormat
soundFileFormat_from_extension_err =
  SoundFileFormat -> Maybe SoundFileFormat -> SoundFileFormat
forall a. a -> Maybe a -> a
fromMaybe (String -> SoundFileFormat
forall a. HasCallStack => String -> a
error String
"soundFileFormat_from_extension: unknown sf extension")
    (Maybe SoundFileFormat -> SoundFileFormat)
-> (String -> Maybe SoundFileFormat) -> String -> SoundFileFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Maybe SoundFileFormat
soundFileFormat_from_extension

-- | 'SampleFormat' string as recognised by scsynth NRT mode.
sampleFormatString :: SampleFormat -> String
sampleFormatString :: SampleFormat -> String
sampleFormatString SampleFormat
f =
  case SampleFormat
f of
    SampleFormat
PcmInt8 -> String
"int8"
    SampleFormat
PcmInt16 -> String
"int16"
    SampleFormat
PcmInt24 -> String
"int24"
    SampleFormat
PcmInt32 -> String
"int32"
    SampleFormat
PcmFloat -> String
"float"
    SampleFormat
PcmDouble -> String
"double"
    SampleFormat
PcmMulaw -> String
"mulaw"
    SampleFormat
PcmAlaw -> String
"alaw"