Main > Main Forum
Is it possible to assign Shift Button + Spinner = Computer Audio Volume control?
SavannahLion:
--- Quote from: RandyT on August 07, 2007, 09:35:26 pm ---
--- Quote from: SavannahLion on August 07, 2007, 03:47:38 pm ---With such a proliferation of software that all essentially do the exact same thing makes me to believe that, with a little research and a copy of VB, anybody can write their own custom utility.
--- End quote ---
Doing something like this probably isn't as simple in code as one might first think. It would seem necessary to hook the keyboard (as a keylogger spy app might do) in order to watch for a specific keypress. When that keypress is sensed, the app would then need to seamlessly take focus away from the current app and restore it when finished (or hook mouse events) in order to see by how much and in which direction to adjust the volume.
--- End quote ---
I debated with myself whether I should argue my point. I eventually realized it was probably better to produce a poc than to try and argue or prove any point. I respect your opinion Randy, but please don't make the assumption that I'm just some wannabe code junkie. I'm not established here, but I've written my share of applications.
In any case, someone else seems to want to try.
--- Quote from: ahofle on August 08, 2007, 12:09:50 pm ---Yeah I liked the original idea. I may have to experiment with this in C#. I found an article on capturing global keystrokes and mouse events: (http://www.codeproject.com/csharp/globalhook.asp) . Really, the only remaining item would be to adjust the volume in windows which I imagine isn't very difficult. I'll keep you guys updated.
--- End quote ---
ahofle:
Well I tested the mouse/key capturing functionality and it works perfectly in MAME without taking away focus or anything. I also have code to adjust the windows wave mixer volume. I was thinking of allowing either a 2-key pair for up/down volume adjustment (for those without a spinner/trackball) as well as mouse adjustment, both of which will activate when holding down a user-configurable hotkey. I also need to integrate saved settings support (ini file maybe). So there is still some work to be done, but I have enough of an interest in this now that I will definitely put something together.
I found a few programs on the web that do similar things, but they aren't very cabinet friendly. One guy went so far as to show a semi-transparent slider popup as you adjusted the volume, but didn't even allow you to customize the hotkeys! :laugh2:
SavannahLion:
What the deuce? I'm keep trying to edit my last post and it won't "take." Bleh.
ahofle, are you testing with a key combination capture or a single key capture?
RandyT:
--- Quote from: SavannahLion on August 08, 2007, 01:03:41 pm ---I debated with myself whether I should argue my point. I eventually realized it was probably better to produce a poc than to try and argue or prove any point. I respect your opinion Randy, but please don't make the assumption that I'm just some wannabe code junkie. I'm not established here, but I've written my share of applications.
--- End quote ---
Ok, but you said VB, not C#. I have researched this type of thing pretty exhaustively for other reasons in the past. Here's a quote from one of the sites researched:
-----------
Before you get excited, though, VB on its own cannot be used to create a system-wide hook. This is because the hook procedure must reside within a Windows DLL, and VB cannot create these beasts (because you cannot specify to export the HookProc function). Also I should point out that system-wide hooks aren't much fun to write: you can't debug them very easily, and if anything goes wrong it takes your whole system down! If you have some C/C++ knowledge, however, there are various samples of creating system-wide hooks at MSDN and CodeGuru.
-----------
While it can be done, by using hooks as I stated, "simple" is relative especially as it concerns the use of VB to do these kinds of things. And doing this kind of thing is "frowned upon" in many circles because it uses exactly the same mechanism as covert key-logging software, etc. With very little extra code, the very same utility you use to provide this functionality can be used to log every keystroke you make to a file somewhere, which can then be transmitted to unknown persons for nefarious purposes. If you value the information you type (passwords, credit card numbers, etc) one should be very cautious about installing software that does this kind of thing, especially if it comes from some unknown "eastern block" author, as one of the examples posted by Xiaou2 obviously did. Some (like MS) go to great lengths to intervene with the functionality required to do this type of thing and for good reason. But if Ahofle can put one together that works, I think we can trust him ;)
The other thing to be concerned about / aware of is Windows cross-platform compatibility, how upcoming changes in the way MAME collects input might affect the operation of said code, and so on. Even the linked article states that 95/98 can only use application level hooking, not system wide. So I guess my cab is out :P
I made no assumptions about you or your abilities. I do a lot in VB, and if it were "simple" I would have just knocked out the app instead of posting that it's not that simple to do well. I even posted that I tested a finished app that purports to provide the functionality and it failed under MAME. I'm guessing there's probably a reason for that.
:dunno
RandyT
Tiger-Heli:
Controlling the volume with the mouse wheel can be done using AutoHotKey.
Here is a list of AHK scripts other have written.
Here is one that uses the keyboard keys.
Here is a modification of the above to use the mouse wheel (could likely be further modified to use a mouse axis.
I have played with the first one in XP, but have no idea about Win98 or MAME compatibility. There are a few other volume control scripts on the first link that might be useful as well.
HTH!!!!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version