OpenAL 1.6.0.1 → 1.7.0.0
raw patch · 32 files changed
+225/−187 lines, 32 filesdep +ObjectNamedep +StateVardep +transformersdep ~OpenGLPVP ok
version bump matches the API change (PVP)
Dependencies added: ObjectName, StateVar, transformers
Dependency ranges changed: OpenGL
API changes (from Hackage documentation)
- Sound.OpenAL.AL.Source: pause :: [Source] -> IO ()
+ Sound.OpenAL.AL.Source: pause :: MonadIO m => [Source] -> m ()
- Sound.OpenAL.AL.Source: play :: [Source] -> IO ()
+ Sound.OpenAL.AL.Source: play :: MonadIO m => [Source] -> m ()
- Sound.OpenAL.AL.Source: queueBuffers :: Source -> [Buffer] -> IO ()
+ Sound.OpenAL.AL.Source: queueBuffers :: MonadIO m => Source -> [Buffer] -> m ()
- Sound.OpenAL.AL.Source: rewind :: [Source] -> IO ()
+ Sound.OpenAL.AL.Source: rewind :: MonadIO m => [Source] -> m ()
- Sound.OpenAL.AL.Source: stop :: [Source] -> IO ()
+ Sound.OpenAL.AL.Source: stop :: MonadIO m => [Source] -> m ()
- Sound.OpenAL.AL.Source: unqueueBuffers :: Source -> ALsizei -> IO [Buffer]
+ Sound.OpenAL.AL.Source: unqueueBuffers :: MonadIO m => Source -> ALsizei -> m [Buffer]
- Sound.OpenAL.ALC.Capture: captureCloseDevice :: Device -> IO Bool
+ Sound.OpenAL.ALC.Capture: captureCloseDevice :: MonadIO m => Device -> m Bool
- Sound.OpenAL.ALC.Capture: captureOpenDevice :: Maybe String -> Frequency -> Format -> NumSamples -> IO (Maybe Device)
+ Sound.OpenAL.ALC.Capture: captureOpenDevice :: MonadIO m => Maybe String -> Frequency -> Format -> NumSamples -> m (Maybe Device)
- Sound.OpenAL.ALC.Capture: captureSamples :: Device -> Ptr a -> NumSamples -> IO ()
+ Sound.OpenAL.ALC.Capture: captureSamples :: MonadIO m => Device -> Ptr a -> NumSamples -> m ()
- Sound.OpenAL.ALC.Capture: captureStart :: Device -> IO ()
+ Sound.OpenAL.ALC.Capture: captureStart :: MonadIO m => Device -> m ()
- Sound.OpenAL.ALC.Capture: captureStop :: Device -> IO ()
+ Sound.OpenAL.ALC.Capture: captureStop :: MonadIO m => Device -> m ()
- Sound.OpenAL.ALC.Context: createContext :: Device -> [ContextAttribute] -> IO (Maybe Context)
+ Sound.OpenAL.ALC.Context: createContext :: MonadIO m => Device -> [ContextAttribute] -> m (Maybe Context)
- Sound.OpenAL.ALC.Context: destroyContext :: Context -> IO ()
+ Sound.OpenAL.ALC.Context: destroyContext :: MonadIO m => Context -> m ()
- Sound.OpenAL.ALC.Context: processContext :: Context -> IO ()
+ Sound.OpenAL.ALC.Context: processContext :: MonadIO m => Context -> m ()
- Sound.OpenAL.ALC.Context: suspendContext :: Context -> IO ()
+ Sound.OpenAL.ALC.Context: suspendContext :: MonadIO m => Context -> m ()
- Sound.OpenAL.ALC.Device: closeDevice :: Device -> IO Bool
+ Sound.OpenAL.ALC.Device: closeDevice :: MonadIO m => Device -> m Bool
- Sound.OpenAL.ALC.Device: openDevice :: Maybe String -> IO (Maybe Device)
+ Sound.OpenAL.ALC.Device: openDevice :: MonadIO m => Maybe String -> m (Maybe Device)
Files
- LICENSE +1/−1
- OpenAL.cabal +9/−3
- src/Sound/OpenAL.hs +5/−5
- src/Sound/OpenAL/AL.hs +1/−1
- src/Sound/OpenAL/AL/ALboolean.hs +3/−3
- src/Sound/OpenAL/AL/Attenuation.hs +7/−4
- src/Sound/OpenAL/AL/BasicTypes.hs +1/−1
- src/Sound/OpenAL/AL/Buffer.hs +9/−6
- src/Sound/OpenAL/AL/BufferInternal.hs +13/−9
- src/Sound/OpenAL/AL/Doppler.hs +6/−3
- src/Sound/OpenAL/AL/Errors.hs +8/−7
- src/Sound/OpenAL/AL/Extensions.hs +5/−2
- src/Sound/OpenAL/AL/Format.hs +3/−4
- src/Sound/OpenAL/AL/Listener.hs +10/−7
- src/Sound/OpenAL/AL/PeekPoke.hs +1/−1
- src/Sound/OpenAL/AL/QueryUtils.hs +7/−11
- src/Sound/OpenAL/AL/Source.hs +27/−21
- src/Sound/OpenAL/AL/SourceState.hs +3/−3
- src/Sound/OpenAL/AL/String.hs +3/−2
- src/Sound/OpenAL/AL/StringQueries.hs +4/−3
- src/Sound/OpenAL/ALC.hs +1/−1
- src/Sound/OpenAL/ALC/ALCboolean.hs +3/−3
- src/Sound/OpenAL/ALC/BasicTypes.hs +1/−1
- src/Sound/OpenAL/ALC/Capture.hs +27/−26
- src/Sound/OpenAL/ALC/Context.hs +15/−12
- src/Sound/OpenAL/ALC/Device.hs +10/−10
- src/Sound/OpenAL/ALC/Errors.hs +10/−9
- src/Sound/OpenAL/ALC/Extensions.hs +11/−9
- src/Sound/OpenAL/ALC/QueryUtils.hs +11/−13
- src/Sound/OpenAL/ALC/String.hs +3/−2
- src/Sound/OpenAL/Config.hs +6/−3
- src/Sound/OpenAL/Constants.hs +1/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2003-2013, Sven Panne+Copyright (c) 2003-2015, Sven Panne All rights reserved. Redistribution and use in source and binary forms, with or without
OpenAL.cabal view
@@ -1,5 +1,5 @@ name: OpenAL-version: 1.6.0.1+version: 1.7.0.0 synopsis: A binding to the OpenAL cross-platform 3D audio API description: A Haskell binding for the OpenAL cross-platform 3D audio API,@@ -16,6 +16,7 @@ This package has also been tested on GNU/Linux and iOS. homepage: https://github.com/haskell-openal/ALUT bug-reports: https://github.com/haskell-openal/ALUT/issues+copyright: Copyright (C) 2003-2015 Sven Panne license: BSD3 license-file: LICENSE author: Sven Panne@@ -66,9 +67,14 @@ Sound.OpenAL.Config Sound.OpenAL.Constants hs-source-dirs: src- build-depends: base >= 3 && < 5, OpenGL >= 2.9.0.0+ build-depends:+ base >= 3 && < 5,+ transformers >= 0.2 && < 0.5,+ ObjectName >= 1.1 && < 1.2,+ StateVar >= 1.1 && < 1.2,+ OpenGL >= 2.12 && < 2.13 default-language: Haskell2010- ghc-options: -Wall -O2+ ghc-options: -Wall if os(windows) && flag(UseNativeWindowsLibraries) extra-libraries: OpenAL32 else
src/Sound/OpenAL.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -37,16 +37,16 @@ , module Sound.OpenAL.ALC -- * Convenience Re-exports- , module Graphics.Rendering.OpenGL.GL.ObjectName- , module Graphics.Rendering.OpenGL.GL.StateVar+ , module Data.ObjectName+ , module Data.StateVar , module Graphics.Rendering.OpenGL.GL.Tensor ) where import Sound.OpenAL.AL import Sound.OpenAL.ALC -import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.GL.StateVar+import Data.ObjectName+import Data.StateVar import Graphics.Rendering.OpenGL.GL.Tensor ( Vector3(..), Vertex3(..) ) --------------------------------------------------------------------------------
src/Sound/OpenAL/AL.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Sound/OpenAL/AL/ALboolean.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.ALboolean--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,8 +17,8 @@ marshalALboolean, unmarshalALboolean ) where -import Sound.OpenAL.AL.BasicTypes ( ALboolean )-import Sound.OpenAL.Constants ( al_FALSE, al_TRUE )+import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/Attenuation.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Attenuation--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -28,10 +28,13 @@ -- $NoCullingByDistance ) where +-- Make the foreign imports happy. import Foreign.C.Types-import Foreign.Marshal.Alloc-import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar++import Data.StateVar ( StateVar, makeStateVar )+import Foreign.Marshal.Alloc ( alloca )+import Foreign.Ptr ( Ptr )+ import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.PeekPoke import Sound.OpenAL.AL.QueryUtils
src/Sound/OpenAL/AL/BasicTypes.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.BasicTypes--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Sound/OpenAL/AL/Buffer.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Buffer--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -69,15 +69,18 @@ Buffer, MemoryRegion(..), Format(..), BufferData(..), bufferData ) where +-- Make the foreign imports happy. import Foreign.C.Types-import Foreign.Marshal.Alloc-import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar++import Data.StateVar ( StateVar, makeStateVar )+import Foreign.Marshal.Alloc ( alloca )+import Foreign.Ptr ( Ptr, nullPtr )+ import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.BufferInternal import Sound.OpenAL.AL.Format import Sound.OpenAL.AL.PeekPoke-import Sound.OpenAL.ALC.Context ( Frequency )+import qualified Sound.OpenAL.ALC.Context as ALC import Sound.OpenAL.Constants -- For Haddock only.@@ -89,7 +92,7 @@ data MemoryRegion a = MemoryRegion (Ptr a) ALsizei deriving ( Eq, Ord, Show ) -data BufferData a = BufferData (MemoryRegion a) Format Frequency+data BufferData a = BufferData (MemoryRegion a) Format ALC.Frequency deriving ( Eq, Ord, Show ) --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/BufferInternal.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.BufferInternal--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,15 +17,19 @@ Buffer(..), marshalBuffer, unmarshalBuffer ) where -import Graphics.Rendering.OpenGL.GL.ObjectName-import Foreign.Marshal.Array ( withArrayLen, peekArray, allocaArray )+-- Make the foreign imports happy. import Foreign.C.Types++import Control.Monad.IO.Class ( MonadIO(..) )+import Data.ObjectName ( ObjectName(..), GeneratableObjectName(..) )+import Foreign.Marshal.Array ( withArrayLen, peekArray, allocaArray ) import Foreign.Ptr ( Ptr, castPtr ) import Foreign.Storable ( Storable(..) )-import Sound.OpenAL.AL.ALboolean ( unmarshalALboolean )-import Sound.OpenAL.AL.BasicTypes ( ALboolean, ALuint, ALsizei )-import Sound.OpenAL.AL.PeekPoke ( peek1, poke1 ) +import Sound.OpenAL.AL.ALboolean+import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.AL.PeekPoke+ -------------------------------------------------------------------------------- -- | The abstract buffer type.@@ -57,12 +61,12 @@ instance ObjectName Buffer where deleteObjectNames buffers =- withArrayLen buffers $ alDeleteBuffers . fromIntegral+ liftIO $ withArrayLen buffers $ alDeleteBuffers . fromIntegral - isObjectName = fmap unmarshalALboolean . alIsBuffer+ isObjectName = liftIO . fmap unmarshalALboolean . alIsBuffer instance GeneratableObjectName Buffer where- genObjectNames n =+ genObjectNames n = liftIO $ allocaArray n $ \buf -> do alGenBuffers (fromIntegral n) buf peekArray n buf
src/Sound/OpenAL/AL/Doppler.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Doppler--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,9 +20,12 @@ dopplerFactor, speedOfSound ) where +-- Make the foreign imports happy. import Foreign.C.Types-import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar++import Data.StateVar ( get, StateVar, makeStateVar )+import Foreign.Ptr ( FunPtr )+ import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.Extensions import Sound.OpenAL.AL.QueryUtils
src/Sound/OpenAL/AL/Errors.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Errors--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,13 +17,14 @@ ALError(..), ALErrorCategory(..), alErrors ) where +-- Make the foreign imports happy. import Foreign.C.Types-import Graphics.Rendering.OpenGL.GL.StateVar-import Sound.OpenAL.AL.BasicTypes ( ALenum )-import Sound.OpenAL.Constants (- al_NO_ERROR, al_INVALID_NAME, al_INVALID_ENUM, al_INVALID_VALUE,- al_INVALID_OPERATION, al_OUT_OF_MEMORY )-import Sound.OpenAL.AL.QueryUtils ( StringName(..), getString )++import Data.StateVar ( GettableStateVar, makeGettableStateVar )++import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.Constants+import Sound.OpenAL.AL.QueryUtils --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/Extensions.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Extensions--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -22,9 +22,12 @@ unmarshalALboolean, unmarshalFormat, unmarshalBuffer ) where +-- Make the foreign imports happy. import Foreign.C.Types++import Data.StateVar ( GettableStateVar, makeGettableStateVar ) import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar+ import Sound.OpenAL.AL.ALboolean import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.BufferInternal
src/Sound/OpenAL/AL/Format.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Format--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,9 +17,8 @@ Format(..), marshalFormat, unmarshalFormat ) where -import Sound.OpenAL.AL.BasicTypes ( ALenum )-import Sound.OpenAL.Constants (- al_FORMAT_MONO8, al_FORMAT_MONO16, al_FORMAT_STEREO8, al_FORMAT_STEREO16 )+import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/Listener.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Listener--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -31,13 +31,16 @@ listenerPosition, listenerVelocity, Gain, listenerGain, orientation ) where -import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.GL.Tensor+-- Make the foreign imports happy. import Foreign.C.Types-import Foreign.Marshal.Array-import Foreign.Marshal.Utils-import Foreign.Ptr-import Foreign.Storable++import Data.StateVar ( StateVar, makeStateVar )+import Foreign.Marshal.Array ( allocaArray, withArray )+import Foreign.Marshal.Utils ( with )+import Foreign.Ptr ( Ptr )+import Foreign.Storable ( Storable )+import Graphics.Rendering.OpenGL.GL.Tensor ( Vector3(..), Vertex3 (..) )+ import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.PeekPoke import Sound.OpenAL.AL.QueryUtils
src/Sound/OpenAL/AL/PeekPoke.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.PeekPoke--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Sound/OpenAL/AL/QueryUtils.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.QueryUtils--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,18 +18,14 @@ StringName(..), getString ) where +-- Make the foreign imports happy. import Foreign.C.Types+ import Foreign.Ptr ( Ptr )-import Sound.OpenAL.AL.BasicTypes ( ALchar, ALenum )-import Sound.OpenAL.AL.String ( peekALString )-import Sound.OpenAL.Constants (- al_DISTANCE_MODEL, al_DOPPLER_FACTOR, al_SPEED_OF_SOUND, al_POSITION,- al_VELOCITY, al_GAIN, al_ORIENTATION, al_SOURCE_RELATIVE, al_SOURCE_TYPE,- al_LOOPING, al_BUFFER, al_BUFFERS_QUEUED, al_BUFFERS_PROCESSED, al_MIN_GAIN,- al_MAX_GAIN, al_REFERENCE_DISTANCE, al_ROLLOFF_FACTOR, al_MAX_DISTANCE,- al_PITCH, al_DIRECTION, al_CONE_INNER_ANGLE, al_CONE_OUTER_ANGLE,- al_CONE_OUTER_GAIN, al_SEC_OFFSET, al_SAMPLE_OFFSET, al_BYTE_OFFSET,- al_SOURCE_STATE, al_VENDOR, al_RENDERER, al_VERSION, al_EXTENSIONS )++import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.AL.String+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/Source.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.Source--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -76,15 +76,21 @@ SourceState(..), sourceState, play, pause, stop, rewind ) where -import Control.Monad+-- Make the foreign imports happy. import Foreign.C.Types-import Foreign.Marshal.Array-import Foreign.Marshal.Utils-import Foreign.Ptr-import Foreign.Storable-import Graphics.Rendering.OpenGL.GL.ObjectName-import Graphics.Rendering.OpenGL.GL.StateVar-import Graphics.Rendering.OpenGL.GL.Tensor++import Control.Monad ( liftM2 )+import Control.Monad.IO.Class ( MonadIO(..) )+import Data.ObjectName ( ObjectName(..), GeneratableObjectName(..) )+import Data.StateVar ( get, ($=)+ , GettableStateVar, makeGettableStateVar+ , StateVar, makeStateVar )+import Foreign.Marshal.Array ( allocaArray, peekArray, withArrayLen )+import Foreign.Marshal.Utils ( with )+import Foreign.Ptr ( Ptr, castPtr )+import Foreign.Storable ( Storable(..) )+import Graphics.Rendering.OpenGL.GL.Tensor ( Vector3(..), Vertex3(..) )+ import Sound.OpenAL.AL.ALboolean import Sound.OpenAL.AL.BasicTypes import Sound.OpenAL.AL.BufferInternal@@ -111,12 +117,12 @@ poke ptr (Source b) = poke1 (castPtr ptr) b instance ObjectName Source where- deleteObjectNames = withArraySizei alDeleteSources+ deleteObjectNames = liftIO . withArraySizei alDeleteSources - isObjectName = fmap unmarshalALboolean . alIsSource+ isObjectName = liftIO . fmap unmarshalALboolean . alIsSource instance GeneratableObjectName Source where- genObjectNames n =+ genObjectNames n = liftIO $ allocaArray n $ \buf -> do alGenSources (fromIntegral n) buf peekArray n buf@@ -652,11 +658,11 @@ -- queue will remain unchanged (even if some of the buffers could have been -- queued). -queueBuffers :: Source -> [Buffer] -> IO ()+queueBuffers :: MonadIO m => Source -> [Buffer] -> m () queueBuffers = withArraySizei . alSourceQueueBuffers -withArraySizei :: Storable a => (ALsizei -> Ptr a -> IO ()) -> [a] -> IO ()-withArraySizei f xs = withArrayLen xs $ f . fromIntegral+withArraySizei :: (MonadIO m, Storable a) => (ALsizei -> Ptr a -> IO ()) -> [a] -> m ()+withArraySizei f xs = liftIO $ withArrayLen xs $ f . fromIntegral foreign import ccall unsafe "alSourceQueueBuffers" alSourceQueueBuffers :: Source -> ALsizei -> Ptr Buffer -> IO ()@@ -677,8 +683,8 @@ -- The operation will fail with an 'ALInvalidValue' error if more buffers are -- requested than available, leaving the destination arguments unchanged. -unqueueBuffers :: Source -> ALsizei -> IO [Buffer]-unqueueBuffers src n = allocaArray (fromIntegral n) $ \p -> do+unqueueBuffers :: MonadIO m => Source -> ALsizei -> m [Buffer]+unqueueBuffers src n = liftIO $ allocaArray (fromIntegral n) $ \p -> do alSourceUnqueueBuffers src n p peekArray (fromIntegral n) p @@ -722,7 +728,7 @@ -- 'Stopped' source will propagate it to 'Initial' then to 'Playing' -- immediately. -play :: [Source] -> IO ()+play :: MonadIO m => [Source] -> m () play = withArraySizei alSourcePlayv foreign import ccall unsafe "alSourcePlayv"@@ -733,7 +739,7 @@ -- processing, its current state is preserved. 'pause' applied to a 'Paused' -- source is a legal NOP. 'pause' applied to a 'Stopped' source is a legal NOP. -pause :: [Source] -> IO ()+pause :: MonadIO m => [Source] -> m () pause = withArraySizei alSourcePausev foreign import ccall unsafe "alSourcePausev"@@ -745,7 +751,7 @@ -- source will change its state to 'Stopped', with the same consequences as on a -- 'Playing' source. 'stop' applied to a 'Stopped' source is a legal NOP. -stop :: [Source] -> IO ()+stop :: MonadIO m => [Source] -> m () stop = withArraySizei alSourceStopv foreign import ccall unsafe "alSourceStopv"@@ -760,7 +766,7 @@ -- source promotes the source to 'Initial', resetting the sampling offset to the -- beginning. -rewind :: [Source] -> IO ()+rewind :: MonadIO m => [Source] -> m () rewind = withArraySizei alSourceRewindv foreign import ccall unsafe "alSourceRewindv"
src/Sound/OpenAL/AL/SourceState.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.SourceState--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -15,8 +15,8 @@ SourceState(..), unmarshalSourceState ) where -import Sound.OpenAL.AL.BasicTypes ( ALint )-import Sound.OpenAL.Constants ( al_INITIAL, al_PLAYING, al_PAUSED, al_STOPPED )+import Sound.OpenAL.AL.BasicTypes+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/String.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.String--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,7 +17,8 @@ import Foreign.C.String ( withCString, peekCString ) import Foreign.Ptr ( Ptr, castPtr )-import Sound.OpenAL.AL.BasicTypes ( ALchar )++import Sound.OpenAL.AL.BasicTypes --------------------------------------------------------------------------------
src/Sound/OpenAL/AL/StringQueries.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.AL.StringQueries--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,8 +17,9 @@ alVendor, alRenderer ) where -import Graphics.Rendering.OpenGL.GL.StateVar-import Sound.OpenAL.AL.QueryUtils ( StringName(..), getString )+import Data.StateVar ( GettableStateVar, makeGettableStateVar )++import Sound.OpenAL.AL.QueryUtils --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Sound/OpenAL/ALC/ALCboolean.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.ALCboolean--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,8 +17,8 @@ marshalALCboolean, unmarshalALCboolean ) where -import Sound.OpenAL.ALC.BasicTypes ( ALCboolean )-import Sound.OpenAL.Constants ( alc_FALSE, alc_TRUE )+import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC/BasicTypes.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.BasicTypes--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>
src/Sound/OpenAL/ALC/Capture.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.Capture--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -20,23 +20,24 @@ allCaptureDeviceSpecifiers ) where -import Graphics.Rendering.OpenGL.GL.StateVar+-- Make the foreign imports happy. import Foreign.C.Types++import Control.Monad.IO.Class ( MonadIO(..) )+import Data.StateVar ( get, GettableStateVar, makeGettableStateVar ) import Foreign.Ptr ( Ptr, nullPtr, FunPtr )-import Sound.OpenAL.AL.Buffer ( Format )-import Sound.OpenAL.AL.Format ( marshalFormat )-import Sound.OpenAL.ALC.ALCboolean ( unmarshalALCboolean )-import Sound.OpenAL.ALC.BasicTypes (- ALCchar, ALCuint, ALCenum, ALCsizei, ALCboolean )-import Sound.OpenAL.ALC.Context ( Frequency )-import Sound.OpenAL.ALC.Device ( Device )-import Sound.OpenAL.ALC.Extensions ( alcProcAddress )-import Sound.OpenAL.ALC.QueryUtils ( IntQuery(..), getInteger )-import Sound.OpenAL.ALC.QueryUtils (- StringQuery(..), getString, getStringRaw, alcIsExtensionPresent )-import Sound.OpenAL.ALC.String ( withALCString, peekALCStrings )-import Sound.OpenAL.Config ( ALCdevice(..), marshalDevice, unmarshalDevice ) +import Sound.OpenAL.AL.Buffer+import Sound.OpenAL.AL.Format+import Sound.OpenAL.ALC.ALCboolean+import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.ALC.Context+import Sound.OpenAL.ALC.Device+import Sound.OpenAL.ALC.Extensions+import Sound.OpenAL.ALC.QueryUtils+import Sound.OpenAL.ALC.String+import Sound.OpenAL.Config+ -------------------------------------------------------------------------------- type NumSamples = ALCsizei@@ -50,9 +51,9 @@ -------------------------------------------------------------------------------- -captureOpenDevice ::- Maybe String -> Frequency -> Format -> NumSamples -> IO (Maybe Device)-captureOpenDevice maybeDeviceSpec frequency format size = do+captureOpenDevice :: MonadIO m =>+ Maybe String -> Frequency -> Format -> NumSamples -> m (Maybe Device)+captureOpenDevice maybeDeviceSpec frequency format size = liftIO $ do funPtr <- getCaptureFunc "alcCaptureOpenDevice" let open deviceSpec = invokeCaptureOpenDevice funPtr deviceSpec (round frequency)@@ -67,11 +68,11 @@ -------------------------------------------------------------------------------- -captureStart :: Device -> IO ()+captureStart :: MonadIO m => Device -> m () captureStart = captureStartStop "alcCaptureStart" -captureStartStop :: String -> Device -> IO ()-captureStartStop funName device = do+captureStartStop :: MonadIO m => String -> Device -> m ()+captureStartStop funName device = liftIO $ do funPtr <- getCaptureFunc funName invokeCaptureStartStop funPtr (marshalDevice device) @@ -86,8 +87,8 @@ -------------------------------------------------------------------------------- -captureSamples :: Device -> Ptr a -> NumSamples -> IO ()-captureSamples device buf n = do+captureSamples :: MonadIO m => Device -> Ptr a -> NumSamples -> m ()+captureSamples device buf n = liftIO $ do funPtr <- getCaptureFunc "alcCaptureSamples" invokeCaptureSamples funPtr (marshalDevice device) buf n @@ -96,13 +97,13 @@ -------------------------------------------------------------------------------- -captureStop :: Device -> IO ()+captureStop :: MonadIO m => Device -> m () captureStop = captureStartStop "alcCaptureStop" -------------------------------------------------------------------------------- -captureCloseDevice :: Device -> IO Bool-captureCloseDevice device = do+captureCloseDevice :: MonadIO m => Device -> m Bool+captureCloseDevice device = liftIO $ do funPtr <- getCaptureFunc "alcCaptureCloseDevice" fmap unmarshalALCboolean . invokeCaptureCloseDevice funPtr . marshalDevice $ device
src/Sound/OpenAL/ALC/Context.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.Context--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -27,9 +27,12 @@ processContext, suspendContext, destroyContext, contextsDevice, allAttributes ) where -import Foreign.Marshal.Array-import Foreign.Ptr-import Graphics.Rendering.OpenGL.GL.StateVar+import Control.Monad.IO.Class ( MonadIO(..) )+import Data.StateVar ( GettableStateVar, makeGettableStateVar+ , StateVar, makeStateVar )+import Foreign.Marshal.Array ( withArray0 )+import Foreign.Ptr ( Ptr )+ import Sound.OpenAL.ALC.ALCboolean import Sound.OpenAL.ALC.BasicTypes import Sound.OpenAL.ALC.Device@@ -93,8 +96,8 @@ -- 'Just' the new context. Note that 'createContext' does /not/ set the current -- context, this must be done separately via 'currentContext'. -createContext :: Device -> [ContextAttribute] -> IO (Maybe Context)-createContext device attributes = do+createContext :: MonadIO m => Device -> [ContextAttribute] -> m (Maybe Context)+createContext device attributes = liftIO $ do let pairToList (key, value) = [key, value] attrs = concatMap (pairToList . marshalContextAttribute) attributes fmap unmarshalContext .@@ -137,8 +140,8 @@ -- affect a context that is already marked as processing. The default state of a -- context created by 'createContext' is that it is processing. -processContext :: Context -> IO ()-processContext = fmap (const ()) . alcProcessContext . marshalContext+processContext :: MonadIO m => Context -> m ()+processContext = liftIO . fmap (const ()) . alcProcessContext . marshalContext -- | The application can suspend any context from processing (including the -- current one). To indicate that a context should be suspended from processing@@ -147,8 +150,8 @@ -- 'suspendContext' are legal, and do not affect a context that is already -- marked as suspended. -suspendContext :: Context -> IO ()-suspendContext = alcSuspendContext . marshalContext+suspendContext :: MonadIO m => Context -> m ()+suspendContext = liftIO . alcSuspendContext . marshalContext foreign import ccall unsafe "alcSuspendContext" alcSuspendContext :: ALCcontext -> IO ()@@ -160,8 +163,8 @@ -- 'Nothing'. Applications should not attempt to destroy a current context, -- doing so will not work and will result in an 'ALCInvalidOperation' error. -destroyContext :: Context -> IO ()-destroyContext = fmap (const ()) . alcDestroyContext . marshalContext+destroyContext :: MonadIO m => Context -> m ()+destroyContext = liftIO . fmap (const ()) . alcDestroyContext . marshalContext --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC/Device.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.Device--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -26,16 +26,16 @@ defaultDeviceSpecifier, deviceSpecifier, allDeviceSpecifiers ) where -import Graphics.Rendering.OpenGL.GL.StateVar+import Control.Monad.IO.Class ( MonadIO(..) )+import Data.StateVar ( get, GettableStateVar, makeGettableStateVar ) import Foreign.Ptr ( Ptr, nullPtr ) import Foreign.Marshal.Utils ( maybePeek )-import Sound.OpenAL.ALC.BasicTypes ( ALCchar )-import Sound.OpenAL.ALC.QueryUtils (- StringQuery(..), getString, getStringRaw, alcIsExtensionPresent )-import Sound.OpenAL.ALC.String ( withALCString, peekALCString, peekALCStrings )-import Sound.OpenAL.Config (- Device, ALCdevice(..), unmarshalDevice, closeDevice ) +import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.ALC.QueryUtils+import Sound.OpenAL.ALC.String+import Sound.OpenAL.Config+ -------------------------------------------------------------------------------- -- | 'openDevice' allows the application (i.e. the client program) to connect to@@ -183,9 +183,9 @@ -- and could be inaccurate. Any corrections and\/or additions are highly -- welcome. -openDevice :: Maybe String -> IO (Maybe Device)+openDevice :: MonadIO m => Maybe String -> m (Maybe Device) openDevice maybeDeviceSpec =- fmap unmarshalDevice $+ liftIO $ fmap unmarshalDevice $ maybe (alcOpenDevice nullPtr) -- use preferred device (flip withALCString alcOpenDevice) maybeDeviceSpec
src/Sound/OpenAL/ALC/Errors.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.Errors--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,15 +17,16 @@ ALCError(..), ALCErrorCategory(..), alcErrors ) where +-- Make the foreign imports happy. import Foreign.C.Types-import Graphics.Rendering.OpenGL.GL.StateVar-import Sound.OpenAL.ALC.BasicTypes ( ALCenum )-import Sound.OpenAL.ALC.Device ( Device )-import Sound.OpenAL.ALC.QueryUtils ( StringQuery(..), getString )-import Sound.OpenAL.Constants (- alc_NO_ERROR, alc_INVALID_DEVICE, alc_INVALID_CONTEXT, alc_INVALID_ENUM,- alc_INVALID_VALUE, alc_OUT_OF_MEMORY, alc_INVALID_OPERATION )-import Sound.OpenAL.Config ( ALCdevice(..), marshalDevice )++import Data.StateVar ( GettableStateVar, makeGettableStateVar )++import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.ALC.Device+import Sound.OpenAL.ALC.QueryUtils+import Sound.OpenAL.Constants+import Sound.OpenAL.Config --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC/Extensions.hs view
@@ -1,7 +1,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.Extensions--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,16 +18,18 @@ alcVersion ) where -import Control.Monad ( liftM2 )-import Graphics.Rendering.OpenGL.GL.StateVar+-- Make the foreign imports happy. import Foreign.C.Types++import Control.Monad ( liftM2 )+import Data.StateVar ( GettableStateVar, makeGettableStateVar ) import Foreign.Ptr ( Ptr, FunPtr )-import Sound.OpenAL.ALC.BasicTypes ( ALCchar, ALCenum, ALCint )-import Sound.OpenAL.ALC.Device ( Device )-import Sound.OpenAL.ALC.QueryUtils (- StringQuery(..), getString, IntQuery(..), getInteger, alcIsExtensionPresent )-import Sound.OpenAL.ALC.String ( withALCString )-import Sound.OpenAL.Config ( ALCdevice(..), nullDevice, marshalDevice )++import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.ALC.Device+import Sound.OpenAL.ALC.QueryUtils+import Sound.OpenAL.ALC.String+import Sound.OpenAL.Config --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC/QueryUtils.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.QueryUtils--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -17,21 +17,19 @@ alcIsExtensionPresent ) where -import Control.Monad ( when )-import Graphics.Rendering.OpenGL.GL.StateVar+-- Make the foreign imports happy. import Foreign.C.Types++import Control.Monad ( when )+import Data.StateVar ( GettableStateVar, makeGettableStateVar ) import Foreign.Marshal.Array ( withArray, peekArray ) import Foreign.Ptr ( Ptr )-import Sound.OpenAL.ALC.ALCboolean ( unmarshalALCboolean )-import Sound.OpenAL.ALC.BasicTypes (- ALCboolean, ALCchar, ALCint, ALCenum, ALCsizei )-import Sound.OpenAL.ALC.String ( withALCString, peekALCString )-import Sound.OpenAL.Config ( Device, ALCdevice(..), nullDevice, marshalDevice )-import Sound.OpenAL.Constants (- alc_DEFAULT_DEVICE_SPECIFIER, alc_DEVICE_SPECIFIER, alc_EXTENSIONS,- alc_CAPTURE_DEFAULT_DEVICE_SPECIFIER, alc_CAPTURE_DEVICE_SPECIFIER,- alc_ATTRIBUTES_SIZE, alc_ALL_ATTRIBUTES, alc_MAJOR_VERSION,- alc_MINOR_VERSION, alc_CAPTURE_SAMPLES )++import Sound.OpenAL.ALC.ALCboolean+import Sound.OpenAL.ALC.BasicTypes+import Sound.OpenAL.ALC.String+import Sound.OpenAL.Config+import Sound.OpenAL.Constants --------------------------------------------------------------------------------
src/Sound/OpenAL/ALC/String.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.ALC.String--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -18,7 +18,8 @@ import Foreign.C.String ( withCString, peekCString ) import Foreign.Marshal.Array ( lengthArray0 ) import Foreign.Ptr ( Ptr, castPtr, plusPtr )-import Sound.OpenAL.ALC.BasicTypes ( ALCchar )++import Sound.OpenAL.ALC.BasicTypes --------------------------------------------------------------------------------
src/Sound/OpenAL/Config.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.Config--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>@@ -31,7 +31,10 @@ alcProcessContext, alcMakeContextCurrent, alcDestroyContext ) where +-- Make the foreign imports happy. import Foreign.C.Types++import Control.Monad.IO.Class ( MonadIO(..) ) import Foreign.Ptr ( Ptr, nullPtr ) --------------------------------------------------------------------------------@@ -140,9 +143,9 @@ -- -- /Note:/ Older OpenAL implementations will always report a success! -closeDevice :: Device -> IO Bool+closeDevice :: MonadIO m => Device -> m Bool -- inlined unmarshalALCboolean here to break dependency cycle-closeDevice = fmap (/= 0) . alcCloseDevice . marshalDevice+closeDevice = liftIO . fmap (/= 0) . alcCloseDevice . marshalDevice foreign import ccall unsafe "alcCloseDevice" alcCloseDevice :: ALCdevice -> IO ALCboolean
src/Sound/OpenAL/Constants.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Sound.OpenAL.Constants--- Copyright : (c) Sven Panne 2003-2013+-- Copyright : (c) Sven Panne 2003-2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com>