packages feed

wave 0.1.5 → 0.2.0

raw patch · 6 files changed

+64/−45 lines, 6 filesdep −data-default-classdep ~bytestringdep ~transformers

Dependencies removed: data-default-class

Dependency ranges changed: bytestring, transformers

Files

CHANGELOG.md view
@@ -1,3 +1,12 @@+## Wave 0.2.0++* Got rid of `data-default-class` dependency. `Wave` now is not an instance+  of `Default`.++## Wave 0.1.6++* Dropped support for GHC 7.8.+ ## Wave 0.1.5  * Improved documentation and metadata.
Codec/Audio/Wave.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Codec.Audio.Wave--- Copyright   :  © 2016–2017 Mark Karpov+-- Copyright   :  © 2016–2019 Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>@@ -36,7 +36,6 @@ -- @fmt@ and @data@ chunks, although it's rarely useful (and may actually -- confuse buggy applications that don't know how to skip unknown chunks). -{-# LANGUAGE CPP                #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings  #-} {-# LANGUAGE RankNTypes         #-}@@ -77,7 +76,6 @@ import Data.Bits import Data.ByteString (ByteString) import Data.Data (Data)-import Data.Default.Class import Data.Maybe (mapMaybe, isNothing) import Data.Monoid ((<>)) import Data.Set (Set)@@ -88,10 +86,6 @@ import qualified Data.Serialize  as S import qualified Data.Set        as E -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative-#endif- ---------------------------------------------------------------------------- -- Types @@ -131,17 +125,20 @@     -- will be padded by null bytes). Default value: @[]@.   } deriving (Show, Read, Eq, Ord, Typeable, Data) -instance Default Wave where-  def = Wave-    { waveFileFormat   = WaveVanilla-    , waveSampleRate   = 44100-    , waveSampleFormat = SampleFormatPcmInt 16-    , waveChannelMask  = defaultSpeakerSet 2-    , waveDataOffset   = 0-    , waveDataSize     = 0-    , waveSamplesTotal = 0-    , waveOtherChunks  = [] }+-- | Default value of 'Wave'. +defaultWave :: Wave+defaultWave = Wave+  { waveFileFormat   = WaveVanilla+  , waveSampleRate   = 44100+  , waveSampleFormat = SampleFormatPcmInt 16+  , waveChannelMask  = defaultSpeakerSet 2+  , waveDataOffset   = 0+  , waveDataSize     = 0+  , waveSamplesTotal = 0+  , waveOtherChunks  = []+  }+ -- | 'WaveFormat' as flavor of WAVE file.  data WaveFormat@@ -220,12 +217,15 @@   , ds64SamplesTotal :: !Word64 -- ^ Total number of samples (64 bits)   } -instance Default Ds64 where-  def = Ds64-    { ds64RiffSize     = 0-    , ds64DataSize     = 0-    , ds64SamplesTotal = 0 }+-- | Default value of 'Ds64'. +defaultDs64 :: Ds64+defaultDs64 = Ds64+  { ds64RiffSize     = 0+  , ds64DataSize     = 0+  , ds64SamplesTotal = 0+  }+ -- | A helper type synonym for give up function signatures.  type GiveUp = forall a. (FilePath -> WaveException) -> IO a@@ -411,7 +411,8 @@ readWaveVanilla h giveup liftGet = do   grabWaveTag h giveup   grabWaveChunks h giveup liftGet Nothing Nothing-    def { waveFileFormat = WaveVanilla } -- just to be explicit+    defaultWave { waveFileFormat = WaveVanilla+                }  -- | Parse an RF64 file. @@ -429,8 +430,9 @@     Nothing -> giveup (NonDataChunkIsTooLong "ds64")     Just body -> liftGet (return $ readDs64 body)   grabWaveChunks h giveup liftGet (Just ds64DataSize) (Just ds64SamplesTotal)-    def { waveFileFormat   = WaveRF64-        , waveSamplesTotal = 0xffffffff }+    defaultWave { waveFileFormat = WaveRF64+                , waveSamplesTotal = 0xffffffff+                }  -- | Read four bytes from given 'Handle' and throw an exception if they are -- not “WAVE”.@@ -655,7 +657,7 @@   B.hPut h "WAVE"   -- Write ds64 chunk.   beforeDs64 <- hTell h-  writeBsChunk h "ds64" (renderDs64Chunk def)+  writeBsChunk h "ds64" (renderDs64Chunk defaultDs64)   -- Write fmt chunk.   writeBsChunk h "fmt " (renderFmtChunk wave)   -- Write any extra chunks if present.
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2016–2017 Mark Karpov+Copyright © 2016–2018 Mark Karpov  All rights reserved. 
README.md view
@@ -5,7 +5,6 @@ [![Stackage Nightly](http://stackage.org/package/wave/badge/nightly)](http://stackage.org/nightly/package/wave) [![Stackage LTS](http://stackage.org/package/wave/badge/lts)](http://stackage.org/lts/package/wave) [![Build Status](https://travis-ci.org/mrkkrp/wave.svg?branch=master)](https://travis-ci.org/mrkkrp/wave)-[![Coverage Status](https://coveralls.io/repos/mrkkrp/wave/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrkkrp/wave?branch=master)  This module provides a safe interface that allows to manipulate WAVE files in their “classic” form as well as files in@@ -67,6 +66,6 @@  ## License -Copyright © 2016–2017 Mark Karpov+Copyright © 2016–2019 Mark Karpov  Distributed under BSD 3 clause license.
tests/Codec/Audio/WaveSpec.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns         #-}-{-# LANGUAGE CPP                  #-} {-# LANGUAGE OverloadedStrings    #-} {-# LANGUAGE RecordWildCards      #-} {-# OPTIONS_GHC -fno-warn-orphans #-}@@ -9,7 +8,6 @@ where  import Codec.Audio.Wave-import Data.Default.Class import Data.Word import System.IO import System.IO.Temp (withSystemTempFile)@@ -18,10 +16,6 @@ import qualified Data.ByteString as B import qualified Data.Set        as E -#if !MIN_VERSION_base(4,8,0)-import Control.Applicative-#endif- -- The test suite has two parts. In the first part we establish that the -- library is capable of reading various sample files. In the second part, -- we generate random WAVE files and write them to temporary files, then@@ -315,6 +309,16 @@           , waveOtherChunks  = waveOtherChunks wave }    describe "pre-defined speaker configurations" $ do+    let def = Wave+          { waveFileFormat   = WaveVanilla+          , waveSampleRate   = 44100+          , waveSampleFormat = SampleFormatPcmInt 16+          , waveChannelMask  = E.empty+          , waveDataOffset   = 0+          , waveDataSize     = 0+          , waveSamplesTotal = 0+          , waveOtherChunks  = []+          }     describe "speakerMono" $       it "has 1 channel" $         waveChannels def { waveChannelMask = speakerMono } `shouldBe` 1@@ -346,9 +350,9 @@ instance Arbitrary Wave where   arbitrary = do     waveFileFormat <- elements [minBound..maxBound]-    waveSampleRate <- arbitrary+    waveSampleRate <- choose (0, 196000)     waveSampleFormat <- oneof-      [ SampleFormatPcmInt . getPositive <$> arbitrary+      [ SampleFormatPcmInt <$> choose (1, 64)       , pure SampleFormatIeeeFloat32Bit       , pure SampleFormatIeeeFloat64Bit ]     waveChannelMask <- arbitrary `suchThat` (not . E.null)
wave.cabal view
@@ -1,7 +1,7 @@ name:                 wave-version:              0.1.5-cabal-version:        >= 1.10-tested-with:          GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.1+version:              0.2.0+cabal-version:        1.18+tested-with:          GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 license:              BSD3 license-file:         LICENSE.md author:               Mark Karpov <markkarpov92@gmail.com>@@ -30,14 +30,19 @@   build-depends:      base             >= 4.7    && < 5.0                     , bytestring       >= 0.2    && < 0.11                     , cereal           >= 0.3    && < 0.6-                    , containers       >= 0.5    && < 0.6-                    , data-default-class+                    , containers       >= 0.5    && < 0.7                     , transformers     >= 0.4    && < 0.6   exposed-modules:    Codec.Audio.Wave   if flag(dev)     ghc-options:      -Wall -Werror   else     ghc-options:      -O2 -Wall+  if flag(dev) && impl(ghc >= 8.0)+    ghc-options:      -Wcompat+                      -Wincomplete-record-updates+                      -Wincomplete-uni-patterns+                      -Wnoncanonical-monad-instances+                      -Wnoncanonical-monadfail-instances   default-language:   Haskell2010  test-suite tests@@ -48,11 +53,11 @@   build-depends:      QuickCheck       >= 2.8.2  && < 3.0                     , base             >= 4.7    && < 5.0                     , bytestring       >= 0.2    && < 0.11-                    , containers       >= 0.5    && < 0.6-                    , data-default-class+                    , containers       >= 0.5    && < 0.7                     , hspec            >= 2.0    && < 3.0-                    , temporary        >= 1.1    && < 1.3+                    , temporary        >= 1.1    && < 1.4                     , wave+  build-tools:        hspec-discover   >= 2.0 && < 3.0   if flag(dev)     ghc-options:      -Wall -Werror   else