X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=EsounD.git;a=blobdiff_plain;f=Sound%2FEsounD%2FInternals.hs;h=f75f99a0dc1770777e9aa196505058a1854539f3;hp=987dd1e285262891ba79e69a6e985b0c0e7d0bb0;hb=d2396e7b6183bb033861069aaeb52be53a90bfdf;hpb=951367c7c17ddbc417a998fe9a19d6434f63f386 diff --git a/Sound/EsounD/Internals.hs b/Sound/EsounD/Internals.hs index 987dd1e..f75f99a 100644 --- a/Sound/EsounD/Internals.hs +++ b/Sound/EsounD/Internals.hs @@ -1,11 +1,18 @@ module Sound.EsounD.Internals - ( wrapSocket + ( Frame(..) + + , Channels(..) + , Mono + , Stereo + + , wrapSocket , closeSocket , withCStrOrNull ) where import Bindings.EsounD +import Data.Int import Foreign.C.String import Foreign.C.Types import Foreign.Ptr @@ -13,6 +20,27 @@ import System.IO import System.Posix.IO import System.Posix.Types +class Frame fr where + frameFmt ∷ fr → C'esd_format_t + +instance Frame Int8 where + frameFmt _ = c'ESD_BITS8 + +instance Frame Int16 where + frameFmt _ = c'ESD_BITS16 + +class Channels ch where + channelFmt ∷ ch → C'esd_format_t + +data Mono +instance Channels Mono where + channelFmt _ = c'ESD_MONO + +data Stereo +instance Channels Stereo where + channelFmt _ = c'ESD_STEREO + + wrapSocket :: String -> CInt → IO Handle wrapSocket e (-1) = fail e wrapSocket _ fd = fdToHandle (Fd fd)