1 -- | Type-safe bindings to EsounD with monadic regions.
14 import Bindings.EsounD
15 import Control.Monad.CatchIO
16 import Control.Monad.Trans.Region
20 import Prelude.Unicode
21 import System.IO.SaferFileHandles
24 frameFmt ∷ fr → C'esd_format_t
26 instance Frame Int8 where
27 frameFmt _ = c'ESD_BITS8
29 instance Frame Int16 where
30 frameFmt _ = c'ESD_BITS16
32 class Channels ch where
33 channelFmt ∷ ch → C'esd_format_t
36 instance Channels Mono where
37 channelFmt _ = c'ESD_MONO
40 instance Channels Stereo where
41 channelFmt _ = c'ESD_STEREO
44 -- ^ An ESD handle for playing a stream.
45 data Player fr ch (r ∷ * → *)
48 , plHandle ∷ RegionalFileHandle WriteMode r
51 instance Dup (Player fr ch) where
53 = do h' ← dup (plHandle pl)
54 return pl { plHandle = h' }
56 -- | Open an ESD handle for playing a stream.
57 openPlayer ∷ ∀ fr ch s pr.
62 ⇒ Int -- ^ sample rate for the stream.
63 → HostName -- ^ host to connect to.
64 → Maybe String -- ^ name used to identify this stream to
66 → RegionT s pr (Player fr ch (RegionT s pr))
67 openPlayer rate host name
68 = do let fmt = frameFmt ((⊥) ∷ fr) .&.
69 channelFmt ((⊥) ∷ ch) .&.
74 , plHandle = error "FIXME: not implemented"