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;