module Binrep.Example.Wav where

import Binrep
import Binrep.Generic
import Binrep.Type.Common ( Endianness(..) )
import Binrep.Type.Int
import Binrep.Type.Magic

import GHC.Generics ( Generic )
import Data.Data ( Data )

type End = 'LE
type W32 = I 'U 'I4 End
type W16 = I 'U 'I2 End

data WavHeader = WavHeader
  { WavHeader -> Magic "RIFF"
wavHeaderMagic :: Magic "RIFF"
  , WavHeader -> W32
wavHeaderChunkSize :: W32 -- file size - 8
  , WavHeader -> Magic "WAVE"
wavHeaderFmt :: Magic "WAVE"
  , WavHeader -> Magic "fmt "
wavHeaderFmtChunkMarker :: Magic "fmt "
  , WavHeader -> W16
wavHeaderFmtType :: W16
  , WavHeader -> W16
wavHeaderChannels :: W16
  } deriving stock (forall x. Rep WavHeader x -> WavHeader
forall x. WavHeader -> Rep WavHeader x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WavHeader x -> WavHeader
$cfrom :: forall x. WavHeader -> Rep WavHeader x
Generic, Typeable WavHeader
WavHeader -> DataType
WavHeader -> Constr
(forall b. Data b => b -> b) -> WavHeader -> WavHeader
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> WavHeader -> u
forall u. (forall d. Data d => d -> u) -> WavHeader -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WavHeader
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WavHeader -> c WavHeader
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WavHeader)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WavHeader)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WavHeader -> m WavHeader
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> WavHeader -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> WavHeader -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> WavHeader -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> WavHeader -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WavHeader -> r
gmapT :: (forall b. Data b => b -> b) -> WavHeader -> WavHeader
$cgmapT :: (forall b. Data b => b -> b) -> WavHeader -> WavHeader
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WavHeader)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WavHeader)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WavHeader)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WavHeader)
dataTypeOf :: WavHeader -> DataType
$cdataTypeOf :: WavHeader -> DataType
toConstr :: WavHeader -> Constr
$ctoConstr :: WavHeader -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WavHeader
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WavHeader
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WavHeader -> c WavHeader
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WavHeader -> c WavHeader
Data, Int -> WavHeader -> ShowS
[WavHeader] -> ShowS
WavHeader -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WavHeader] -> ShowS
$cshowList :: [WavHeader] -> ShowS
show :: WavHeader -> String
$cshow :: WavHeader -> String
showsPrec :: Int -> WavHeader -> ShowS
$cshowsPrec :: Int -> WavHeader -> ShowS
Show, WavHeader -> WavHeader -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WavHeader -> WavHeader -> Bool
$c/= :: WavHeader -> WavHeader -> Bool
== :: WavHeader -> WavHeader -> Bool
$c== :: WavHeader -> WavHeader -> Bool
Eq)

instance BLen WavHeader where blen :: WavHeader -> Int
blen = forall a w. (Generic a, GBLen (Rep a), BLen w) => Cfg w -> a -> Int
blenGeneric Cfg Void
cNoSum
instance Put  WavHeader where put :: WavHeader -> Builder
put  = forall a w.
(Generic a, GPut (Rep a), Put w) =>
Cfg w -> a -> Builder
putGeneric  Cfg Void
cNoSum
instance Get  WavHeader where get :: Getter WavHeader
get  = forall a w. (Generic a, GGetD (Rep a), Get w) => Cfg w -> Getter a
getGeneric  Cfg Void
cNoSum