From 864081102a5f252415f41950b3039a896b4ae9c5 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 8 Oct 2012 18:43:29 +0000 Subject: Awkwars's plugins - welcome to our trunk git-svn-id: http://svn.miranda-ng.org/main/trunk@1822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Watrack/formats/fmt_tta.pas | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 plugins/Watrack/formats/fmt_tta.pas (limited to 'plugins/Watrack/formats/fmt_tta.pas') diff --git a/plugins/Watrack/formats/fmt_tta.pas b/plugins/Watrack/formats/fmt_tta.pas new file mode 100644 index 0000000000..c13b329fe2 --- /dev/null +++ b/plugins/Watrack/formats/fmt_tta.pas @@ -0,0 +1,65 @@ +{TTA file} +unit fmt_TTA; +{$include compilers.inc} + +interface +uses wat_api; + +function ReadTTA(var Info:tSongInfo):boolean; cdecl; + +implementation +uses windows,common,io,tags,srv_format; + +const + TTA1_SIGN = $31415454; +type + tTTAHeader = packed record + id :dword; + format :word; + channels :word; + bitspersample:word; + samplerate :dword; + datalength :dword; + crc32 :dword; + end; + +function ReadTTA(var Info:tSongInfo):boolean; cdecl; +var + f:THANDLE; + hdr:tTTAHeader; +begin + result:=false; + f:=Reset(Info.mfile); + if f=THANDLE(INVALID_HANDLE_VALUE) then + exit; + ReadID3v2(f,Info); + BlockRead(f,hdr,SizeOf(tTTAHeader)); + if hdr.id<>TTA1_SIGN then + exit; + Info.channels:=hdr.channels; + Info.khz :=hdr.samplerate; + Info.kbps :=hdr.bitspersample div 1000; //!! + if hdr.samplerate<>0 then + Info.total:=hdr.datalength div hdr.samplerate; + ReadID3v1(f,Info); + CloseHandle(f); + result:=true; +end; + +var + LocalFormatLink:twFormat; + +procedure InitLink; +begin + LocalFormatLink.Next:=FormatLink; + + LocalFormatLink.This.proc :=@ReadTTA; + LocalFormatLink.This.ext :='TTA'; + LocalFormatLink.This.flags:=0; + + FormatLink:=@LocalFormatLink; +end; + +initialization + InitLink; +end. -- cgit v1.2.3