I think your code is overcomplicated... :)
Checks this file to see what I mean. Like savvito123 said, you only need to save the X position and use it to control the volume as usual.
Hope this helps...
thank you, and thanks for you to savvito, it worked.