]> gitweb @ CieloNegro.org - EsounD.git/blobdiff - Sound/EsounD.hs
marshalling stream formats
[EsounD.git] / Sound / EsounD.hs
index 6adeddf31fcd9128694a176b6621083113a132b3..a088e9072c79e8fbac137a5250c1f1fb769d87ee 100644 (file)
@@ -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"
+                    }