unit ddsdtut1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DSound, DDSD, StdCtrls;

type
  TForm1 = class(TForm)
    DDSD1: TDDSD;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private 宣言 }
  public
    { Public 宣言 }
    Wave1:TDDSDWavedata;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin
  DDSD1[0].Play;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  WinDir:Array[1..MAX_PATH] of Char;
begin
  //Windows\mediaにある、わりと誰でも持っている例のWAVEを読む(^^;)
  GetWindowsDirectory(@WinDir,MAX_PATH);
  Wave1:=TDDSDWaveData.Create(DDSD1,StrPas(@WinDir)+'\media\The Microsoft Sound.wav');

  DDSD1[0].WaveData:=Wave1;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Wave1.Free;
end;

end.
