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
How to adjust the volume on TMediaPlayer 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
16-Aug-02
Category
Multimedia
Language
Delphi 2.x
Views
126
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to adjust the volume on TMediaPlayer

Answer:

1   unit MpVolume;
2   
3   interface
4   
5   uses Windows, MPlayer;
6   
7   const
8     MCI_SETAUDIO = $0873;
9     MCI_DGV_SETAUDIO_VOLUME = $4002;
10    MCI_DGV_SETAUDIO_ITEM = $00800000;
11    MCI_DGV_SETAUDIO_VALUE = $01000000;
12  
13    MCI_DGV_STATUS_VOLUME = $4019;
14  
15  type
16    MCI_DGV_SETAUDIO_PARMS = record
17      dwCallback: DWORD;
18      dwItem: DWORd;
19      dwValue: DWORD;
20      dwOver: DWORD;
21      lpstrAlgorithm: PChar;
22      lpstrQuality: PChar;
23    end;
24  
25  type
26    MCI_STATUS_PARMS = record
27      dwCallback: DWORD;
28      dwReturn: DWORD;
29      dwItem: DWORD;
30      dwTrack: DWORD;
31    end;
32  
33    //Remember to add the name of your form to the procedures
34  function GetMPVolume(MP: TMediaPlayer): Integer;
35  procedure SetMPVolume(MP: TMediaPlayer; Volume: Integer);
36  
37  implementation
38  
39  uses mmsystem;
40  
41  function GetMPVolume(MP: TMediaPlayer): Integer;
42  var
43    p: MCI_STATUS_PARMS;
44  begin
45    p.dwCallback := 0;
46    p.dwItem := MCI_DGV_STATUS_VOLUME;
47    mciSendCommand(MP.DeviceID, MCI_STATUS, MCI_STATUS_ITEM, Cardinal(@p));
48    Result := p.dwReturn;
49    { Volume: 0 - 1000 }
50  end;
51  
52  procedure SetMPVolume(MP: TMediaPlayer; Volume: Integer);
53  var
54    p: MCI_DGV_SETAUDIO_PARMS;
55  begin
56    { Volume: 0 - 1000 }
57    p.dwCallback := 0;
58    p.dwItem := MCI_DGV_SETAUDIO_VOLUME;
59    p.dwValue := Volume;
60    p.dwOver := 0;
61    p.lpstrAlgorithm := nil;
62    p.lpstrQuality := nil;
63    mciSendCommand(MP.DeviceID, MCI_SETAUDIO,
64      MCI_DGV_SETAUDIO_VALUE or MCI_DGV_SETAUDIO_ITEM, Cardinal(@p));
65  end;
66  
67  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