packages feed

alsa 0.3 → 0.4

raw patch · 4 files changed

+35/−19 lines, 4 filesdep +extensible-exceptionsdep ~arraydep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: extensible-exceptions

Dependency ranges changed: array, base

API changes (from Hackage documentation)

- Sound.Alsa: instance (SampleFmt a) => SampleFmt (T a)
+ Sound.Alsa: instance SampleFmt a => SampleFmt (T a)
+ Sound.Alsa.Error: instance Exception AlsaException
+ Sound.Alsa.Error: instance Show AlsaException
- Sound.Alsa: alsaSoundSink :: (SampleFmt y) => String -> SoundFmt y -> SoundSink y Pcm
+ Sound.Alsa: alsaSoundSink :: SampleFmt y => String -> SoundFmt y -> SoundSink y Pcm
- Sound.Alsa: alsaSoundSinkTime :: (SampleFmt y) => String -> SoundFmt y -> SoundBufferTime -> SoundSink y Pcm
+ Sound.Alsa: alsaSoundSinkTime :: SampleFmt y => String -> SoundFmt y -> SoundBufferTime -> SoundSink y Pcm
- Sound.Alsa: alsaSoundSource :: (SampleFmt y) => String -> SoundFmt y -> SoundSource y Pcm
+ Sound.Alsa: alsaSoundSource :: SampleFmt y => String -> SoundFmt y -> SoundSource y Pcm
- Sound.Alsa: alsaSoundSourceTime :: (SampleFmt y) => String -> SoundFmt y -> SoundBufferTime -> SoundSource y Pcm
+ Sound.Alsa: alsaSoundSourceTime :: SampleFmt y => String -> SoundFmt y -> SoundBufferTime -> SoundSource y Pcm
- Sound.Alsa: audioBytesPerFrame :: (SampleFmt y) => SoundFmt y -> Int
+ Sound.Alsa: audioBytesPerFrame :: SampleFmt y => SoundFmt y -> Int
- Sound.Alsa: audioBytesPerSample :: (SampleFmt y) => SoundFmt y -> Int
+ Sound.Alsa: audioBytesPerSample :: SampleFmt y => SoundFmt y -> Int
- Sound.Alsa: copySound :: (SampleFmt y) => SoundSource y h1 -> SoundSink y h2 -> Int -> IO ()
+ Sound.Alsa: copySound :: SampleFmt y => SoundSource y h1 -> SoundSink y h2 -> Int -> IO ()
- Sound.Alsa: fileSoundSink :: (SampleFmt y) => FilePath -> SoundFmt y -> SoundSink y Handle
+ Sound.Alsa: fileSoundSink :: SampleFmt y => FilePath -> SoundFmt y -> SoundSink y Handle
- Sound.Alsa: fileSoundSource :: (SampleFmt y) => FilePath -> SoundFmt y -> SoundSource y Handle
+ Sound.Alsa: fileSoundSource :: SampleFmt y => FilePath -> SoundFmt y -> SoundSource y Handle
- Sound.Alsa: sampleFmtToPcmFormat :: (SampleFmt y) => y -> PcmFormat
+ Sound.Alsa: sampleFmtToPcmFormat :: SampleFmt y => y -> PcmFormat
- Sound.Alsa: soundFmtMIME :: (SampleFmt y) => SoundFmt y -> String
+ Sound.Alsa: soundFmtMIME :: SampleFmt y => SoundFmt y -> String
- Sound.Alsa: soundSinkBytesPerFrame :: (SampleFmt y) => SoundSink y h -> Int
+ Sound.Alsa: soundSinkBytesPerFrame :: SampleFmt y => SoundSink y h -> Int
- Sound.Alsa: soundSourceBytesPerFrame :: (SampleFmt y) => SoundSource y h -> Int
+ Sound.Alsa: soundSourceBytesPerFrame :: SampleFmt y => SoundSource y h -> Int
- Sound.Alsa.Error: checkResult :: (Integral a) => String -> a -> IO a
+ Sound.Alsa.Error: checkResult :: Integral a => String -> a -> IO a
- Sound.Alsa.Error: checkResult_ :: (Integral a) => String -> a -> IO ()
+ Sound.Alsa.Error: checkResult_ :: Integral a => String -> a -> IO ()

Files

Sound/Alsa/Error.hs view
@@ -3,10 +3,11 @@   #-} module Sound.Alsa.Error where -import Control.Exception (catchDyn,throwDyn)-import Data.Typeable-import Foreign.C.Error-import Foreign.C.String+import Control.Exception.Extensible (Exception, throw, catch, )+import Data.Typeable (Typeable, )+import Foreign.C.Error (Errno(Errno), ePIPE, errnoToIOError, )+import Foreign.C.String (CString, peekCString, )+import Prelude hiding (catch, )  data AlsaException =   AlsaException { exception_location    :: String@@ -14,6 +15,16 @@                 , exception_code        :: Errno                 } deriving (Typeable) +instance Show AlsaException where+   showsPrec p (AlsaException l d (Errno c)) =+      showParen (p>10)+         (showString "AlsaException " .+          shows l . showString " " .+          shows d . showString " " .+          showParen True (showString "Errno " . shows c))++instance Exception AlsaException where+ checkResult :: Integral a => String -> a -> IO a checkResult f r   | r < 0 = throwAlsa f (Errno (negate (fromIntegral r)))@@ -24,21 +35,21 @@  throwAlsa :: String -> Errno -> IO a throwAlsa fun err = do d <- strerror err-                       throwDyn AlsaException+                       throw AlsaException                          { exception_location = fun                          , exception_description = d                          , exception_code = err                          }  catchAlsa :: IO a -> (AlsaException -> IO a) -> IO a-catchAlsa = catchDyn+catchAlsa = catch  catchAlsaErrno :: Errno                -> IO a -- ^ Action                -> IO a -- ^ Handler                -> IO a catchAlsaErrno e x h =-    catchAlsa x (\ex -> if exception_code ex == e then h else throwDyn ex)+    catchAlsa x (\ex -> if exception_code ex == e then h else throw ex)  catchXRun :: IO a -- ^ Action           -> IO a -- ^ Handler
Sound/Alsa/Sequencer/Errors.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ForeignFunctionInterface #-} -------------------------------------------------------------------------------- -- | -- Module    : Sound.Alsa.Sequencer.Errors@@ -12,16 +13,18 @@  module Sound.Alsa.Sequencer.Errors where -import Foreign.C.Types(CInt)-import Foreign.C.String(CString,peekCString)-import Control.Exception(throwDyn,catchDyn)-import Data.Word-import Data.Typeable+import Foreign.C.Types (CInt, )+import Foreign.C.String (CString, peekCString, )+import Control.Exception.Extensible (Exception, throw, catch, )+import Data.Word (Word, )+import Data.Typeable (Typeable(typeOf), mkTyCon, mkTyConApp, )+import Prelude hiding (catch, ) + data AlsaException = AlsaException   { exception_code :: !Word           -- ^ the (positive) error code   , exception_description :: !String  -- ^ a text description of the problem-  }+  } deriving Show  instance Eq AlsaException where   x == y = exception_code x == exception_code y@@ -32,6 +35,7 @@ instance Typeable AlsaException where   typeOf _ = mkTyConApp (mkTyCon "Sound.Alsa.Sequencer.AlsaException") [] +instance Exception AlsaException where   -- | Returns the message for an error code.@@ -43,7 +47,7 @@  -- | Catch an exception generated by the binding. alsa_catch :: IO a -> (AlsaException -> IO a) -> IO a-alsa_catch = catchDyn+alsa_catch = catch  check_error :: CInt -> IO Word check_error = check_error' fromIntegral (const Nothing)@@ -54,7 +58,7 @@   | otherwise = case err x of                   Just a -> return a                   _ -> do msg <- strerror x-                          throwDyn AlsaException+                          throw AlsaException                             { exception_code        = fromIntegral (negate x)                             , exception_description = msg                             }
Sound/Alsa/Sequencer/Event.hs view
@@ -99,7 +99,7 @@ event_output (SndSeq h) e =   alloca_ev e $ \p -> check_error =<< snd_seq_event_output h p -foreign import ccall "alsa/asoundlib.h snd_seq_event_output "+foreign import ccall "alsa/asoundlib.h snd_seq_event_output"   snd_seq_event_output :: Ptr SndSeq_ -> Ptr Event -> IO CInt  
alsa.cabal view
@@ -1,5 +1,5 @@ Name: alsa-Version: 0.3+Version: 0.4 Copyright: Bjorn Bringert, Iavor S. Diatchki, Henning Thielemann Maintainer: Henning Thielemann <alsa@henning-thielemann.de> Author: Bjorn Bringert <bjorn@bringert.net>, Iavor S. Diatchki <iavor.diatchki@gmail.com>@@ -9,8 +9,9 @@ Homepage: http://www.haskell.org/haskellwiki/ALSA Build-depends:   sample-frame >=0.0.1 && <0.1,-  array >= 0.1 && <0.3,-  base >= 3 && <4+  array >= 0.1 && <0.4,+  extensible-exceptions >=0.1.1 && <0.2,+  base >= 3 && <6 Stability: Experimental Extensions: ForeignFunctionInterface, GeneralizedNewtypeDeriving, EmptyDataDecls Build-Type: Simple