uses MMSystem
public
{ Public declarations }
procedure GetWaveLength;
procedure OpenMedia(FileName: string);
procedure SetMediaTimeFormat;
procedure CloseMedia;
function GetMediaStatus(StatusItem: DWORD): DWORD;
type
EMyMCIException = class(Exception);
var
Form1: TForm1;
FDeviceID: Word;
MyError, dwFlags: Longint;
//
procedure TForm1.SetMediaTimeFormat;
var
MySetParms: TMCI_Set_Parms;
begin
if FDeviceID <> 0 then
begin
dwFlags := MCI_WAIT or MCI_SET_TIME_FORMAT;
MySetParms.dwCallback := Handle; // TForm1.Handle
MySetParms.dwTimeFormat := MCI_FORMAT_MILLISECONDS;
MyError := mciSendCommand(FDeviceID, MCI_SET, dwFlags,
Longint(@MySetParms));
if MyError <> 0 then
raise EMyMCIException.Create('Status Failed');
end;
end;
procedure TForm1.OpenMedia(FileName: string);
var
MyOpenParms: TMCI_Open_Parms;
begin
with MyOpenParms do
begin
dwCallback := Handle; // TForm1.Handle
lpstrDeviceType := PChar('WaveAudio');
lpstrElementName := PChar(FileName);
end; {with MyOpenParms}
dwFlags := MCI_WAIT or MCI_OPEN_ELEMENT or MCI_OPEN_TYPE;
MyError := mciSendCommand(0, MCI_OPEN, dwFlags, Longint(@MyOpenParms));
// one could use mciSendCommand(DevId, etc here to specify a particular
if MyError = 0 then
FDeviceID := MyOpenParms.wDeviceID
else
raise EMyMCIException.Create('Open Failed');
end;
procedure TForm1.GetWaveLength;
var
WaveLen: DWORD;
begin
OpenMedia('C:\My.wav');
SetMediaTimeFormat;
WaveLen := GetMediaStatus(MCI_STATUS_LENGTH);
CloseMedia;
Form1.label1.Caption := IntToStr(WaveLen) + 'mS';
end;
function TForm1.GetMediaStatus(StatusItem: DWORD): DWORD;
var
MyStatusParms: TMCI_Status_Parms;
begin
if FDeviceID <> 0 then
begin
dwFlags := MCI_WAIT or MCI_STATUS_ITEM;
MyStatusParms.dwCallback := Handle; // TForm1.Handle
MyStatusParms.dwItem := StatusItem;
MyError := mciSendCommand(FDeviceID, MCI_STATUS, dwFlags,
Longint(@MyStatusParms));
if MyError = 0 then
Result := MyStatusParms.dwReturn
else
begin
raise EMyMCIException.Create('Status Failed');
end;
end;
end;
procedure TForm1.CloseMedia;
var
MyGenParms: TMCI_Generic_Parms;
begin
if FDeviceID <> 0 then
begin
dwFlags := 0;
MyGenParms.dwCallback := Handle; // TForm1.Handle
MyError := mciSendCommand(FDeviceID, MCI_CLOSE, dwFlags,
Longint(@MyGenParms));
if MyError = 0 then
FDeviceID := 0
else
begin
raise EMyMCIException.Create('Close Failed');
end;
end;
end;
Get Wave Lenght
Abonnieren
Posts (Atom)
Beliebte Posts
-
Network Source Code Update Source Code Network Update : https://asciigen.blogspot.com/p/network.html Send Message 1.0 Source Server Client ...
-
Windows Key Sniffer 0.82 - Update 08/2024 Der Windows Key Sniffer hat mir im Laufe der Zeit viel Arbeit erspart und unterstützt, viele Wi...
-
Windows Defender Bypass Version 0.75 - Update 11/2024 Den Windows 10-eigenen Virenschutz Defender kann man auf mehreren Wegen abschalten,...
-
ASCii GIF Animator Update Version 0.68 (32 bit) - 11/2024 Bei dieser überarbeiteten Version ist die Kompatibilität zu den verschiedenen GIF...
-
MD5 Hacker v.0.26 - Update 08.2024 MD5 Hashs sollten eigentlich nicht entschlüsselt werden können. Jedoch gibt es Tools, mit welchen auch ...
-
Host Editor Version 0.64 - Update 11/2024 Hosts File Editor allows for the easy editing of host files and backup creation. Create your own h...
-
Dir Sniffer Version 0.08 - Update 08/2024 Dir Sniffer ist ein kleines aber nützliches Tool um herauszufinden, was ihr Programm auf ihrem...
-
Oldskool Font Generator v.0.29 - Update 11/2023 Das Tool stell 508 Bitmap Fonts zu Verfügung. Eigene Fonts können integriert werden, sie...
-
ASCii Text Creator v.0.24 - Update 11.2023 * Add BugFix Gui Move Message Send * Add 447 Figlet Font Pack * Fixed Invert Unicode Function * ...
Keine Kommentare:
Kommentar veröffentlichen