4 module Codec.Audio.WavPack.Types
10 import Data.Binary.Put
18 , bhTotalSamples ∷ !Word32
19 , bhBlockIndex ∷ !Word32
20 , bhBlockSamples ∷ !Word32
26 instance Binary BlockHeader where
28 = do putWord8 119 -- 'w'
32 putWord32le $ bhSize bh
33 putWord16le $ bhVersion bh
34 putWord8 $ bhTrackNo bh
35 putWord8 $ bhIndexNo bh
36 putWord32le $ bhTotalSamples bh
37 putWord32le $ bhBlockIndex bh
38 putWord32le $ bhBlockSamples bh
39 putWord32le $ bhFlags bh
40 putWord32le $ bhCRC bh
42 get = do skip 4 -- "wvpk"
47 totalSamples ← getWord32le
48 blockIndex ← getWord32le
49 blockSamples ← getWord32le
57 , bhTotalSamples = totalSamples
58 , bhBlockIndex = blockIndex
59 , bhBlockSamples = blockSamples
66 char ckID [4]; // "wvpk"
67 uint32_t ckSize; // size of entire block (minus 8, of course)
68 uint16_t version; // 0x402 to 0x410 are currently valid for decode
69 uchar track_no; // track number (0 if not used, like now)
70 uchar index_no; // track sub-index (0 if not used, like now)
71 uint32_t total_samples; // total samples for entire file, but this is
72 // only valid if block_index == 0 and a value of
73 // -1 indicates unknown length
74 uint32_t block_index; // index of first sample in block relative to
75 // beginning of file (normally this would start
76 // at 0 for the first block)
77 uint32_t block_samples; // number of samples in this block (0 = no audio)
78 uint32_t flags; // various flags for id and decoding
79 uint32_t crc; // crc for actual decoded data