const
dt = 'D:\win.mid';
var
ID: integer;
procedure SetTempo(Value: Integer);
var
Flags: integer;
SeqParm: tagMCI_SEQ_SET_PARMS;
begin
zeromemory(@SeqParm, sizeof(SeqParm));
SeqParm.dwTempo := Value;
Flags := MCI_SEQ_SET_TEMPO;
mciSendCommand(ID, MCI_SET, Flags, Longint(@SeqParm));
end;
procedure SndPlay(const Datei: string);
var
op: TMCI_Open_Parms;
begin
zeromemory(@op, sizeof(op));
op.lpstrElementName := PChar(Datei);
mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT, integer(@op));
ID := op.wDeviceID;
mciSendCommand(ID, MCI_PLAY, MCI_NOTIFY, integer(@op));
end;
// Abspielen
procedure TForm1.Button14Click(Sender: TObject);
begin
SndPlay(dt);
end;
// Tempo ändern
procedure TForm1.Button15Click(Sender: TObject);
begin
SetTempo(250);
end;
// Sound stoppen
procedure TForm1.Button16Click(Sender: TObject);
begin
mciSendCommand(ID, MCI_CLOSE, 0, 0);
end;