Setelah anda mengetahui bagaimana menjalankan file audio standard seperti Winamp, Windows Media Player dan lain - lain, maka pada kali ini saya akan membuat tutorial membuat pemutar audio sederhana menggunakan delphi. lebih lengkapnya anda bisa melihat contoh di bawah ini :
- Buka Delphi
- Buat project baru
- Tambahkan komponen dibawah ini kedalam lembar project :
No
|
Nama Komponen
|
Nama Palette
|
Jumlah
|
1
|
TLabel
|
Standard
|
3
|
2
|
TGroupBox
|
Standard
|
1
|
3
|
TProgressBar
|
Win32
|
1
|
4
|
TMediaPlayer
|
System
|
1
|
5
|
TOpenDialog
|
Dialogs
|
1
|
6
|
TTimer
|
System
|
1
|
7
|
TButton
|
Standard
|
1
|
- Setting Komponen seperti dibawah ini :
No
|
Nama Komponen
|
Nama Properties
|
Value
|
1
|
Label1
|
Align
Alignment
Captiion
Font->Size
|
alTop
taCenter
Aplikasi Audio Player
12
|
2
|
Label2
|
Align
Alignment
Caption
|
alTop
taCenter
Dibuat Oleh : Abu
|
3
|
GroupBox1
|
Align
Caption
|
alTop
Informasi File Audio
|
4
|
Label3
|
Align
AutoSize
Caption
Name
WordWrap
|
alClient
False
-
lblNamaFile
True
|
5
|
ProgresBar1
|
Align
Name
|
alTop
pbProgress
|
6
|
MediaPlayer1
|
Name
Enabled
|
mpLatih
False
|
7
|
OpenDialog1
|
Name
|
dlgBuka
|
8
|
Button1
|
Caption
Name
Font->Style->fsBold
|
Buka
btBuka
True
|
9
|
Timer1
|
Name
Enabled
Interval
|
tmrLatih
False
100
|
10
|
Form1
|
BorderStyle
BorderIcons->biMaximize
Name
Position
|
bsSingle
False
frmAudio
poScreenCenter
|
- Klik dua kali btBuka lalu isikan kode berikut ini :
procedure TfrmAudio.btBukaClick(Sender: TObject);
begin
if dlgBuka.Execute then
begin
lblNamaFile.Caption := dlgBuka.FileName;
mpLatih.FileName := dlgBuka.FileName;
mpLatih.Open;
pbProgres.Position :=mpLatih.Position;
pbProgres.Max := mpLatih.Length;
mpLatih.Enabled := True;
tmrLatih.Enabled := True;
end;
end;
- Klik dua kali komponen tmrLatih dan isikan kode berikut ini :
procedure TfrmAudio.tmrLatihTimer(Sender: TObject);
begin
pbProgres.Position := mpLatih.Position;
end;
- Tekan tombol F9/Compile
- Selesai, selamat mencoba
0 comments:
Post a Comment