Support |
As an extension to my last message, here is some pseudo VHDL code (that's because I'm not at all familiar what scripting language can do right now - what's the status of the documentation?) to describe what I think needs to be done: -- I won't deal with variable declaration here -- things we get externally: "controller", which is an integer describing the finger position, "finger", a boolean stating whether the finger is on -- the controller or not, finally "clk", a clock for the process. There's a constant "clk_delta", which is the clock half-period in ms. -- process scratching is begin wait until finger'event and finger -- wait until you put a finger on the controller pause -- pauses playback direction_s <= direction -- used to store playback direction (Forward or Backward) rate_s <= rate -- and rate ctrl_last <= controller -- store current finger position ctrl_last2 <= controller loop: scratching -- inner loop; active while finger is on the controller wait until clock'event if controller = ctrl_last AND controller = ctrl_last2 then pause -- pause playback if finger hasn't moved for last two clocks elsif controller != ctrl_last then play ctrl_delta = controller - ctrl_last if ctrl_delta > 0 then -- check for playing direction if direction_s = forward then forward else backward end if elsif if direction_s = forward then backward else forward end if end if pbspeed = ctrl_delta/clk_delta -- playback speed scale factor is the controller delta since last clk'event divided by clk_delta rate = ln(pbspeed)*17,3123404906676 -- ugly scale factor to convert from pbspeed to rate end if if not finger then exit scratching -- exit from loop end if end scratching loop -- if in the loop the finger is lifted, we resume here direction <= direction_s rate <= rate_s play end process scratching Hope that helps to explain what I'm after. Aaron, I'd also like to hear your comments if you'd like.