;------------------------------------
;   sub 3: _Engine2_Level
;   sub 4: _Engine2_Trig
;   sub 5: _Engine2_Action
;------------------------------------


;**************************
;  Engine Sound 2
;**************************

_Engine2_Level
    Amode
    initpitch
;    	          pause,mono,pri,trs, pan,pow,fxmix,line
    multiparamset, $f0 ,$02, 15 , 0 , 64, 127,  16 ,  1

    panmode,1

;   monomode,2	;	limit in sub & note mono
;   fxline,1
;   fxmix,16
;   pausestatus,$f0	;All stop
;   vibdepth,64
;   vibpitch,96
;   vibdelay,0
;   spanpow,127	
;   priority,12
   
   sr_load,#0
   sr_portwrite,PORT6	;velocity default 0
  
   bprg, 	 BANK_TEST,	 PRG_ENGINE1_L2
   svolume,80
@_WAIT
   waith,8
   sr_portread  ,PORT0
   jumpN, @_WAIT
   sr_portwrite ,PORT4
   allocvoice,3					;Level
@_REOPEN
   opennote,0,_Engine2_Level_Note		;Level Engine
   opennote,1,_Engine2B_Level_Note		;Level Engine

@_ACTIVE
   waith,8
   sr_portread, PORT5
   sr_store,0,_Engine2_PowerL(+1)
   sr_store,0,_Engine2_PowerH(+1)

   sr_portread, PORT6
   jump0,@_Jump_Jet
   jumpN,@_Touch_Jet

@_VeloStore
   sr_store,0, _WaterJet2_Velo(+1)

   sr_portread  ,PORT4			; Engine Stop Signal
   jumpP, @_ACTIVE
@_STOP
   closenote,0
   closenote ,1
  deallocvoice
   jump,@_WAIT

;...........................................	Jump Routine: Prg change.
@_Jump_Jet
   prg ,	 PRG_ENGINE1_KARAMAWARI
   sr_load,#127
   jump,@_VeloStore
      
;...........................................	Touch Routine: Prg change.
@_Touch_Jet
   prg ,	 PRG_ENGINE1_L2
   sr_load,#127
   jump,@_VeloStore


;===== Low Engine  =====


_Engine2_Level_Note
   nprg ,	 PRG_ENGINE1_NOWATER
;   sweepfrom,$85,cn1,255	; A->B , Hokan 
   TGATE,15
   tieon

_Engine2_PowerL
@_Loop
   ntrans,0
   VELO,117
   cn4,8
  bra,@_Loop
 

;===== High Engine & Water =====


_Engine2B_Level_Note
    sweepfrom,$85,cn1,255	; A->B , Hokan 
   TGATE,15
   tieon

_WaterJet2_Velo
   VELO,100
_Engine2_PowerH
   ntrans,0
   cn4,8
  bra,_WaterJet2_Velo
 


;----------------------------------------
;  Engine2 Action
;----------------------------------------

_Engine2_Action
   Bmode
   initpitch
;    	        pause,mono,pri,trs, pan,pow,fxmix,line
   multiparamset, $f0 ,$00, 10 , 0 , 64, 64, 32 ,  1
   panmode,1
   svolume,127
;   evolume,127

@_openwait
   waith,8

   sr_portread ,PORT0
   jumpN,@_opensplash

   sr_store,0,@_Note
   sr_portread ,PORT5		; Action Velo
   sr_store,0,@_Note(+3)	; PORT 5:Velocity 

   bankchg,BANK_TEST
   prg,	PRG_PERCUSSION
   opennote, 0,@_Note

   jump ,@_openwait

@_opensplash

   sr_portread ,PORT1
   jumpN,@_openwait
 
    sr_portwrite,PORT7		;Stack

;Req->PercNum
    sr_extbl,_Splash_Vtable
    sr_store,0,@_Note2_Note
;Req->PanNum
    sr_portread,PORT7
    sr_and,#$03
    sr_extbl,_Splash_Ptable
    sr_store,0,@_Note2_Pan(+1)	
    
    sr_portread ,PORT6		; Splash Velo
    sr_store,0,@_Note2_Note(+3)	; PORT 6:Velocity 	

    bprg,BANK_SPLASH, PRG_PERCUSSION

    opennote, 1,@_Note2

   jump,@_openwait

@_Note
   p00b0w, 320,127,0		;Velo 127,Gate Max 
   fin
   
@_Note2
@_Note2_Pan
   npan,0
   killpan	   
@_Note2_Note
   p00b0w, 320,90,0		;Splash Only. 
   fin
   


;----------------------- Old.
;@_opensplash
;
;  sr_portread ,PORT1
;   jumpN,@_openwait
; 
;    sr_store,0,@_Note2
;    sr_portread ,PORT6		; Splash Velo
;    sr_store,0,@_Note2(+3)	; PORT 6:Velocity 	;;
;
;    bankchg,BANK_SPLASH
;    prg,    PRG_PERCUSSION
;    opennote, 1,@_Note2
;
;   jump,@_openwait
;
;
;@_Note
;  p00b0w, 320,127,0		;Velo 127,Gate Max 
;   fin
;   
;   	
;@_Note2
;   p00b0w, 320,90,0		;Velo 127,Gate Max 
;   fin
