SUPPORT ACCOUNT CLANS
Welcome, Unregistered.
 

Thread: HoNVolumeControl - Lowers volume of your music player when someone uses HoN voicechat

Page 1 of 5 12345 LastLast
Results 1 to 20 of 84
  1. #1
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123

    HoNVolumeControl - Lowers volume of your music player when someone uses HoN voicechat

    Introduction:
    So, HoN has a nifty feature that lowers the sound of the effects when someone talks ingame.
    Unfortunately, many of us listen to music outside the game.

    Solution:
    This program lowers the sound in your music player when someone on your team (including yourself) talk on HoN.
    This prevents:
    1) You yelling in your mic because of high background sound level
    2) Others yelling at you for not paying attention

    Supported players:
    Natively:
    Winamp
    AIMP
    Via hotkeys:
    Any player with global hotkey support. For instructions refer to http://forums.heroesofnewerth.com/sh...4&postcount=12
    If you need any help, please post in the thread.

    Usage:
    1) Open the inifile and set the correct player handler and volume multiplier. The defaults are Winamp and 0.1.
    2) Start HoN, alttab
    3) Start the program and leave it running.
    4) Play some music in your player.
    Refer to this post for other player support: http://forums.heroesofnewerth.com/sh...0&postcount=11

    Notes:
    1) It is important that the two first steps are done in sequence. Winamp can be already open etc...
    2) If you restart HoN, you need to restart the program.
    3) If S2 release a big patch, changing a lot of functionality about voice, this will probably break.
    4) If you need the program to work with <insert player here>, try to code it yourself please, the API is provided.
    5) If you are scared of exe files, then download Visual Studio Express and compile the source yourself.
    6) Windows only.

    Developers:
    You can write your own plugins for controlling other players.
    Please refer to this post: http://forums.heroesofnewerth.com/sh...0&postcount=11

    Download:
    http://gm.mainframe.no/stuff/HVC1.0.0.3.zip
    Source code included, public domain.

    Credit:
    V10 from heroesofnewerth.ru for helping me find the function controlling sound in k2.dll and implementing the AIMP and hotkey plugins.

    P.S.
    S2, make accessing "talking/not talking" state a bit easier please :/
    Last edited by GM; 11-06-2009 at 04:42 PM.

  2. #2
    Offline
    Account Icon
    Chat Symbol
    Join Date
    Jul 2009
    Location
    Ottawa, Canada, Earth, Sol Sector, Alpha Quadrant, Milky Way, Local Group, Universe
    Posts
    5,408
    Nice. I'd love this for songbird, cause winamp really reaks for managing huge libraries.

  3. #3
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    It's pretty much a matter of writing some simple code.
    The hard part is extracting the status from HoN, not controlling the player...

    That said, I don't see how to control songbird remotely.
    Last edited by GM; 11-05-2009 at 03:59 AM.

  4. #4
    Could you make one for Spotify?


  5. #5
    Offline
    Account Icon
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    6
    Very Good Idea and Nice Work. +1
    When the fog bites
    When the creeps sting
    When I'm playing bad
    I simply remember my favorite things
    And then I don't feel so bad

  6. #6
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Quote Originally Posted by Guni View Post
    Very Good Idea and Nice Work. +1
    Thanks.

    Quote Originally Posted by evilleader View Post
    Could you make one for Spotify?
    I think I need to make a plugin system, so people can code their own DLL's to control players.
    There is no way I can code support for every available player.
    Many players don't have an option to control volume remotely also, so you need to scan memory, find the volume control.... etc...

    Also, I'm curious. Did anyone actually look at the source code and saw what I did there?
    Last edited by GM; 11-05-2009 at 08:36 AM.

  7. #7
    Offline
    Account Icon
    Join Date
    Aug 2009
    Posts
    44
    Taking Mumble as an example, it has the option to use the WSAPI to reduce the volume of all other applications while someone is speaking (with a very brief fade in.out so it doesnt sound bad), in practice it works very well and has no noticable performance side effects. I think it would be best to take a similar approach, however this functionality should be included in the HoN client anyway.

  8. #8
    I use Winamp, thank you for this.

  9. #9
    Offline
    Account Icon
    Join Date
    Jul 2009
    Location
    Canada
    Posts
    3,256
    Move to Applications.

    I might check this out some time
    I'm an honest guy who's not afraid to be blunt. Hope you can handle that.

  10. #10
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Quote Originally Posted by Syr View Post
    Taking Mumble as an example, it has the option to use the WSAPI to reduce the volume of all other applications while someone is speaking (with a very brief fade in.out so it doesnt sound bad), in practice it works very well and has no noticable performance side effects. I think it would be best to take a similar approach, however this functionality should be included in the HoN client anyway.
    There are a few problems with this, which you do not seem to acknowledge.
    You mean WASAPI right?
    Since WASAPI bypasses the Windows mixer, the way Mumble probably does it, is use WASAPI itself and modify all other streams.
    A such approach can NOT be used here because:
    1) WASAPI is available in Vista and up. Not available in XP.
    2) HoN does not use WASAPI, why? Because sound in HoN works under XP and I honestly doubt they bothered making special functionality for Vista.

    So, as good as it sounds, due to windows sound api sucking hard until recently, what you say is not feasible in the current scenario.
    Quote Originally Posted by Warchamp7 View Post
    Move to Applications.

    I might check this out some time
    Thanks.
    Last edited by GM; 11-05-2009 at 10:43 AM.

  11. #11
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    OK, so what I did is allowed people to write their own plugins for this.
    The updated version is in the OP.

    For users:

    1) Get plugin of your choice.
    2) Put it in the same directory as the program
    3) Set PlayerControlDLL in the .ini file to the plugin of your choice, default is libwinamp.dll

    For developers:
    The .ini allows you to specify the DLL that will be called when lowering or increasing the volume.

    The DLL called must export two C style functions:
    void IncreaseVolume(); - called when volume should be increased
    void DecreaseVolume(double multiplier); - called when the volume should be decreased

    If you need an example (or to copypaste code), check libwinamp.cpp.
    Code:
    #include <Windows.h>
    
    EXTERN_C __declspec(dllexport) void IncreaseVolume();
    EXTERN_C __declspec(dllexport) void DecreaseVolume(double multiplier);
    
    int curvolume;
    
    BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, void* reserved)
    {
        switch (reason)
        {
        case DLL_PROCESS_ATTACH:
            break;
    
        case DLL_PROCESS_DETACH:
            IncreaseVolume();
            break;
        }
    
        return TRUE;
    }
    
    __declspec(dllexport) void IncreaseVolume() {
        if (curvolume != NULL) {
            HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
            if (hwndWinamp != NULL) {
                SendMessage(hwndWinamp, WM_USER, curvolume, 122);
            }
        }
    }
    
    __declspec(dllexport) void DecreaseVolume(double multiplier) {
        HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
        if (hwndWinamp != NULL) {
            curvolume = SendMessage(hwndWinamp, WM_USER, -666, 122);
            SendMessage(hwndWinamp, WM_USER, curvolume*multiplier, 122);
        }
    }
    Last edited by GM; 11-10-2009 at 07:00 AM.

  12. #12
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Updated again.

    Major changes are:
    Support for AIMP
    Support for any players supporting global hotkey

    To use global hotkeys:
    1) Set up your player (or use it's built in functions) to mute and unmute on certain hotkeys.
    2) Configure the hotkey plugin.

    Configuring the hotkey plugin:
    In the HonVolumeControl.ini file is a separate section alled HotKey.
    There you can set the hot key combination that gets executed when someone talks and when someone stop stalking.
    They key modifiers are as follows:
    Code:
    WINKEY            @
    SHIFT             +
    CTRL              ^
    ALT               %
    Examples:
    Ctrl+Alt+A = ^%{A}
    SHIFT+N = +{N}
    Ctrl+Alt+Insert = ^%{INS}

    Just set those hotkeys in your player and you are golden.
    For more information, and the key list read: http://msdn.microsoft.com/en-us/library/aa266279(VS.60).aspx
    Last edited by GM; 11-06-2009 at 07:16 PM.

  13. #13
    I've been using Visual Basic's SendKeys a lot and it seems it bypasses most (if not all) global hotkeys and actually delivers the keystrokes to the active application.
    I don't know how well you've tested it, but for me e.g. SendKeys.SendWait("^%{PGDN}") (which is "next track" on my Winamp) actually does not trigger Winamp.
    (I have not had time to take a look at the app itself, but it sounds promising!)

  14. #14
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Quote Originally Posted by Notausgang View Post
    I've been using Visual Basic's SendKeys a lot and it seems it bypasses most (if not all) global hotkeys and actually delivers the keystrokes to the active application.
    I don't know how well you've tested it, but for me e.g. SendKeys.SendWait("^%{PGDN}") (which is "next track" on my Winamp) actually does not trigger Winamp.
    (I have not had time to take a look at the app itself, but it sounds promising!)
    Hi, if you look at the source code then you will realize that this is not using VB.
    A copypasted function is used, to allow defining keys in VB format, but that is the only common thing. The entire program is written in C++ and ASM.
    Thus in this case, it sends keys globally.

  15. #15
    Cool, then nevermind

  16. #16
    Offline
    Account Icon
    Join Date
    Aug 2009
    Posts
    7
    could u make one for foobar?

  17. #17
    Offline
    Account Icon
    Join Date
    Aug 2009
    Posts
    44
    Quote Originally Posted by Ov3rMInD View Post
    could u make one for foobar?
    Foobar has plugins to emulate the winamp API, if the author is unwilling - have a look there.

  18. #18
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Foobar also supports global hotkeys afaik.
    So bind something in foobar to mute/unmute and use the hotkey plugin.

  19. #19
    Offline
    Account Icon
    Join Date
    Aug 2009
    Posts
    44
    Good job man, always nice to see someone taking time to do apps like these. Won't have any use for the app. But will definately look through the source code.

  20. #20
    Offline
    Account Icon
    Join Date
    Jul 2009
    Posts
    123
    Quote Originally Posted by Mandos View Post
    Good job man, always nice to see someone taking time to do apps like these. Won't have any use for the app. But will definately look through the source code.
    It's not very pretty, but it gets the job done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •