There is no VCL for volume. (in delphi)
You will have to control Windows' volume by API.
Don't mess with the General volume. Change only the WAVE's channel
volume (or if you play a MIDI, only that channel)
try something like this:
*program* VolumeTest;
*uses*
MMSystem;
*procedure* LeftVolume(Value: DWord);
*var*
Rvol,
temp: DWord;
*begin* { LeftVolume }
// WaveoutGetVolume() retrieves the current volume
WaveoutGetVolume(WAVE_MAPPER, @temp);
Rvol := hiword(temp);
asm
shl Rvol,16
*end*;
Rvol := Rvol *and* $ffff0000;
WaveoutSetVolume(WAVE_MAPPER, Value *or* Rvol)
*end*; { LeftVolume }
*procedure* RightVolume(Value: DWord);
*var*
Lvol,
temp: DWord;
*begin* { RightVolume }
// WaveoutGetVolume() retrieves the current volume
WaveoutGetVolume(WAVE_MAPPER, @temp);
Lvol := Loword(temp);
asm
shl value,16
*end*;
Value := Value *and* $ffff0000;
WaveoutSetVolume(WAVE_MAPPER, Value *or* Lvol)
*end*; { RightVolume }
*begin*
Left_volume(20000);
*end*.
Tony Foale wrote:
> I use .avi and .mpg video files for programme tutorials accessible from
> a help form.
> The Delphi MediaPlayer component is used to play these, as per the
> following procedure:
>
> procedure TFormHelp.ButVideoClick(Sender: TObject);
> begin
> OpenDialog1.InitialDir := ExtractFileDir(Application.ExeName) +
> '\Docs' ;
> if OpenDialog1.Execute then
> with MediaPlayer1 do begin
> FileName := OpenDialog1.FileName;
> frames := 1 ;
> try
> Open; // Open Media Player
> Wait := true ; // waits until done playing to return to
> system control
> Play; // Play video
> finally
> close ;
> end; //endtry
> end; //endwith
> //endif
> end;
>
> and that works fine.
>
> However, media player creates its own form to show the video and the
> play-stop-pause-etc. controls stay on the original help form in-operable.
> I'd also like to include a sound volume control on the video form.
> So I have two questions:
>
> 1. Does Delphi 6 have a volume control component, I can't find one?
> 2. How do I put the volume control and also a play-stop-pause-etc.
> control on to the video playing window?
>
>
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi