public int updatePosition ( int p , boolean keyOff ) { p ++ ; if ( loop && p >= position [ loopEndPoint ] ) p = position [ loopStartPoint ] ; if ( sustain && p >= position [ sustainEndPoint ] && ! keyOff ) p = position [ sustainStartPoint ] ; return p ; }
Get the new position