Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Muting and revoicing the audio from your application Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
02-Sep-03
Category
Multimedia
Language
Delphi 2.x
Views
134
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Christian Cristofori

Based on an old article that described the solution for muting the audio during my 
application, someone asked me to make a similar to be controlled from a Button: 
here's the solution... easy and fast! 

Answer:

WARNING: you must avoid pressing 2 times the mute button or the mixer data will be 
lost. so I added a boolean condition.

1   uses
2     MMSystem;
3   
4   {...}
5   
6   {Global variables}
7   
8   var
9     MyVolume: array[0..10] of LongInt;
10    mDevs: Integer;
11    IsMute: Boolean;
12  
13  Create two button: 
14  
15  cmdMute 
16  cmdRevoice 
17  
18  procedure TfrmMain.FormCreate(Sender: TObject);
19  begin
20    IsMute := False;
21  end;
22  
23  procedure TfrmMain.cmdMuteClick(Sender: TObject);
24  var
25    I: Integer;
26  begin
27    if (not (IsMute)) then
28    begin
29      mDevs := auxGetNumDevs;
30      for I := 0 to mDevs do
31      begin
32        auxGetVolume(I, Addr(MyVolume[I]));
33        auxSetVolume(I, LongInt(9000) * 65536 + LongInt(9000));
34      end;
35      IsMute := True;
36    end;
37  end;
38  
39  procedure TfrmMain.cmdRevoiceClick(Sender: TObject);
40  var
41    I: Integer;
42  begin
43    if (IsMute) then
44    begin
45      for I := 0 to mDevs do
46        auxSetVolute(I, MyVolume[I]);
47      IsMute := False;
48    end;
49  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC