blob: c13b329fe24bccc63894c39df9596d83d3c2801a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.
|