Sunday, November 29, 2015

Software suara binatang dengan delphi

PAM (project akhir minggu)  Tombol Suara Binatang 



Senangnya anak - anak dengan suara binatang dan gambar  - gambarnya, saya tahu karena anak - anak saya suka semua. Senang melihat semua tawa tersebut lepas dengan bebasnya.

mari kita lihat tampilan yang kami kerjakan di akhir minggu bersama anak - anak saya :


nah itulah tampilannya simple sebenarnya jika kita lihat, hanya sebuah speedbutton yang gambarnya di load disana dan di tambahkan listing agar memainkan file yang di tuju. hanya dengan beberapa baris saja bisa menyenangkan hati mereka.

mari kita lihat listingnya :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MMSystem, Buttons;

type
  TForm1 = class(TForm)
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    SpeedButton7: TSpeedButton;
    SpeedButton8: TSpeedButton;
    SpeedButton9: TSpeedButton;
    SpeedButton11: TSpeedButton;
    SpeedButton12: TSpeedButton;
    SpeedButton13: TSpeedButton;
    SpeedButton14: TSpeedButton;
    SpeedButton15: TSpeedButton;
    SpeedButton16: TSpeedButton;
    SpeedButton17: TSpeedButton;
    SpeedButton18: TSpeedButton;
    SpeedButton19: TSpeedButton;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton9Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton11Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure SpeedButton12Click(Sender: TObject);
    procedure SpeedButton13Click(Sender: TObject);
    procedure SpeedButton14Click(Sender: TObject);
    procedure SpeedButton15Click(Sender: TObject);
    procedure SpeedButton16Click(Sender: TObject);
    procedure SpeedButton17Click(Sender: TObject);
    procedure SpeedButton18Click(Sender: TObject);
    procedure SpeedButton19Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
sndPlaySound('frogs.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
sndPlaySound('elephant.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
sndPlaySound('frog.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
  sndPlaySound('cat_y.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
  sndPlaySound('monkey1.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton9Click(Sender: TObject);
begin
  sndPlaySound('monkey2.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
  sndPlaySound('monkey3.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
  sndPlaySound('horse.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton11Click(Sender: TObject);
begin
  sndPlaySound('bird.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
  sndPlaySound('wolf2.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton12Click(Sender: TObject);
begin
    sndPlaySound('dog_bark4.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton13Click(Sender: TObject);
begin
  sndPlaySound('dolphin.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton14Click(Sender: TObject);
begin
  sndPlaySound('crickets.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton15Click(Sender: TObject);
begin
  sndPlaySound('goat2.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton16Click(Sender: TObject);
begin
    sndPlaySound('lion214.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton17Click(Sender: TObject);
begin
    sndPlaySound('pig3.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton18Click(Sender: TObject);
begin
    sndPlaySound('rooster.wav', SND_NODEFAULT Or SND_ASYNC);
end;

procedure TForm1.SpeedButton19Click(Sender: TObject);
begin
    sndPlaySound('owl.wav', SND_NODEFAULT Or SND_ASYNC);
end;

end.


Nah seperti yang di lihat sangat sederhana, hanya dengan menambahkan uses mmsystem  dan perintah  sndPlaySound('nama file wav', SND_NODEFAULT Or SND_ASYNC);

maka project ini sudah siap, jika ada adik atau anak yang sudah cukup umur bisa di ajarkan penulisan listing program ini dan merasakan sendiri membuat program sederhana.

tidak semua program harus rumit dan hebat kadang sederhana tapi bermanfaat akan lebih berguna, silahkan jika berminat listingnya bisa di download di sini




No comments:

Post a Comment