! This tests the primlab7 command.
!
startmacro
  set sr  1e5
  set amp 32e3
  
  pipe on
    panel/setup/controls=gc
    primlab7/id=myprim OUT=_wave{ps=32k} ELEM=1e9 AMP=amp FREQ=sr/40 START=0 DELTA=.1/sr
    plot/id=plot1/nice _wave x1=0 x2=400e-6 y1=-amp y2=amp
    
    
    gcontrol text idtext "Instructions" "Should be able to adjust Frequency and Amplitude." 24 7 /title
    gcontrol dvalue sfreq "Frequency" reg.myprim.frequency sr/40 sr  sr/20
    gcontrol dvalue samp  "Amplitude" reg.myprim.amplitude   0     amp amp/20
    gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
    set gc.main.itemColors {PASS=GREEN,FAIL=RED}
    
    
  pipe off
endmacro


procedure processMessage m:msg
  !say "got message name=^msg.name data=^msg.data"

  if msg.name eqs "MAIN" then
    assert/text="primlab7 tests" msg.data eqss "PASS"
    pipe stop
  elseif msg.name eqs "SFREQ" then
    set reg.myprim.frequency msg.data
  elseif msg.name eqs "SAMP" then
    set reg.myprim.amplitude msg.data
  else
    say "Unhandled message name=^msg.name data=^msg.data"
  endif

return
