]> gitweb @ CieloNegro.org - EsounD.git/commitdiff
marshalling stream formats
authorPHO <pho@cielonegro.org>
Wed, 3 Nov 2010 07:16:09 +0000 (16:16 +0900)
committerPHO <pho@cielonegro.org>
Wed, 3 Nov 2010 07:16:09 +0000 (16:16 +0900)
EsounD.cabal
Sound/EsounD.hs

index 4df52be81a416f5be45e7c173d410761501f9f4b..47960a398a664806c5e40588cfe18e06f7657fa2 100644 (file)
@@ -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:
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"
+                    }