hsndfile 0.7.0 → 0.7.1
raw patch · 4 files changed
+28/−21 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Sound.File.Sndfile: HeaderFormatMpc2k :: HeaderFormat
+ Sound.File.Sndfile: HeaderFormatOgg :: HeaderFormat
+ Sound.File.Sndfile: HeaderFormatRf64 :: HeaderFormat
+ Sound.File.Sndfile: HeaderFormatWve :: HeaderFormat
+ Sound.File.Sndfile: SampleFormatVorbis :: SampleFormat
Files
- Sound/File/Sndfile/Buffer/Internal.hs +9/−9
- Sound/File/Sndfile/Buffer/Sample.hs +8/−8
- Sound/File/Sndfile/Interface.chs +10/−3
- hsndfile.cabal +1/−1
Sound/File/Sndfile/Buffer/Internal.hs view
@@ -3,17 +3,17 @@ ( IOFunc , hBufIO- , sf_readf_word16- , sf_writef_word16- , sf_readf_word32- , sf_writef_word32+ , sf_readf_int16+ , sf_writef_int16+ , sf_readf_int32+ , sf_writef_int32 , sf_readf_float , sf_writef_float , sf_readf_double , sf_writef_double ) where -import Data.Word (Word16, Word32)+import Data.Int (Int16, Int32) import Foreign.Ptr (Ptr) import Foreign.C.Types (CLLong(..)) import Sound.File.Sndfile.Interface (Count, Handle(..), HandlePtr)@@ -23,11 +23,11 @@ hBufIO :: IOFunc a -> Handle -> Ptr a -> Count -> IO Count hBufIO f h ptr = fmap fromIntegral . f (hPtr h) ptr . fromIntegral -foreign import ccall unsafe "sf_readf_short" sf_readf_word16 :: IOFunc Word16-foreign import ccall unsafe "sf_writef_short" sf_writef_word16 :: IOFunc Word16+foreign import ccall unsafe "sf_readf_short" sf_readf_int16 :: IOFunc Int16+foreign import ccall unsafe "sf_writef_short" sf_writef_int16 :: IOFunc Int16 -foreign import ccall unsafe "sf_readf_int" sf_readf_word32 :: IOFunc Word32-foreign import ccall unsafe "sf_writef_int" sf_writef_word32 :: IOFunc Word32+foreign import ccall unsafe "sf_readf_int" sf_readf_int32 :: IOFunc Int32+foreign import ccall unsafe "sf_writef_int" sf_writef_int32 :: IOFunc Int32 foreign import ccall unsafe "sf_readf_float" sf_readf_float :: IOFunc Float foreign import ccall unsafe "sf_writef_float" sf_writef_float :: IOFunc Float
Sound/File/Sndfile/Buffer/Sample.hs view
@@ -2,7 +2,7 @@ Sample(..) ) where -import Data.Word (Word16, Word32)+import Data.Int (Int16, Int32) import Foreign.Ptr (Ptr) import Foreign.Storable (Storable) import Prelude hiding (interact)@@ -11,7 +11,7 @@ -- |The class Sample is used for polymorphic I\/O on a 'Handle', and is parameterized with the element type that is to be read from a file. ----- It is important to note that the data type used by the calling program and the data format of the file do not need to be the same. For instance, it is possible to open a 16 bit PCM encoded WAV file and read the data in floating point format. The library seamlessly converts between the two formats on-the-fly; the Haskell interface currently supports reading and writing 'Double' or 'Float' floating point values, as well as 'Word16' and 'Word32' integer values.+-- It is important to note that the data type used by the calling program and the data format of the file do not need to be the same. For instance, it is possible to open a 16 bit PCM encoded WAV file and read the data in floating point format. The library seamlessly converts between the two formats on-the-fly; the Haskell interface currently supports reading and writing 'Double' or 'Float' floating point values, as well as 'Int16' and 'Int32' integer values. -- -- When converting between integer data and floating point data, the following rules apply: The default behaviour when reading floating point data from a file with integer data is normalisation. Regardless of whether data in the file is 8, 16, 24 or 32 bit wide, the data will be read as floating point data in the range [-1.0, 1.0]. Similarly, data in the range [-1.0, 1.0] will be written to an integer PCM file so that a data value of 1.0 will be the largest allowable integer for the given bit width. This normalisation can be turned on or off using the command interface (/implementation missing in Haskell/). --@@ -23,13 +23,13 @@ -- | Write a buffer of frames. hPutBuf :: Handle -> Ptr e -> Count -> IO Count -instance Sample Word16 where- hGetBuf = hBufIO sf_readf_word16- hPutBuf = hBufIO sf_writef_word16+instance Sample Int16 where+ hGetBuf = hBufIO sf_readf_int16+ hPutBuf = hBufIO sf_writef_int16 -instance Sample Word32 where- hGetBuf = hBufIO sf_readf_word32- hPutBuf = hBufIO sf_writef_word32+instance Sample Int32 where+ hGetBuf = hBufIO sf_readf_int32+ hPutBuf = hBufIO sf_writef_int32 instance Sample Float where hGetBuf = hBufIO sf_readf_float
Sound/File/Sndfile/Interface.chs view
@@ -3,9 +3,10 @@ import qualified Control.Exception as E import Control.Monad (liftM, when)-import Foreign+import Foreign hiding (unsafePerformIO) import Foreign.C import qualified Sound.File.Sndfile.Exception as E+import System.IO.Unsafe (unsafePerformIO) #include <stdint.h> #include <sndfile.h>@@ -62,7 +63,11 @@ HEADER_FORMAT_WAVEX = SF_FORMAT_WAVEX, HEADER_FORMAT_SD2 = SF_FORMAT_SD2, HEADER_FORMAT_FLAC = SF_FORMAT_FLAC,- HEADER_FORMAT_CAF = SF_FORMAT_CAF+ HEADER_FORMAT_CAF = SF_FORMAT_CAF,+ HEADER_FORMAT_WVE = SF_FORMAT_WVE,+ HEADER_FORMAT_OGG = SF_FORMAT_OGG,+ HEADER_FORMAT_MPC2K = SF_FORMAT_MPC2K,+ HEADER_FORMAT_RF64 = SF_FORMAT_RF64 }; #endc @@ -101,7 +106,9 @@ SAMPLE_FORMAT_DWVW_N = SF_FORMAT_DWVW_N, SAMPLE_FORMAT_FORMAT_DPCM_8 = SF_FORMAT_DPCM_8,- SAMPLE_FORMAT_FORMAT_DPCM_16 = SF_FORMAT_DPCM_16+ SAMPLE_FORMAT_FORMAT_DPCM_16 = SF_FORMAT_DPCM_16,++ SAMPLE_FORMAT_VORBIS = SF_FORMAT_VORBIS }; #endc
hsndfile.cabal view
@@ -1,5 +1,5 @@ Name: hsndfile-Version: 0.7.0+Version: 0.7.1 Category: Data, Sound License: LGPL-2.1 License-File: COPYING