module Sound.MED.Raw.MMDMIDICmd3x where

import Sound.MED.Basic.Amiga

data MMDMIDICmd3x = MMDMIDICmd3x
  { struct_ver      :: UBYTE
  , pad             :: UBYTE
  , num_of_settings :: UWORD
  , ctrlr_types     :: [ UBYTE ]
  , ctrlr_numbers   :: [ UWORD ]
  }
  deriving (Show)

peek :: MEM -> PTR -> IO MMDMIDICmd3x
peek m p = do
  struct_ver'      <- peekUBYTE m (p+0)
  pad'             <- peekUBYTE m (p+1)
  num_of_settings' <- peekUWORD m (p+2)
  ctrlr_types''    <- peekPTR   m (p+4)
  ctrlr_types'     <- mapM (peekUBYTE m) $ pointerRangeGen ctrlr_types'' 1 num_of_settings'
  ctrlr_numbers''  <- peekPTR   m (p+8)
  ctrlr_numbers'   <- mapM (peekUWORD m) $ pointerRangeGen ctrlr_numbers'' 2 num_of_settings'
  return $ MMDMIDICmd3x
    struct_ver' pad' num_of_settings' ctrlr_types' ctrlr_numbers'