1 -- | Type-safe bindings to EsounD with monadic regions.
14 import Bindings.EsounD
15 import Control.Monad.CatchIO
16 import Control.Monad.Trans.Region
19 import System.IO.SaferFileHandles
22 frameFmt ∷ fr → C'esd_format_t
24 instance Frame Int8 where
25 frameFmt _ = c'ESD_BITS8
27 instance Frame Int16 where
28 frameFmt _ = c'ESD_BITS16
30 class Channels ch where
31 channelFmt ∷ ch → C'esd_format_t
34 instance Channels Mono where
35 channelFmt _ = c'ESD_MONO
38 instance Channels Stereo where
39 channelFmt _ = c'ESD_STEREO
42 -- ^ An ESD handle for playing a stream.
43 data Player fr ch (r ∷ * → *)
46 , plHandle ∷ RegionalFileHandle WriteMode r
49 instance Dup (Player fr ch) where
51 = do h' ← dup (plHandle pl)
52 return pl { plHandle = h' }
54 -- | Open an ESD handle for playing a stream.
55 openPlayer ∷ ( Frame fr
59 ⇒ Int -- ^ sample rate for the stream.
60 → HostName -- ^ host to connect to.
61 → Maybe String -- ^ name used to identify this stream to
63 → RegionT s pr (Player fr ch (RegionT s pr))
64 openPlayer rate host name
67 , plHandle = error "FIXME: not implemented"