Hmm... jeg ville gerne have en slags bar der kan ændre det jo?
==================
Intet er værre end en NINJA!
==================
////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Da kan du bruke:
case TrackBar1.Position of
0: waveOutSetVolume(0, $00000000);
1: waveOutSetVolume(0, $10001000);
2: waveOutSetVolume(0, $20002000);
3: waveOutSetVolume(0, $30003000);
4: waveOutSetVolume(0, $40004000);
5: waveOutSetVolume(0, $50005000);
6: waveOutSetVolume(0, $60006000);
7: waveOutSetVolume(0, $70007000);
8: waveOutSetVolume(0, $80008000);
9: waveOutSetVolume(0, $90009000);
10: waveOutSetVolume(0, $A000A000);
11: waveOutSetVolume(0, $B000B000);
12: waveOutSetVolume(0, $C000C000);
13: waveOutSetVolume(0, $D000D000);
14: waveOutSetVolume(0, $E000E000);
15: waveOutSetVolume(0, $F000F000);
16: waveOutSetVolume(0, $FF00FF00);
17: waveOutSetVolume(0, $FFF0FFF0);
18: waveOutSetVolume(0, $FFFFFFFF);
19: waveOutSetVolume(0, $FFFFFFFF);
end;
Du kan også vise/endre lydstyrken til en TMediaPlayer.
Hær har du uniten:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MPlayer, StdCtrls, ComCtrls, MMSystem;
type
TForm1 = class(TForm)
MediaPlayer1: TMediaPlayer;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
MCI_SETAUDIO = $0873;
MCI_DGV_SETAUDIO_VOLUME = $4002;
MCI_DGV_SETAUDIO_ITEM = $00800000;
MCI_DGV_SETAUDIO_VALUE = $01000000;
MCI_DGV_STATUS_VOLUME = $4019;
type
MCI_DGV_SETAUDIO_PARMS = record
dwCallback : DWORD;
dwItem : DWORd;
dwValue : DWORD;
dwOver : DWORD;
lpstrAlgorithm : PChar;
lpstrQuality : PChar;
end;
type
MCI_STATUS_PARMS = record
dwCallback : DWORD;
dwReturn : DWORD;
dwItem : DWORD;
dwTrack : DWORD;
end;
function GetMPVolume(MP : TMediaPlayer) : Integer;
procedure SetMPVolume(MP : TMediaPlayer; Volume : Integer);
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure SetMPVolume(MP : TMediaPlayer; Volume : Integer);
var p: MCI_DGV_SETAUDIO_PARMS;
begin
// Lydstyrke: 0 - 1000
p.dwCallback := 0;
p.dwItem := MCI_DGV_SETAUDIO_VOLUME;
p.dwValue := Volume;
p.dwOver := 0;
p.lpstrAlgorithm := nil;
p.lpstrQuality := nil;
mciSendCommand(MP.DeviceID, MCI_SETAUDIO,
MCI_DGV_SETAUDIO_VALUE or MCI_DGV_SETAUDIO_ITEM, Cardinal(@p));
end;
function GetMPVolume(MP : TMediaPlayer) : Integer;
var p: MCI_STATUS_PARMS;
begin
p.dwCallback := 0;
p.dwItem := MCI_DGV_STATUS_VOLUME;
mciSendCommand(MP.DeviceID, MCI_STATUS, MCI_STATUS_ITEM, Cardinal(@p));
Result := p.dwReturn;
// Lydstyrke: 0 - 1000
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TrackBar1.Max := 1000;
TrackBar2.Max := 1000;
TrackBar1.Position := TrackBar1.Max;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
SetMPVolume(MediaPlayer1, TrackBar1.Position);
TrackBar2.Position := GetMPVolume(MediaPlayer1);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
with MediaPlayer1 do
begin
FileName := 'E:\\MP3z\\Metallica\\Diverse\\(11) The More I See.mp3';
Open;
Play;
end;
end;
end.
DiZpel