dagger
asked on
master Volume
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?
What's the master volume?
ASKER
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?
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?
dagger,
do you want to do this with API?
do you want to do this with API?
ASKER
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...
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...
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(Sen der: 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.
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)
end;
procedure TForm1.TrackBar1Change(Sen
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.
oh, and don't forget to dispose(pCurrentVolumeLeve l); on Destroy...
Black Death.
Black Death.
Hi BlackDeath,
why are you using "New(pCurrentVolumeLevel)" ??????? Why not using "auxGetVolume(0,@CurrentVo lumeLevel) " instead? Wouldn't that be much simpler?
Regards, Madshi.
why are you using "New(pCurrentVolumeLevel)"
Regards, Madshi.
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.
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.
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 /mixerGetL ineInfo/mi xerGetLine Controls/m ixerSetCon trolDetail s" 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.
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
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.
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.
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.
ach - noch was:
madshi,
before i go on trying to dig it, tell me if these are the solution to the prob.
Black Death.
madshi,
before i go on trying to dig it, tell me if these are the solution to the prob.
Black Death.
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/mix erSetContr olDetails.
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:=mixerGetLineContro ls(mix,@ml c,MIXER_GE TLINECONTR OLSF_ONEBY TYPE)=MMSY SERR_NOERR OR;
end;
procedure EnumMixerSources(dstCompon entType: cardinal);
var i1 : cardinal;
s1 : string;
ml1,ml2 : TMixerLine;
begin
with ml1 do begin
cbStruct:=SizeOf(ml1); dwComponentType:=dstCompon entType;
end;
if mixerGetLineInfo(mix,@ml1, MIXER_GETL INEINFOF_C OMPONENTTY PE)<>MMSYS ERR_NOERRO R then exit;
s1:=ml1.szName; while length(s1)<25 do s1:=s1+' ';
str:=str+Copy(s1,1,25)+' ';
str:=str+booleanToChar[Con tainsContr ol(ml1,MIX ERCONTROL_ CONTROLTYP E_VOLUME )]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml1,MIX ERCONTROL_ CONTROLTYP E_MUTE )]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml1,MIX ERCONTROL_ CONTROLTYP E_PEAKMETE R)]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml1,MIX ERCONTROL_ CONTROLTYP E_MUX )]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml1,MIX ERCONTROL_ CONTROLTYP E_MIXER )]+' '#$D#$A;
for i1:=0 to ml1.cConnections-1 do begin
with ml2 do begin
cbStruct:=SizeOf(ml2); dwDestination:=ml1.dwDesti nation; dwSource:=i1;
end;
if mixerGetLineInfo(mix,@ml2, MIXER_GETL INEINFOF_S OURCE)<>MM SYSERR_NOE RROR then exit;
s1:=' '+ml2.szName; while length(s1)<25 do s1:=s1+' ';
str:=str+Copy(s1,1,25)+' ';
str:=str+booleanToChar[Con tainsContr ol(ml2,MIX ERCONTROL_ CONTROLTYP E_VOLUME )]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml2,MIX ERCONTROL_ CONTROLTYP E_MUTE )]+' ';
str:=str+booleanToChar[Con tainsContr ol(ml2,MIX ERCONTROL_ CONTROLTYP E_PEAKMETE R)]+#$D#$A ;
end;
end;
begin
if (mixerGetNumDevs>0) and (mixerOpen(@mix,0,0,0,MIXE R_OBJECTF_ MIXER)=MMS YSERR_NOER ROR) and
(mixerGetDevCaps(0,@mixCap s,sizeOf(m ixCaps))=M MSYSERR_NO ERROR) 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,M IXER_GETLI NEINFOF_DE STINATION) ;
EnumMixerSources(ml.dwComp onentType) ;
//MIXERLINE_COMPONENTTYPE_ DST_SPEAKE RS);
//EnumMixerSources(MIXERLI NE_COMPONE NTTYPE_DST _WAVEIN);
end;
MessageBox(0,PChar(str),'M ixer',0);
finally mixerClose(mix) end;
end;
Regards, Madshi.
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/mix
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:=mixerGetLineContro
end;
procedure EnumMixerSources(dstCompon
var i1 : cardinal;
s1 : string;
ml1,ml2 : TMixerLine;
begin
with ml1 do begin
cbStruct:=SizeOf(ml1); dwComponentType:=dstCompon
end;
if mixerGetLineInfo(mix,@ml1,
s1:=ml1.szName; while length(s1)<25 do s1:=s1+' ';
str:=str+Copy(s1,1,25)+' ';
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
for i1:=0 to ml1.cConnections-1 do begin
with ml2 do begin
cbStruct:=SizeOf(ml2); dwDestination:=ml1.dwDesti
end;
if mixerGetLineInfo(mix,@ml2,
s1:=' '+ml2.szName; while length(s1)<25 do s1:=s1+' ';
str:=str+Copy(s1,1,25)+' ';
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
str:=str+booleanToChar[Con
end;
end;
begin
if (mixerGetNumDevs>0) and (mixerOpen(@mix,0,0,0,MIXE
(mixerGetDevCaps(0,@mixCap
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,M
EnumMixerSources(ml.dwComp
//MIXERLINE_COMPONENTTYPE_
//EnumMixerSources(MIXERLI
end;
MessageBox(0,PChar(str),'M
finally mixerClose(mix) end;
end;
Regards, Madshi.
ASKER
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.
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.
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.
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.
ASKER
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
I have increased the points to 10. Chow.
Cheers, dagger
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.