Author Topic: Alternative Mediakey Plugin  (Read 70145 times)

daedalus

  • Guest
Description
As we all know some keyboard drivers like IntelliType don't play well with (global) media keys. I mainly created this plugin for my own use but decided to share it with everyone here. I have also included the source code for people to look at (and improve upon if they wish). The actual alternative method is to use low-level hooks instead of normal shell hooks to intercept the media keys before IntelliType (or other similar ones).

Known bugs
If MusicBee is stuck doing something (as in hard-locked) your keyboard keys may become unresponsive for about 10 seconds. (I tried to work around this problem by having the actual calls to MB asynchronous but apparently it stalls somewhere else).
Under normal conditions this should never happen.

How to use
1. Disable all media hotkeys from your keyboard settings
2. Disable all media keys from MusicBee Preferences -> Hotkeys
3. Extract the DLL to MusicBee\Plugins
4. Enable the plugin from MusicBee Preferences -> Plugins

Disclaimer
I created this completely as a for-fun project and started without knowing much about Windows APIs at all and cannot really guarantee this code is the most optimal one or runs correctly on your computer. That said I have been running this for a month without any problems.

Download
[.NET2] for MusicBee 1.4
Binary (most people want this): http://daedalus.pingtimeout.net/rls/mb_alt_mediakeys/mb_alt_mediakeys_bin.zip
[.NET4] for MusicBee 2
http://www.mediafire.com/?ju8rbwpdy5pnc64

Source: http://daedalus.pingtimeout.net/rls/mb_alt_mediakeys/mb_alt_mediakeys_src.zip

If you find any bugs feel free to report them. I will try to fix them myself if I can but I would prefer you suggest a fix yourself if you can :)

edit:
added .NET4 build
Last Edit: March 03, 2012, 12:43:40 PM by Steven

eronel

  • Guest
Hi,

thank you very much for your great plugin! Being able to use mediakeys in fullscreen applications was the one thing I was missing in musicbee. Your plugin did the trick. So thanks again...

Joergermeister

  • Newbie
  • *
  • Posts: 6
  • I used to jog...
Great stuff! Works like a charme for me. Fantanstic to use the keyboard shortcuts from the MS Digital Media Keyboard 3000, allthough MusicBee does not have the focus or full window. Love it!

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
this functionality is now built into musicbee 1.4

in the end i couldnt get the keyboard handling to work correctly so i have taken the functionality out of musicbee (from 1.4.4363) and anyone who cant get mediakeys working natively in musicbee should use this plugin
Last Edit: December 12, 2011, 09:12:11 PM by Steven

paq

  • Sr. Member
  • ****
  • Posts: 386
I have a Microsoft Wireless Keyboard 3000 with media buttons and together with MusicBee version 1.4.4370 and this plugin I have one issue:

When the player has focus and I press the Play/Pauise button MusicBee will immediately pause the music and then start playing it again (or play the music directly followed by a pause if the music was already paused). It behaves like a "double click". When the player has no focus it works fine.

However, if I use the previous version of MusicBee, 1.4.4362 and have this plugin enabled the "double click" behavior is gone. If I remember correctly this also applied to other versions where handling of media keys were built in but not to all of them.

So, now that the handling of media keys is no longer built in I'm back to having the Play/Pause button repeating itself when the player has focus.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
try deleting the hotkey key assignment for Multimedia: Play/ Pause

paq

  • Sr. Member
  • ****
  • Posts: 386
try deleting the hotkey key assignment for Multimedia: Play/ Pause

None of the Multimedia actions have any hotkeys assigned to them.  MusicBee will not register the media buttons of my keyboard, doesn't matter if the plugin is enabled or not, unless I force quit Microsoft's itype.exe.

With the plugin disabled the media buttons work fine, but they don't register globally. I have also noticed that if any other window within MusicBee has focus, for instance the Lyrics window or Preferences, the "double click" behavior is gone but as soon the main window has focus the problem is back.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
could you try this version - as long as the mediakeys are not assigned, it should do no processing in MB and only in the mediakey plugin
http://www.mediafire.com/?4x06h6lju3cryfz


paq

  • Sr. Member
  • ****
  • Posts: 386
could you try this version - as long as the mediakeys are not assigned, it should do no processing in MB and only in the mediakey plugin
http://www.mediafire.com/?4x06h6lju3cryfz

Tried it and now the problem is gone! :D With the plugin disabled, nothing happens when I click the media buttons and with the plugin enabled everything works fine - both globally and when MusicBee have focus.  Just like I believe it's supposed to be.

Thank you very much and have a merry christmas! *<:)

Borgfoot

  • Guest
Are the links in the first post dead?  I can't get them to work...

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
daedalus  sent me the source code, so i have compiled it but i cant verify that this will work:

http://www.mediafire.com/?57brg81dct55cfb

otherwise hopefully he will be able to provide another link

VX

  • Guest
daedalus  sent me the source code, so i have compiled it but i cant verify that this will work:

http://www.mediafire.com/?57brg81dct55cfb

otherwise hopefully he will be able to provide another link

Maybe the functionality provided with this plugin (when it's confirmed that it works) could be merged into MusicBee with daedalus permission ???

Borgfoot

  • Guest
Steven, I placed your compiled .dll in the musicbee/plugin folder and it shows up in the preferences > plugin menu, but when I push "configure" I just get a info screen with "OK" button.  I assume that's not normal?



Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34344
yes thats normal. Does pressing a media key now activate the appropriate function in MB?

Borgfoot

  • Guest
Oh, actually my media keys worked fine before.  I had searched about configuring windows media center remotes with musicbee and some threads said to use this plugin.  Thats why I was looking into it, but I guess its just on/off with no configuration options? 

Some of my remotes buttons work, like play/pause/stop.  I was just trying to see if I could get some of the other buttons working like rewind/ff etc.