sndfile-enumerators 0.9.0.1 → 0.10.0.0
raw patch · 5 files changed
+37/−8 lines, 5 filesdep ~vectordep ~word24PVP ok
version bump matches the API change (PVP)
Dependency ranges changed: vector, word24
API changes (from Hackage documentation)
+ Sound.Iteratee.Utils: interleave :: Storable a => [Vector a] -> Maybe (Vector a)
- Sound.Iteratee.File: getAudioInfo :: FilePath -> IO (Maybe AudioFormat)
+ Sound.Iteratee.File: getAudioInfo :: FilePath -> IO (Maybe (AudioFormat, Integer))
Files
- sndfile-enumerators.cabal +4/−3
- src/Sound/Iteratee.hs +3/−1
- src/Sound/Iteratee/Codecs/Wave.hs +1/−1
- src/Sound/Iteratee/File.hs +4/−3
- src/Sound/Iteratee/Utils.hs +25/−0
sndfile-enumerators.cabal view
@@ -1,5 +1,5 @@ Name: sndfile-enumerators-Version: 0.9.0.1+Version: 0.10.0.0 Cabal-Version: >= 1.2 Description: encode and decode soundfiles using Iteratees. Audio files may be read or written, with classes and @@ -42,8 +42,8 @@ listlike-instances >= 0.1, MonadCatchIO-transformers >= 0.2 && < 0.3, transformers >= 0.2 && < 0.3,- vector >= 0.6 && < 0.8,- word24 >= 0.1 && < 2.0+ vector >= 0.6 && < 0.10,+ word24 >= 1 && < 2.0 exposed-modules: Sound.Iteratee Sound.Iteratee.Base@@ -51,6 +51,7 @@ Sound.Iteratee.Codecs.Wave Sound.Iteratee.Codecs.Raw Sound.Iteratee.File+ Sound.Iteratee.Utils Sound.Iteratee.Writer other-modules: Sound.Iteratee.Codecs.WaveWriter
src/Sound/Iteratee.hs view
@@ -2,7 +2,8 @@ module Sound.Iteratee.Base, module Sound.Iteratee.Writer, module Sound.Iteratee.Codecs,- module Sound.Iteratee.File+ module Sound.Iteratee.File,+ module Sound.Iteratee.Utils ) where@@ -11,4 +12,5 @@ import Sound.Iteratee.Codecs import Sound.Iteratee.File import Sound.Iteratee.Writer+import Sound.Iteratee.Utils
src/Sound/Iteratee/Codecs/Wave.hs view
@@ -255,7 +255,7 @@ Just (WAVEDE _ WAVEFMT (WENBYTE enum) : _xs) -> enum sWaveFormat _ -> return Nothing --- |Read the last fromat chunk from the WAVE dictionary. This is useful+-- |Read the last format chunk from the WAVE dictionary. This is useful -- when parsing all chunks in the dictionary. dictReadLastFormat :: (MonadCatchIO m, Functor m) =>
src/Sound/Iteratee/File.hs view
@@ -38,11 +38,12 @@ where ext = map toLower . tail $ takeExtension fp -- drop the initial "." --- | get audio format information from a file-getAudioInfo :: FilePath -> IO (Maybe AudioFormat)+-- | get audio format information and audio length (samples, not frames)+-- from a file+getAudioInfo :: FilePath -> IO (Maybe (AudioFormat, Integer)) getAudioInfo fp = case getFormat fp of Just Wave -> fileDriverAudio (waveReader >>=- maybe (return Nothing) dictReadFirstFormat) fp+ maybe (return Nothing) dictSoundInfo) fp Just Raw -> return Nothing _ -> return Nothing -- could try everything and see what matches... {-# INLINE getAudioInfo #-}
+ src/Sound/Iteratee/Utils.hs view
@@ -0,0 +1,25 @@+module Sound.Iteratee.Utils (+ interleave+)++where++import qualified Data.Vector.Storable as V+import Foreign.Storable++-- | interleave multiple vectors. The inputs must all have the same length,+-- else Nothing.+-- +-- if there are no input vectors, output @Just V.empty@+interleave :: Storable a => [V.Vector a] -> Maybe (V.Vector a)+interleave [] = Just $ V.empty+interleave vecs = if all (== l) ls+ then Just $ V.generate (nVecs * l) gFunc+ else Nothing+ where+ (l:ls) = map V.length vecs+ nVecs = length vecs+ gFunc ix = let (frame,vec) = divMod ix nVecs+ in (vecs !! vec) V.! frame+{-# INLINEABLE interleave #-}+ -- this is probably not the most efficient, but it'll work for now