From 9be39a0e8dc40b5fbd3280a5d06f7a85626e0b33 Mon Sep 17 00:00:00 2001 From: PHO Date: Sat, 1 Jan 2011 22:57:05 +0900 Subject: [PATCH] code cleanup --- Sound/EsounD.hs | 2 ++ Sound/EsounD/Player.hs | 7 +++++-- examples/EsdPlayerExample.hs | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Sound/EsounD.hs b/Sound/EsounD.hs index e9276a0..c44e6dd 100644 --- a/Sound/EsounD.hs +++ b/Sound/EsounD.hs @@ -1,9 +1,11 @@ -- | 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 diff --git a/Sound/EsounD/Player.hs b/Sound/EsounD/Player.hs index 7f7eb22..b48dfee 100644 --- a/Sound/EsounD/Player.hs +++ b/Sound/EsounD/Player.hs @@ -13,7 +13,9 @@ module 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 @@ -54,7 +56,7 @@ instance Frame fr ⇒ Writable (Player fr Stereo) (L.Vector fr, L.Vector fr) whe 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. @@ -62,7 +64,8 @@ openPlayer ∷ ∀fr ch s pr. -- 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 diff --git a/examples/EsdPlayerExample.hs b/examples/EsdPlayerExample.hs index 383001d..126e1fe 100644 --- a/examples/EsdPlayerExample.hs +++ b/examples/EsdPlayerExample.hs @@ -7,9 +7,7 @@ import Control.Monad.Trans.Region 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 $ -- 2.40.0