Lazarus
Programming => Graphics and Multimedia => Audio and Video => Topic started by: pcurtis on March 16, 2021, 09:41:32 am
-
I was given the following code (DELPHI), see attachment, but can't get it to compile / work.
It's supposed to implement a callback for sound change notifications. It works as such but I cant compile
PostMessage(Handle, WM_VOLNOTIFY, WPARAM(pNotify.bMuted <> False), LPARAM(Round(100 * pNotify.fMasterVolume)));
If I change to
PostMessage(Handle, WM_VOLNOTIFY, 0, 0);
It works, but, of course, I get no information what has changed ...
Any help appreciated.
Thanks in advance.
-
Just needed to dereference the pointer.
-
Just needed to dereference the pointer.
Hello PCurtis.
Congrats, you did it ! ;D
If I change to
PostMessage(Handle, WM_VOLNOTIFY, 0, 0);
It works, but, of course, I get no information what has changed ...
You have more luck than me, even changing this in your demo (that compiles out-of-the-box) here nothing appends if I change the Windows-mixer-volume, the callback does not start.
[EDIT] Ooops, no, sorry, it works perfectly on Windows 10 (but not via Linux wine emulator).
Many thanks to share this code (and thanks to Him if he helped you).
Fre;D
-
Try this (attachment)
Win 10, Laz 2.0.12
-
Hello Curtis.
Re-oops we sent the post together, please take a look at my [EDIT].
I will try your new code now.
Fre;D
-
Hello PCurtis.
This one is a very Big Wow.
:o
I was never able to do this since Windows 3.1 on Delphi.
And of course did not try to do it with fpc.
It would be marvelous if you share this code on a site like GitHub.
I am busy to do the same for Linux via libasound.so (but not yet ready, the callback fire only ones here).
Fre;D
-
Do what you want with the code.
It comes with a "Couldn'tGiveAShit" license.
The only clause is:
1. If you sell it and make loads of money, I want a cut. :)
-
Do what you want with the code.
It comes with a "Couldn'tGiveAShit" license.
The only clause is:
1. If you sell it and make loads of money, I want a cut. :)
Personally, I dont use Windows for centuries now.
And I dont want to be rich.
But also it would be a crime to let this code in the dark.
So, ok, let's become rich (OK for 100% to you and the rest for me?).
Thanks PCurtis.
Fre;D
-
Hello.
Here code to set/get Windows Master Volume and assign the callback procedure of system mixer.
With a console demo.
This thanks to PCurtis.
https://github.com/fredvs/win_mixer
There is the same for Linux here:
https://github.com/fredvs/alsa_mixer
Fre;D