module Sound.MED.Raw.HybridInstr where
import qualified Sound.MED.Raw.SynthWF as SynthWF
import Sound.MED.Raw.SynthWF(SynthWF)
import Sound.MED.Basic.Amiga
data HybridInstr = HybridInstr
{ defaultdecay :: UBYTE
, reserved :: [ UBYTE ]
, rep :: UWORD
, replen :: UWORD
, voltbllen :: UWORD
, wftbllen :: UWORD
, volspeed :: UBYTE
, wfspeed :: UBYTE
, wforms :: UWORD
, voltbl :: [ UBYTE ]
, wftbl :: [ UBYTE ]
, wf0 :: PTR
, wf :: [ Maybe SynthWF ]
}
deriving (Show)
peek :: MEM -> PTR -> IO HybridInstr
peek m p = do
defaultdecay' <- peekUBYTE m (p+6)
reserved' <- mapM (peekUBYTE m) $ pointerRange (p+7) 1 3
rep' <- peekUWORD m (p+10)
replen' <- peekUWORD m (p+12)
voltbllen' <- peekUWORD m (p+14)
wftbllen' <- peekUWORD m (p+16)
volspeed' <- peekUBYTE m (p+18)
wfspeed' <- peekUBYTE m (p+19)
wforms' <- peekUWORD m (p+20)
voltbl' <- mapM (peekUBYTE m) $ pointerRange (p+22) 1 128
wftbl' <- mapM (peekUBYTE m) $ pointerRange (p+150) 150 128
wf0':wf'' <- mapM (peekPTR m) $ pointerRange (p+278) 4 64
wf' <- mapM (SynthWF.peek m . (p+) $?) wf''
return $ HybridInstr
defaultdecay' reserved' rep' replen' voltbllen' wftbllen'
volspeed' wfspeed' wforms' voltbl' wftbl' wf0' wf'