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_ofr.pas | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 plugins/Watrack/formats/fmt_ofr.pas (limited to 'plugins/Watrack/formats/fmt_ofr.pas') diff --git a/plugins/Watrack/formats/fmt_ofr.pas b/plugins/Watrack/formats/fmt_ofr.pas new file mode 100644 index 0000000000..73d58b68ff --- /dev/null +++ b/plugins/Watrack/formats/fmt_ofr.pas @@ -0,0 +1,74 @@ +{OFR file} +unit fmt_OFR; +{$include compilers.inc} + +interface +uses wat_api; + +function ReadOFR(var Info:tSongInfo):boolean; cdecl; + +implementation +uses windows,common,io,tags,srv_format; + +type + tMain = packed record + ID :dword; // 'OFR ' + Size :dword; //15 + SamplesLo :dword; + SamplesHi :word; + SampleType :byte; + ChannelsMap:byte; + Samplerate :dword; + Encoder :word; + Compression:byte; + end; + +function ReadOFR(var Info:tSongInfo):boolean; cdecl; +var + f:THANDLE; + Hdr:tMain; + Samples:int64; +begin + result:=false; + f:=Reset(Info.mfile); + if f=THANDLE(INVALID_HANDLE_VALUE) then + exit; + ReadID3v2(f,Info); + BlockRead(f,Hdr,SizeOf(Hdr)); + Samples:=Hdr.SamplesLo+Hdr.SamplesHi*$10000; + Info.channels:=Hdr.ChannelsMap+1; + Info.khz :=Hdr.Samplerate div 1000; + Info.total :=(Samples div Info.channels)*Info.khz; + + ReadAPEv2(f,Info); + ReadID3v1(f,Info); + CloseHandle(f); + result:=true; +end; + +var + LocalFormatLinkOFR, + LocalFormatLinkOFS:twFormat; + +procedure InitLink; +begin + LocalFormatLinkOFR.Next:=FormatLink; + + LocalFormatLinkOFR.This.proc :=@ReadOFR; + LocalFormatLinkOFR.This.ext :='OFR'; + LocalFormatLinkOFR.This.flags:=0; + + FormatLink:=@LocalFormatLinkOFR; + + LocalFormatLinkOFS.Next:=FormatLink; + + LocalFormatLinkOFS.This.proc :=@ReadOFR; + LocalFormatLinkOFS.This.ext :='OFS'; + LocalFormatLinkOFS.This.flags:=0; + + FormatLink:=@LocalFormatLinkOFS; +end; + +initialization + InitLink; +end. -- cgit v1.2.3