View Full Version : DLL Set Master Volume (of system)! - Intrigued
Intrigued
12-21-2005, 07:02 PM
I found some delphi code post to a Website and I changed it some and then compiled it so that we can now Set the Master Volume for the system! So, all sounds that play through the speakers can be affected.
Project file (AMS 6 .apz):
http://www.amsuser.com/ams/examples/DLLSetMasterVolume-AMS6-Intrigued.apz
Executable example:
http://www.amsuser.com/ams/examples/DLLSetMasterVolume-AMS6-Intrigued.exe
Intrigued
12-21-2005, 07:20 PM
An example use that is off the beaten path, maybe.
To fade-in sound(s):
v = 68000
for i = 1, v, -100 do
DLL.CallFunction("AutoPlay\\Docs\\DLLSetMasterVolume.dll", "SETMV", i, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
end
To fade-out sounds(s):
v = 68000
for i = 1, v, 100 do
DLL.CallFunction("AutoPlay\\Docs\\DLLSetMasterVolume.dll", "SETMV", i, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
end
If you search the forums, you'll find a DLL I wrote back in the day of AMS4 that sets the volume of the Master, Wave, CD, Mic and Line. It was my first DLL for AMS, so it holds a special place in my heart :)
Corey
12-21-2005, 10:49 PM
I remember that! Wow, how time flies... :)
Intrigued
12-22-2005, 03:56 AM
I found your post but you stated it is for the Wave portion and nothing about the Master Volume (Volume Control column in Win XP).
Allows you to control the Wave Volume from within your application.
Which is posted here:
http://www.indigorose.com/forums/showpost.php?p=7424&postcount=1
Corey
12-22-2005, 04:43 AM
Forsooth! How doth thou riposte good sir Worm? :eek:
Yep that was the original post, a couple days later I took it a little further...
http://www.indigorose.com/forums/showthread.php?t=1665&highlight=master+volume
Corey
12-22-2005, 06:31 AM
Egads! O what epic plots thicken in the morning glow. :eek:
For grins... here is an example from one of my very first AMS5 projects.
Corey
12-22-2005, 07:53 AM
Gadzooks! :yes
Yep that was the original post, a couple days later I took it a little further...
http://www.indigorose.com/forums/showthread.php?t=1665&highlight=master+volume
nice stuff
but when i try to download, it requires a username+password
From the old v4 post? If so, then I probably have changed the structure of my web content since then. Back then, we couldn't upload to the forum.
Download the above APZ, and it'll show you how to use it. The old download would have been a AMS4 app anyhow.
Intrigued
12-22-2005, 06:39 PM
Okay, worm. This is what I was working on tonight and then I checked into what your DLL had as far as functions and it seems like the same except for I was to have the ability to see what the current values are for some if not all of the volume control sliders.
You have (see: attachment)
:yes
I don't understand, the DLL I posted does Get the different volume levels... am I missing something?
Intrigued
12-23-2005, 10:48 PM
*Ah, taps iPod earbuds, Houston *crackling sound*, brea...k...ing..up. Lost data in transmi... ssio...n*
Ack! So true Worm. I totally looked past (is there such a thing as "selective sight", like "selected hearing"? ;))
My bad, thanks for catching such. I just saved more time this weekend. Hey, you got the wheel, why try to improve on it!
:D
Here's a quick reference to the calls in the fcSound.dll for anyone that may need them. These lines of code make changes to the Master Volume. Simply change the function name to the desired volume you want to change. the syntax for each is the same.
--[[ *********** Function Listing ***************
SetMasterVol
GetMasterVol
SetMasterMuteOn
SetMasterMuteOff
IsMasterMuteOn
SetWaveVol
GetWaveVol
SetWaveMuteOn
SetWaveMuteOff
IsWaveMuteOn
SetMicMuteOn
SetMicMuteOff
SetMicVol
GetMicVol
IsMicMuteOn
SetLineVol
GetLineVol
SetLineMuteOn
SetLineMuteOff
IsLineMuteOn
SetCDVol
GetCDVol
SetCDMuteOn
SetCDMuteOff
IsCDMuteOn
*******************************************]]--
-- Get the Master Volume Level (1-100)
mvol = DLL.CallFunction("AutoPlay\\DLL\\fcSound.dll", "GetMasterVol", "", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
-- Set the Master Volume Level (1-100)
result = DLL.CallFunction("AutoPlay\\DLL\\fcSound.DLL", "SetMasterVol", mvol, DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
-- Set Master Mute On
DLL.CallFunction("AutoPlay\\DLL\\fcSound.dll", "SetMasterMuteOn", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
-- SetMaster Mute Off
DLL.CallFunction("AutoPlay\\DLL\\fcSound.dll", "SetMasterMuteOff", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
--Is the Master Volume Mute On
nReturn = String.ToNumber(DLL.CallFunction("AutoPlay\\DLL\\fcSound.dll", "IsMasterMuteOn", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL));
if nReturn == 0 then
-- Master Mute is Off
else
-- Master Mute Is On
end
davels
04-07-2007, 07:10 PM
Hi,
I'm trying to use a Delphi DLL with AMS6 but I got a crash ... :rolleyes
Maybe my DLL structure is bad, can you help me/give me some information on how struct my DLL in Delphi?
Thx a lot :)
David
not sure, have you tried both calling conventions? When I first started out, I had some issues with that. Try either one:
DLL_CALL_CDECL
or
DLL_CALL_STDCALL
The other thing is to be sure that the parameters are all passed ByVal.
davels
04-07-2007, 07:24 PM
Thx for your answer.
I just check with both of them but it doesn't work.
What do you mean "ByVal"? :)
I'm not a Delphi programmer, but the parameters passed into the DLL have to be ByVal or By Value. You can't pass a structure in nor can you check a parameter for results. The return of the DLL is all AMS will see.
davels
04-07-2007, 07:28 PM
Thx, I understant what you mean now :)
The return value are shortstring, maybe it's not a good way?
I never developped a DLL untill now :)
davels
10-22-2007, 11:07 AM
Up
I'm always trying to import string from a Delphi DLL to AMS!
If someone can help me :)
goukilord10
05-22-2008, 06:28 AM
is there a way to control the SW Synth Volume ?
SteevieNiteHeat
09-04-2008, 07:16 AM
Hi! I realise that this thread is ages old, but I have just stubled across it and I need this for my project!
I have a slider object in my app that I'd like to control the master volume with, I have the DLL in my project, but when run it just makes the volume go to zero, and using the slider does nothing!
The code I have is On Slider PosChange:
Range = Slider.GetRange ("MySlider");
if (Range) then
DLL.CallFunction("AutoPlay\\Docs\\DLLSetMasterVolume.dll", "SETMV", (Range), DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
end
can anyone or Worm help me to sort it out please?
Download the APZ from this post:
http://www.indigorose.com/forums/showpost.php?p=71002&postcount=9
You'll want to use the DLL I have in that project.
Then use this line of code in your OnPosChange (no othe code needed). This assumes you are using the range of 0 - 100
result = DLL.CallFunction("AutoPlay\\DLL\\fcSound.DLL", "SetMasterVol", e_Pos, DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
SteevieNiteHeat
09-04-2008, 07:57 AM
Download the APZ from this post:
http://www.indigorose.com/forums/showpost.php?p=71002&postcount=9
You'll want to use the DLL I have in that project.
Then use this line of code in your OnPosChange (no othe code needed). This assumes you are using the range of 0 - 100
result = DLL.CallFunction("AutoPlay\\DLL\\fcSound.DLL", "SetMasterVol", e_Pos, DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
Hi Worm!
Yes I have done what you said, and changed it re the code above, but it does nothing at all, it dont even change the volume control on the taskbar, it dont do anything :(
where did you put the DLL? If you look at the path in the call, it is looking for it in the Autoplay\DLL folder. More than likely its in your Doc folder
SteevieNiteHeat
09-04-2008, 08:08 AM
where did you put the DLL? If you look at the path in the call, it is looking for it in the Autoplay\DLL folder. More than likely its in your Doc folder
yes it is in the Docs folder, but I have changed the path in the code to relate to the AutoPlay\Docs folder.
Here's a stripped down example.
SteevieNiteHeat
09-04-2008, 08:30 AM
Here's a stripped down example.
THanks worm, it works :)
Next I'm going to set the slider position to the current volume level and add a label to display the volume!
At last a gap has been filled in my app :)
SteevieNiteHeat
09-06-2008, 07:59 PM
Well I have been tinkering around, but I cannot get it set.
When I open the page, I would like the slider position to be set to the relevant volume setting, but whenever I open the page, it always sets it to 0 :(
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.