This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 Mouse Wheel and Volume
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

xopen

10 Posts

Posted - 11/17/2012 :  00:20:11  Show Profile
Hello Rob

I do not know how to use the middle button and scroll wheel of the mouse wheel to control the size of the sound
Can you give some guidance?

I GOOGLE translation, do not know whether the Right, No offense

Rob

USA
2615 Posts

Posted - 11/17/2012 :  10:30:45  Show Profile  Visit Rob's Homepage
No offense taken

First, you must check this setting:


This allows S+ to execute actions on each wheel move, as allows you to have two different actions execute which only differ on scroll up and scroll down.


For example, create an action for volume up which has no gesture (drawing) selected and check the Scroll Up modifier (or however it appears if you are using the Chinese translation):



In this action, insert the following code:
local iVolume = 0
iVolume = acGetVolume()
iVolume = iVolume + ((sp_wheel_delta / 1200) * 100)
if iVolume > 100 then
   iVolume = 100
end
if iVolume < 0 then
   iVolume = 0
end
acSetVolume(iVolume, 0)



Then make another action for volume down which has no gesture and select the Scroll Down modifier:



..and use this code:
local iVolume = 0
iVolume = acGetVolume()
iVolume = iVolume + ((sp_wheel_delta / 1200) * 100)
if iVolume > 100 then
   iVolume = 100
end
if iVolume < 0 then
   iVolume = 0
end
acSetVolume(iVolume, 0)



Now, when you hold down the stroke button (right mouse by default) and roll the mouse wheel up or down, the volume changes accordingly. You can scroll up to 100% volume and all the way down to 0% volume without needing to release the stroke button, as the setting in Preferences allows both actions to execute since they are defined exactly the same except for scroll up or scroll down.

Of course, you may select a gesture and/or other modifiers for this pair of actions, as long as the gesture and modifiers match (only being different for scroll up/down), you will be able to initiate either one and execute the up or down action based on the direction you roll the mouse wheel.

I hope this makes sense, I try to be verbose so the translation converts this well for you.
Go to Top of Page

xopen

10 Posts

Posted - 11/20/2012 :  09:24:00  Show Profile
¸Õ¸ÕÊÔÁËÊԺܺã¬Thank you ! лл£¡
Go to Top of Page

xopen

10 Posts

Posted - 11/20/2012 :  10:24:54  Show Profile
Scroll Up Some problems, failure, and I do not know why, I use Windows 7 x64.When sound from the smallest to the hike, you can only tune one point there is no reaction.I replaced the mouse is not a mouse problem.
Go to Top of Page

xopen

10 Posts

Posted - 11/20/2012 :  10:29:06  Show Profile
May be, I such changes, caused by the

iVolume = iVolume + ((sp_wheel_delta / 12000) * 100)
Go to Top of Page

xopen

10 Posts

Posted - 11/20/2012 :  10:32:18  Show Profile
But the Scroll Down Is so altered iVolume = iVolume + ((sp_wheel_delta / 12000) * 100), then no problem , So I don't know why Scroll Up Can't do it !
Go to Top of Page

xopen

10 Posts

Posted - 11/20/2012 :  10:40:10  Show Profile
the same Code iVolume = iVolume + ((sp_wheel_delta / 12000) * 100) or iVolume = iVolume + ((sp_wheel_delta / 1200) * 10) , ScrollDown Can do it ,But ScrollUp is not ! I guess ScrollUp Program parameters is different ! ºÇºÇ I don't know ,I say that right?
Go to Top of Page

Rob

USA
2615 Posts

Posted - 11/20/2012 :  12:11:22  Show Profile  Visit Rob's Homepage
I'm not sure if I understand why you're having an issue, I run Win 7 64-bit and those are from my config, which work fine.

You can email your StrokesPlus.xml to me: rob#strokesplus.com and I will take a look.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 11/20/2012 :  21:14:30  Show Profile  Visit Rob's Homepage
It appears to be due to a rounding issue in the S+ code.

I will have to examine the code and fix, but until then, bumping your code up slightly resolves the issue. It seems to alternate, increasing by 1% and sometimes 2%..so it's pretty close to what you're looking for.
iVolume = iVolume + ((sp_wheel_delta / 1200) * 20)

I will work on a fix within the code.

Go to Top of Page

Rob

USA
2615 Posts

Posted - 11/20/2012 :  23:35:25  Show Profile  Visit Rob's Homepage
Fixed in 2.4.1.
Go to Top of Page

devourer

2 Posts

Posted - 09/12/2013 :  16:28:01  Show Profile
Hello everyone,
I tried even simpler script, using the second, incremental mode of function acSetVolume:
local delta = 100 * (sp_wheel_delta / 1200)
acSetVolume(delta, 1)

By the way, on my machine I changed divider value to 2000 instead of 1200 - it gives me smoother volume changes.
Go to Top of Page

devourer

2 Posts

Posted - 09/13/2013 :  09:41:38  Show Profile
Well, it looks like the one-liner works too:
acSetVolume(100 * (sp_wheel_delta / 1200), 1)
Go to Top of Page

engstrom9202

Sweden
1 Posts

Posted - 06/08/2015 :  14:17:47  Show Profile
Hi

Is it possible to do exactly this, but to only affect media volume, like spotify?

David Engström
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000