Delphi realizes the control sound volume

Source: Internet
Author: User

When you do a multimedia player, it is unavoidable to control the volume and the playback of the left and right channels, the following describes a wave waveform output device Volume control method, this method is not set the main volume. First put two ttrackbar on the form, named Trackbar1,trackbar2, the attribute Max is set to 65535, if you think the scale is too dense, you can set the Frequency property value larger, and then add MMSystem in uses segment, And the following statements are written in the onchange events of TrackBar1 and TRACKBAR2:

procedure TForm1.TrackBar1Change(Sender: TObject);
var Wave:string;
begin
Wave:=$+inttohex(TrackBar1.Position,4)+inttohex(TrackBar2.Position,4);
waveoutsetvolume(0,strtoint(Wave));
end;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.