From: PHO Date: Wed, 3 Nov 2010 07:16:09 +0000 (+0900) Subject: marshalling stream formats X-Git-Tag: RELEASE-0.1~21 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=72018d56d3994c4f514f511d5d0c7970fbb1e79c;p=EsounD.git marshalling stream formats --- diff --git a/EsounD.cabal b/EsounD.cabal index 4df52be..47960a3 100644 --- a/EsounD.cabal +++ b/EsounD.cabal @@ -24,6 +24,7 @@ Library Build-Depends: MonadCatchIO-transformers == 0.2.*, base == 4.2.*, + base-unicode-symbols == 0.2.*, bindings-EsounD == 0.1.*, network == 2.2.*, regions == 0.7.*, @@ -36,6 +37,7 @@ Library Extensions: EmptyDataDecls KindSignatures + ScopedTypeVariables UnicodeSyntax GHC-Options: diff --git a/Sound/EsounD.hs b/Sound/EsounD.hs index 6adeddf..a088e90 100644 --- a/Sound/EsounD.hs +++ b/Sound/EsounD.hs @@ -14,8 +14,10 @@ module Sound.EsounD import Bindings.EsounD import Control.Monad.CatchIO import Control.Monad.Trans.Region +import Data.Bits import Data.Int import Network +import Prelude.Unicode import System.IO.SaferFileHandles class Frame fr where @@ -52,17 +54,22 @@ instance Dup (Player fr ch) where return pl { plHandle = h' } -- | Open an ESD handle for playing a stream. -openPlayer ∷ ( Frame fr - , Channels ch - , MonadCatchIO pr - ) +openPlayer ∷ ∀ fr ch s pr. + ( Frame fr + , Channels ch + , MonadCatchIO pr + ) ⇒ Int -- ^ sample rate for the stream. → HostName -- ^ host to connect to. → Maybe String -- ^ name used to identify this stream to -- ESD (if any). → RegionT s pr (Player fr ch (RegionT s pr)) openPlayer rate host name - = return Player { - plRate = rate - , plHandle = error "FIXME: not implemented" - } + = do let fmt = frameFmt ((⊥) ∷ fr) .&. + channelFmt ((⊥) ∷ ch) .&. + c'ESD_STREAM .&. + c'ESD_PLAY + return Player { + plRate = rate + , plHandle = error "FIXME: not implemented" + }