Delphi Control sound Card

Source: Internet
Author: User

Check to see if the sound card is installed

uses mmsystem;
...
function Soundkarte:Boolean;
begin
Result := WaveOutGetNumDevs >0;
end;

Detect sound card exists

If you're doing some sort of multimedia player program, in order to improve the fault tolerance of the system, we must use some detection system functions, which detect whether the existence of a sound card is a problem, the following procedures to help you busy, first of all need to join the uses part of the MMSystem, and then detect the sound card when the form is created:

Procedure Tform1.formcreate (Sender:tobject);

var I:integer;

Begin

I: = Auxgetnumdevs ();

If I<= Then

Label1. Caption: = ' system does not find sound card ';

End

Controlling the sound volume

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.