Solved

master Volume

Posted on 1998-09-16
16
381 Views
Last Modified: 2010-04-06
Can i control the master volume? If yes, how? I know how to control the wav vol, cd vol and so on but how to control the master volume?
0
Comment
Question by:dagger
  • 6
  • 4
  • 4
  • +2
16 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1340007
What's the master volume?
0
 

Author Comment

by:dagger
ID: 1340008
Master Volume in Windows 95
U have a task bar in Windows 95. Go to the task bar and u can see there is a running clock and besides the running clock there is a sound icon. Left click on the sound icon once and there is a volume control. changing the volume will result changing the voulme for wave, midi, Cd and so on. And if u were to change the voulme for CD onli i.e double click the sound icon and u will able to see the voulme contol for cd ...changing that will onli change the volume of cd onli....See the difference?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1340009
dagger,

do you want to do this with API?
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:dagger
ID: 1340010
Madshi,
Do you know which Windows API to use, to control the Master Volume?
And i think this is the only solution, by using window API, to control the Master Volume. Is there any other possible way?

Thanks...
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340011
hi, dagger.

here's something i've just fumbled out:

.

var
  Form1: TForm1;
  pCurrentVolumeLevel: PDWord;
  CurrentVolumeLevel: DWord;

procedure TForm1.FormCreate(Sender: TObject);
begin
  New(pCurrentVolumeLevel);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  auxGetVolume(0, pCurrentVolumeLevel);
  CurrentVolumeLevel := pCurrentVolumeLevel^;
  Trackbar1.position := LoWord(CurrentVolumeLevel) DIV GetTrackBar;
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
  CurrentVolumeLevel := Trackbar1.position * GetTrackBar shl 16;
  CurrentVolumeLevel := CurrentVolumeLevel + (Trackbar1.position * GetTrackBar);

  if auxSetVolume(0, CurrentVolumeLevel) <> 0 then   // <- !!!!!!!!
    ShowMessage('Cannot adjust Volume.');

end;

in the third line above (with the exclamation marks):

on my machine:

0: wave
1: midi
2: cd audio
3: line-in
4: micro
5: VOLUME CONTROL (this is the master volume)
6: pc-speaker

(function auxGetNumDevs returns 7)

i don't know yet how to determine which deviceid is which control. this is in MMSystem.

i'll work on it...

cheers,

Black Death.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340012
oh, and don't forget to dispose(pCurrentVolumeLevel); on Destroy...

Black Death.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1340013
Hi BlackDeath,

why are you using "New(pCurrentVolumeLevel)" ??????? Why not using "auxGetVolume(0,@CurrentVolumeLevel)" instead? Wouldn't that be much simpler?

Regards, Madshi.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340014
ugh, yeah. :-(

this one grew - btw: the kind of allocating the pointer's variable memory is not the actual problem.
(sometimes i fall back to my roots when dealing with a special problem.....) :-|

problem *_is_* :

do you have a solution for determining the deviceid of each available control?????

so long,

nastrowje! :-)

Black Death.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1340015
BlackDeath,

I know this was not the problem.  :-)

I didn't know the aux... functions before your comment. So I can't help you with that. I'm using the functions "mixerGetNumDevs/mixerOpen/mixerGetLineInfo/mixerGetLineControls/mixerSetControlDetails" instead. But they are very, very, very, very, very, very, very complicated.
Unfortunately I'm not allowed to give you my sources - my boss would be quite annoyed about that. I wish I were my own boss...   :-(

Regards, Madshi.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340016
madshi,

i've browsed through those funcs und must say:
this sux.
they're *REALLY* not simple in the common sense.

say - what might be youre job when it's affected by this question?

nevertheless i'm gonna try and see if i can figure out the correct usage of the mixer-funcs. i must be crazy.

if you've got any hints (respecting literature, url's etc. concerning this theme and not interfering with your job), pleez post'em'ere.

i'm quite intersted in this thing now, too.

maybe dagger could adjust the points to 7
(my 2nd number; i think 666, which is my 1st number, is a little bit too much) - just as a lucky charm...

_gosh_, what a pile of *crap*.

we'll see.

so long,

Black Death.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340017
ach - noch was:

madshi,
before i go on trying to dig it, tell me if these are the solution to the prob.

Black Death.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1340018
BlackDeath,

my job is just programming. Unfortunately my boss doesn't want me to post here too much of my complete sources. I would really like to, but I'm just not allowed to. I think my boss has a little paranoia (pssst - don't tell him that).
With the mixer functions you can do everything what the windows mixer does. The windows mixer is just the graphical implementation of all this complex mixer functions. So you can do EVERYTHING with them.
OK, I'll give you some lines to begin with. If you want to change some control use mixerGetControlDetails/mixerSetControlDetails.

procedure ShowMixerControls;
var booleanToChar : array [boolean] of string = ('-','+');
var mix     : integer;
    mixCaps : TMixerCaps;
    ml      : TMixerLine;
    c1      : cardinal;
    str     : string;
 function ContainsControl(ml: TMixerLine; ct: cardinal) : boolean;
 var mlc : TMixerLineControls;
     mc  : TMixerControl;
 begin
   with mlc do begin
     cbStruct:=SizeOf(mlc);
     dwLineID:=ml.dwLineID; cControls:=ml.cControls;
     dwControlType:=ct;
     cbmxctrl:=SizeOf(mc); pamxctrl:=@mc;
   end;
   result:=mixerGetLineControls(mix,@mlc,MIXER_GETLINECONTROLSF_ONEBYTYPE)=MMSYSERR_NOERROR;
 end;
 procedure EnumMixerSources(dstComponentType: cardinal);
 var i1      : cardinal;
     s1      : string;
     ml1,ml2 : TMixerLine;
 begin
   with ml1 do begin
     cbStruct:=SizeOf(ml1); dwComponentType:=dstComponentType;
   end;
   if mixerGetLineInfo(mix,@ml1,MIXER_GETLINEINFOF_COMPONENTTYPE)<>MMSYSERR_NOERROR then exit;
   s1:=ml1.szName; while length(s1)<25 do s1:=s1+' ';
   str:=str+Copy(s1,1,25)+'  ';
   str:=str+booleanToChar[ContainsControl(ml1,MIXERCONTROL_CONTROLTYPE_VOLUME   )]+'    ';
   str:=str+booleanToChar[ContainsControl(ml1,MIXERCONTROL_CONTROLTYPE_MUTE     )]+'    ';
   str:=str+booleanToChar[ContainsControl(ml1,MIXERCONTROL_CONTROLTYPE_PEAKMETER)]+'    ';
   str:=str+booleanToChar[ContainsControl(ml1,MIXERCONTROL_CONTROLTYPE_MUX      )]+'    ';
   str:=str+booleanToChar[ContainsControl(ml1,MIXERCONTROL_CONTROLTYPE_MIXER    )]+'    '#$D#$A;
   for i1:=0 to ml1.cConnections-1 do begin
     with ml2 do begin
       cbStruct:=SizeOf(ml2); dwDestination:=ml1.dwDestination; dwSource:=i1;
     end;
     if mixerGetLineInfo(mix,@ml2,MIXER_GETLINEINFOF_SOURCE)<>MMSYSERR_NOERROR then exit;
     s1:='  '+ml2.szName; while length(s1)<25 do s1:=s1+' ';
     str:=str+Copy(s1,1,25)+'  ';
     str:=str+booleanToChar[ContainsControl(ml2,MIXERCONTROL_CONTROLTYPE_VOLUME   )]+'    ';
     str:=str+booleanToChar[ContainsControl(ml2,MIXERCONTROL_CONTROLTYPE_MUTE     )]+'    ';
     str:=str+booleanToChar[ContainsControl(ml2,MIXERCONTROL_CONTROLTYPE_PEAKMETER)]+#$D#$A;
   end;
 end;
begin
  if (mixerGetNumDevs>0) and (mixerOpen(@mix,0,0,0,MIXER_OBJECTF_MIXER)=MMSYSERR_NOERROR) and
     (mixerGetDevCaps(0,@mixCaps,sizeOf(mixCaps))=MMSYSERR_NOERROR) then
    try
      str:='Name                       Vol. Mute Peak Mux Mixer'#$D#$A;
      ml.cbStruct:=sizeOf(ml);
      for c1:=0 to mixCaps.cDestinations-1 do begin
        ml.dwDestination:=c1;
        mixerGetLineInfo(mix,@ml,MIXER_GETLINEINFOF_DESTINATION);
        EnumMixerSources(ml.dwComponentType);
        //MIXERLINE_COMPONENTTYPE_DST_SPEAKERS);
        //EnumMixerSources(MIXERLINE_COMPONENTTYPE_DST_WAVEIN);
      end;
      MessageBox(0,PChar(str),'Mixer',0);
    finally mixerClose(mix) end;
end;

Regards, Madshi.
0
 

Author Comment

by:dagger
ID: 1340019
OK, I have increase the points. Looks like this is going to take me some time to look into this master volume thingy. I am really puzzle when i look into this codes especially from Madshi. I am not really an expert like u guys.
Anyway, i will check with u guys from time to time. By the way, BlackDeath, i am not going to reject your answer, since u haven't completed it yet. And, ha ha ha , i don't know that is the correct one or not.

Cheers, dagger.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1340020
hoy, dagger!

i can't find any answer (?) so what are you not going to reject?
be sure - i'm working on it.
and as soon as i've got something that worx i'll post it here, ok?

regs,
Black Death.
0
 

Author Comment

by:dagger
ID: 1340021
I not going to reject cos there isn't any proposed anwer to reject. All the discussion above are mainly comments only.
I have increased the points to 10. Chow.

Cheers, dagger
0
 

Accepted Solution

by:
bome earned 10 total points
ID: 1340022
Found that.
Normally it shoudln't be OK to get points for another peoples work, but, this is far too little points for the problem and it's a long time ago that I answered a question...

http://www.wilsonc.demon.co.uk/delphi.htm

and download mixer demo and mixer explorer. It's free and with full source.

bome

PS: certainly it includes the way to control the master volume.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using idhttp to login to instagram 2 89
Downloading email attachments 2 72
Delphi: making a BW image transparent 10 35
Delphi problems to abort a printjob 9 17
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now