----------------------------------------------------------------------
-- Creating builders for ZoomCache types.

fromFlags :: Bool -> Bool -> SampleRateType -> Builder
fromFlags delta zlib drType = fromInt16be (zl .|. dl .|. dr)
    where
        zl | zlib                 = 4
           | otherwise            = 0
        dl | delta                = 2
           | otherwise            = 0
        dr | drType == VariableSR = 1
           | otherwise            = 0
fromFlags :: Bool -> Bool -> SampleRateType -> Builder
fromFlags delta zlib drType = fromInt16be (zl .|. dl .|. dr)
    where
        zl | zlib                 = 4
           | otherwise            = 0
        dl | delta                = 2
           | otherwise            = 0
        dr | drType == VariableSR = 1
           | otherwise            = 0
fromFlags delta zlib drType = fromInt16be (zl .|. dl .|. dr)
    where
        zl | zlib                 = 4
           | otherwise            = 0
        dl | delta                = 2
           | otherwise            = 0
        dr | drType == VariableSR = 1
           | otherwise            = 0