packages feed

ALUT 2.3.0.2 → 2.4.0.0

raw patch · 18 files changed

+77/−64 lines, 18 filesdep +StateVardep +transformersdep −OpenGLdep ~OpenALPVP ok

version bump matches the API change (PVP)

Dependencies added: StateVar, transformers

Dependencies removed: OpenGL

Dependency ranges changed: OpenAL

API changes (from Hackage documentation)

- Sound.ALUT.Initialization: runALUT :: ArgumentConsumer (Runner a)
+ Sound.ALUT.Initialization: runALUT :: MonadIO m => ArgumentConsumer (Runner m a)
- Sound.ALUT.Initialization: runALUTUsingCurrentContext :: ArgumentConsumer (Runner a)
+ Sound.ALUT.Initialization: runALUTUsingCurrentContext :: MonadIO m => ArgumentConsumer (Runner m a)
- Sound.ALUT.Initialization: type Runner a = ArgumentConsumer (IO a) -> IO a
+ Sound.ALUT.Initialization: type Runner m a = ArgumentConsumer (m a) -> m a
- Sound.ALUT.Initialization: withProgNameAndArgs :: (ArgumentConsumer (Runner a)) -> Runner a
+ Sound.ALUT.Initialization: withProgNameAndArgs :: MonadIO m => (ArgumentConsumer (Runner m a)) -> Runner m a
- Sound.ALUT.Loaders: createBuffer :: SoundDataSource a -> IO Buffer
+ Sound.ALUT.Loaders: createBuffer :: MonadIO m => SoundDataSource a -> m Buffer
- Sound.ALUT.Loaders: createBufferData :: SoundDataSource a -> IO (BufferData b)
+ Sound.ALUT.Loaders: createBufferData :: MonadIO m => SoundDataSource a -> m (BufferData b)
- Sound.ALUT.Sleep: sleep :: Duration -> IO ()
+ Sound.ALUT.Sleep: sleep :: MonadIO m => Duration -> m ()

Files

ALUT.cabal view
@@ -1,5 +1,5 @@ name: ALUT-version: 2.3.0.2+version: 2.4.0.0 synopsis: A binding for the OpenAL Utility Toolkit description:   A Haskell binding for the OpenAL Utility Toolkit, which makes@@ -9,6 +9,7 @@   <http://distro.ibiblio.org/rootlinux/rootlinux-ports/more/freealut/freealut-1.1.0/doc/alut.html>. homepage: https://github.com/haskell-openal/ALUT bug-reports: https://github.com/haskell-openal/ALUT/issues+copyright: Copyright (C) 2005-2015 Sven Panne license: BSD3 license-file: LICENSE author: Sven Panne@@ -47,8 +48,12 @@     Sound.ALUT.Constants     Sound.ALUT.Errors   hs-source-dirs: src-  ghc-options: -Wall -O2-  build-depends: base >= 3 && < 5, OpenGL >= 2.9.0.0, OpenAL >= 1.6.0.0+  ghc-options: -Wall+  build-depends:+    base         >= 3   && < 5,+    transformers >= 0.2 && < 0.5,+    StateVar     >= 1.1 && < 1.2,+    OpenAL       >= 1.7 && < 1.8   default-language: Haskell2010   other-extensions: CPP   if os(windows) && flag(UseNativeWindowsLibraries)
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2005-2013, Sven Panne+Copyright (c) 2005-2015, Sven Panne All rights reserved.  Redistribution and use in source and binary forms, with or without
examples/Basic/HelloWorld.hs view
@@ -1,6 +1,6 @@ {-    HelloWorld.hs (adapted from hello_world.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/Basic/OpenALInfo.hs view
@@ -1,6 +1,6 @@ {-    OpenALInfo.hs (modeled after OpenGL's glxinfo)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/Basic/PlayFile.hs view
@@ -1,6 +1,6 @@ {-    PlayFile.hs (adapted from playfile.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/TestSuite/TestErrorStuff.hs view
@@ -1,6 +1,6 @@ {-    TestErrorStuff.hs (adapted from test_errorstuff.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/TestSuite/TestFileLoader.hs view
@@ -1,6 +1,6 @@ {-    TestFileLoader.hs (adapted from test_fileloader.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/TestSuite/TestMemoryLoader.hs view
@@ -1,6 +1,6 @@ {-    TestMemoryLoader.hs (adapted from test_memoryloader.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/TestSuite/TestVersion.hs view
@@ -1,6 +1,6 @@ {-    TestVersion.hs (adapted from test_version.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
examples/TestSuite/TestWaveforms.hs view
@@ -1,6 +1,6 @@ {-    TestWaveforms.hs (adapted from test_waveforms.c in freealut)-   Copyright (c) Sven Panne 2005-2013+   Copyright (c) Sven Panne 2005-2015    This file is part of the ALUT package & distributed under a BSD-style license.    See the file LICENSE. -}
src/Sound/ALUT.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -11,7 +11,8 @@ -- A Haskell binding for the OpenAL Utility Toolkit, which makes managing of -- OpenAL contexts, loading sounds in various formats and creating waveforms -- very easy. For more information about the C library on which this binding is--- based, please see: <http://www.openal.org/openal_webstf/specs/alut.html>.+-- based, please see:+-- <http://distro.ibiblio.org/rootlinux/rootlinux-ports/more/freealut/freealut-1.1.0/doc/alut.html>. -- -------------------------------------------------------------------------------- 
src/Sound/ALUT/Config.hs view
@@ -3,7 +3,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Config--- Copyright   :  (c) Sven Panne 2006-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -43,9 +43,12 @@  -------------------------------------------------------------------------------- -import Foreign.C-import Foreign.Ptr-import Sound.OpenAL.AL.BasicTypes+-- Make the foreign imports happy.+import Foreign.C.Types++import Foreign.C.String ( CString, peekCString )+import Foreign.Ptr ( Ptr )+import Sound.OpenAL.AL.BasicTypes ( ALboolean, ALenum, ALfloat, ALint, ALsizei, ALuint )  -------------------------------------------------------------------------------- 
src/Sound/ALUT/Constants.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Constants--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
src/Sound/ALUT/Errors.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Errors--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -21,6 +21,7 @@ import Sound.OpenAL.AL.BasicTypes ( ALboolean, ALuint ) import Sound.OpenAL.AL.Buffer ( Buffer ) import Sound.OpenAL.AL.Extensions ( unmarshalALboolean, unmarshalBuffer )+ import Sound.ALUT.Config ( alut_GetError, alut_GetErrorString )  --------------------------------------------------------------------------------
src/Sound/ALUT/Initialization.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Initialization--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -15,7 +15,7 @@    withProgNameAndArgs )  where -import Control.Exception ( finally )+import Control.Monad.IO.Class ( MonadIO(..) ) import Data.List ( genericLength ) import Foreign.C.String ( CString, withCString, peekCString ) import Foreign.C.Types ( CInt )@@ -23,47 +23,53 @@ import Foreign.Marshal.Utils ( with, withMany ) import Foreign.Ptr ( Ptr, nullPtr ) import Foreign.Storable ( Storable(peek) )-import Sound.ALUT.Config ( alut_Init, alut_InitWithoutContext, alut_Exit )-import Sound.ALUT.Errors ( throwIfALfalse ) import Sound.OpenAL.AL.BasicTypes ( ALboolean ) import System.Environment ( getProgName, getArgs ) +import Sound.ALUT.Config+import Sound.ALUT.Errors+ --------------------------------------------------------------------------------  type ArgumentConsumer a = String -> [String] -> a -type Runner a = ArgumentConsumer (IO a) -> IO a+type Runner m a = ArgumentConsumer (m a) -> m a  -------------------------------------------------------------------------------- -runALUT :: ArgumentConsumer (Runner a)+runALUT :: MonadIO m => ArgumentConsumer (Runner m a) runALUT = runner "runALUT" alut_Init  -------------------------------------------------------------------------------- -runALUTUsingCurrentContext :: ArgumentConsumer (Runner a)+runALUTUsingCurrentContext :: MonadIO m => ArgumentConsumer (Runner m a) runALUTUsingCurrentContext =    runner "runALUTUsingCurrentContext" alut_InitWithoutContext  -------------------------------------------------------------------------------- -runner :: String -> (Ptr CInt -> Ptr CString -> IO ALboolean) -> String-       -> [String] -> Runner a-runner name initAction progName args action =+runner :: MonadIO m => String -> (Ptr CInt -> Ptr CString -> IO ALboolean) -> String+       -> [String] -> Runner m a+runner name initAction progName args action = do+   argv <- liftIO $ foo name initAction progName args+   result <- action (head argv) (tail argv)+   liftIO $ throwIfALfalse name alut_Exit+   return result++foo :: String -> (Ptr CInt -> Ptr CString -> IO ALboolean) -> String -> [String] -> IO [String]+foo name initAction progName args =    with (1 + genericLength args) $ \argcBuf ->       withMany withCString (progName : args) $ \argvPtrs ->          withArray0 nullPtr argvPtrs $ \argvBuf -> do             throwIfALfalse name $ initAction argcBuf argvBuf             newArgc <- peek argcBuf             newArgvPtrs <- peekArray (fromIntegral newArgc) argvBuf-            newArgv <- mapM peekCString newArgvPtrs-            action (head newArgv) (tail newArgv)-               `finally` throwIfALfalse name alut_Exit+            mapM peekCString newArgvPtrs  -------------------------------------------------------------------------------- -withProgNameAndArgs :: (ArgumentConsumer (Runner a)) -> Runner a+withProgNameAndArgs :: MonadIO m => (ArgumentConsumer (Runner m a)) -> Runner m a withProgNameAndArgs alutRunner action = do-   n <- getProgName-   a <- getArgs+   n <- liftIO getProgName+   a <- liftIO getArgs    alutRunner n a action
src/Sound/ALUT/Loaders.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Loaders--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -16,27 +16,21 @@    bufferMIMETypes, bufferDataMIMETypes )  where +import Control.Monad.IO.Class ( MonadIO(..) )+import Data.StateVar ( GettableStateVar, makeGettableStateVar ) import Foreign.C.String ( peekCString, withCString ) import Foreign.Marshal.Alloc ( alloca )-import Foreign.Storable ( Storable(peek) ) import Foreign.Ptr ( Ptr )-import Graphics.Rendering.OpenGL ( GettableStateVar, makeGettableStateVar )-import Sound.ALUT.Config (-   alut_CreateBufferFromFile, alut_CreateBufferFromFileImage,-   alut_CreateBufferHelloWorld, alut_CreateBufferWaveform,-   alut_LoadMemoryFromFile, alut_LoadMemoryFromFileImage,-   alut_LoadMemoryHelloWorld, alut_LoadMemoryWaveform,-   alut_GetMIMETypes )-import Sound.ALUT.Constants (-   alut_WAVEFORM_SINE, alut_WAVEFORM_SQUARE, alut_WAVEFORM_SAWTOOTH,-   alut_WAVEFORM_IMPULSE, alut_WAVEFORM_WHITENOISE,-   alut_LOADER_BUFFER, alut_LOADER_MEMORY )-import Sound.ALUT.Errors ( makeBuffer, throwIfNullPtr )+import Foreign.Storable ( peek ) import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.Buffer ( Buffer, MemoryRegion(..), BufferData(..) ) import Sound.OpenAL.AL.Extensions ( unmarshalFormat ) import Sound.OpenAL.ALC.Context ( Frequency ) +import Sound.ALUT.Config+import Sound.ALUT.Constants+import Sound.ALUT.Errors+ --------------------------------------------------------------------------------  type Phase = Float@@ -56,8 +50,8 @@  -------------------------------------------------------------------------------- -createBuffer :: SoundDataSource a -> IO Buffer-createBuffer src = makeBuffer "createBuffer" $ case src of+createBuffer :: MonadIO m => SoundDataSource a -> m Buffer+createBuffer src = liftIO $ makeBuffer "createBuffer" $ case src of    File filePath -> withCString filePath alut_CreateBufferFromFile    FileImage (MemoryRegion buf size) -> alut_CreateBufferFromFileImage buf size    HelloWorld -> alut_CreateBufferHelloWorld@@ -73,8 +67,8 @@  -------------------------------------------------------------------------------- -createBufferData :: SoundDataSource a -> IO (BufferData b)-createBufferData src = case src of+createBufferData :: MonadIO m => SoundDataSource a -> m (BufferData b)+createBufferData src = liftIO $ case src of    File filePath -> withCString filePath $ \fp -> loadWith (alut_LoadMemoryFromFile fp)    FileImage (MemoryRegion buf size) -> loadWith (alut_LoadMemoryFromFileImage buf size)    HelloWorld -> loadWith alut_LoadMemoryHelloWorld
src/Sound/ALUT/Sleep.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Sleep--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -14,11 +14,13 @@    sleep )  where -import Sound.ALUT.Config ( alut_Sleep )-import Sound.ALUT.Errors ( throwIfALfalse )-import Sound.ALUT.Loaders ( Duration )+import Control.Monad.IO.Class ( MonadIO(..) ) +import Sound.ALUT.Config+import Sound.ALUT.Errors+import Sound.ALUT.Loaders+ -------------------------------------------------------------------------------- -sleep :: Duration -> IO ()-sleep = throwIfALfalse "sleep" . alut_Sleep . realToFrac+sleep :: MonadIO m => Duration -> m ()+sleep = liftIO . throwIfALfalse "sleep" . alut_Sleep . realToFrac
src/Sound/ALUT/Version.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module      :  Sound.ALUT.Version--- Copyright   :  (c) Sven Panne 2005-2013+-- Copyright   :  (c) Sven Panne 2005-2015 -- License     :  BSD3 -- -- Maintainer  :  Sven Panne <svenpanne@gmail.com>@@ -15,10 +15,11 @@ )  where  import Control.Monad ( liftM2 )-import Graphics.Rendering.OpenGL ( GettableStateVar, makeGettableStateVar )+import Data.StateVar ( GettableStateVar, makeGettableStateVar ) import Sound.OpenAL.AL.BasicTypes ( ALint )-import Sound.ALUT.Config ( alut_GetMajorVersion, alut_GetMinorVersion )-import Sound.ALUT.Constants ( alut_API_MAJOR_VERSION, alut_API_MINOR_VERSION )++import Sound.ALUT.Config+import Sound.ALUT.Constants  --------------------------------------------------------------------------------