History

very simple amiga mod parser

kemal committed 5 years ago

Commit 1ea45f31 parent f4bd0185 files · +51 −0Browse files

Unified · Split

5 files
  1. README.md +1 −0
  2. mkfile +1 −0
  3. mod.c +46 −0
  4. tags.c +2 −0
  5. tags.h +1 −0
README.md+1−0
@@ -16,6 +16,7 @@ Comparison to id3lib and taglib: · 15 unmodified lines
16| IT | yes | no | ??? |16| IT | yes | no | ??? |
17| XM | yes | no | ??? |17| XM | yes | no | ??? |
18| S3M | yes | no | ??? |18| S3M | yes | no | ??? |
19| MOD | yes | no | ??? |
19| replay gain | yes | no | ??? |20| replay gain | yes | no | ??? |
20| size | tiny | bloated | more bloated |21| size | tiny | bloated | more bloated |
21| license | MIT | LGPL | LGPL/MPL |22| license | MIT | LGPL | LGPL/MPL |
mkfile+1−0
@@ -16,6 +16,7 @@ OFILES=\ · 15 unmodified lines
16 vorbis.$O\16 vorbis.$O\
17 wav.$O\17 wav.$O\
18 xm.$O\18 xm.$O\
19 mod.$O\
19 20
20HFILES=\21HFILES=\
21 /sys/include/tags.h\22 /sys/include/tags.h\
mod.c+46−0
@@ -0,0 +1,46 @@
1#include "tagspriv.h"
2
3/* insane. */
4static char* variants[] =
5{
6 "M.K.",
7 "M!K!",
8 "M&K!",
9 "N.T.",
10 "NSMS",
11 "FLT4",
12 "M\0\0\0",
13 "8\0\0\0",
14 "FEST",
15 "FLT8",
16 "CD81",
17 "OCTA",
18 "OKTA",
19 "16CN",
20 "32CN",
21 nil,
22};
23
24int
25tagmod(Tagctx *ctx)
26{
27 char d[20+1];
28 int i;
29
30 if (ctx->seek(ctx, 1080, 0) != 1080)
31 return -1;
32 if (ctx->read(ctx, d, 4) != 4)
33 return -1;
34 for (i = 0; ; i++)
35 if (variants[i] == nil)
36 return -1;
37 else if (memcmp(d, variants[i], 4) == 0)
38 break;
39 memset(d, 0, sizeof d);
40 if (ctx->seek(ctx, 0, 0) != 0)
41 return -1;
42 if (ctx->read(ctx, d, 20) != 20)
43 return -1;
44 txtcb(ctx, Ttitle, "", d);
45 return 0;
46}
tags.c+2−0
@@ -18,6 +18,7 @@ extern int tags3m(Tagctx *ctx); · 17 unmodified lines
18extern int tagvorbis(Tagctx *ctx);18extern int tagvorbis(Tagctx *ctx);
19extern int tagwav(Tagctx *ctx);19extern int tagwav(Tagctx *ctx);
20extern int tagxm(Tagctx *ctx);20extern int tagxm(Tagctx *ctx);
21extern int tagmod(Tagctx *ctx);
21 22
22static const Getter g[] =23static const Getter g[] =
23{24{
@@ -31,6 +32,7 @@ static const Getter g[] = · 7 unmodified lines
31 {tagit, Fit},32 {tagit, Fit},
32 {tagxm, Fxm},33 {tagxm, Fxm},
33 {tags3m, Fs3m},34 {tags3m, Fs3m},
35 {tagmod, Fmod},
34};36};
35 37
36void38void
tags.h+1−0
@@ -35,6 +35,7 @@ enum · 34 unmodified lines
35 Fit,35 Fit,
36 Fxm,36 Fxm,
37 Fs3m,37 Fs3m,
38 Fmod,
38 39
39 Fmax,40 Fmax,
40};41};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t