Jump to content

Program function (or other) keys to play sounds on demand


studiot

Recommended Posts

I have an old Dell (Vista) laptop I'm using for controlling things in a play and am trying to get a handful of keys to play particular sound files on demand, without leaving the Powerpoint screen.

 

Any ideas welcome.

 

Already tried Intellitype, but can't seem to access the keys, let alone reprogram them.

Link to comment
Share on other sites

What you need is application allowing reconfiguration of hot keys to execute some command-line tool.

 

And command-line tool to play the sound, supplied as argument, path to .wav or .mp3 file.

 

Personally I would not even bother searching for such apps (it would take longer), but simply make them.

 

Try PlaySound function

https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx

https://msdn.microsoft.com/pl-pl/library/windows/desktop/dd743679(v=vs.85).aspx

Here is Visual Studio 2008 Express project with compiled 32 bit exe:

PlaySound.zip

(only one argument, path to .wave file)

 

To intercept keys use SetWindowsHookEx

https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms644990(v=vs.85).aspx

with WH_KEYBOARD or WH_KEYBOARD_LL

 

Here is Visual Studio 2008 Express project with compiled 32 bit exe and DLL with hook routine:

HotKeySound.zip

After pressing keys 0....9 there will be played sound with path C:\0.wav .... C:\9.wav, so you have to rename your files to match them.

You can change this inside of DLL routine MyHookProc.

I was wondering whether Windows will allow using PlaySound (or even loading file at such low level function).

But works fine in at least Windows 7 and Windows XP.

Edited by Sensei
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.