-- | Type-safe bindings to EsounD with monadic regions.
module Sound.EsounD
( module Sound.EsounD.Types
+ , module Sound.EsounD.Streams
, module Sound.EsounD.Player
)
where
+import Sound.EsounD.Streams
import Sound.EsounD.Types
import Sound.EsounD.Player
)
where
import Bindings.EsounD
+import Control.Exception.Peel
import Control.Monad.IO.Class
+import Control.Monad.IO.Peel
import Control.Monad.Trans.Region
import Control.Monad.Trans.Region.OnExit
import Control.Monad.Unicode
openPlayer ∷ ∀fr ch s pr.
( Frame fr
, Channels ch
- , MonadIO pr
+ , MonadPeelIO pr
)
⇒ Int -- ^ sample rate for the stream.
→ Maybe HostName -- ^ host to connect to.
-- ESD (if any).
→ RegionT s pr (Player fr ch (RegionT s pr))
openPlayer rate host name
- = do h ← liftIO openSocket
+ = block $
+ do h ← liftIO openSocket
ch ← onExit $ sanitizeIOError $ closeSocket h
return Player {
plRate = rate
import Data.Int
import qualified Data.StorableVector.Lazy as L
import Prelude.Unicode
-import Sound.EsounD.Player
-import Sound.EsounD.Streams
-import Sound.EsounD.Types
+import Sound.EsounD
main ∷ IO ()
main = runRegionT $