diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
commit | 513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch) | |
tree | 10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/extra/sformat.h | |
parent | 95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff) | |
download | rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip |
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/sformat.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/extra/sformat.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/sformat.h b/apps/plugins/pdbox/PDa/extra/sformat.h new file mode 100644 index 0000000000..b75ef98c9a --- /dev/null +++ b/apps/plugins/pdbox/PDa/extra/sformat.h | |||
@@ -0,0 +1,110 @@ | |||
1 | |||
2 | #ifndef SFORMAT_H__ | ||
3 | #define SFORMAT_H__ | ||
4 | |||
5 | typedef unsigned short uint16; | ||
6 | typedef unsigned long uint32; | ||
7 | |||
8 | #define FORMAT_WAVE 0 | ||
9 | #define FORMAT_AIFF 1 | ||
10 | #define FORMAT_NEXT 2 | ||
11 | |||
12 | /* the NeXTStep sound header structure; can be big or little endian */ | ||
13 | |||
14 | typedef struct _nextstep | ||
15 | { | ||
16 | char ns_fileid[4]; /* magic number '.snd' if file is big-endian */ | ||
17 | uint32 ns_onset; /* byte offset of first sample */ | ||
18 | uint32 ns_length; /* length of sound in bytes */ | ||
19 | uint32 ns_format; /* format; see below */ | ||
20 | uint32 ns_sr; /* sample rate */ | ||
21 | uint32 ns_nchans; /* number of channels */ | ||
22 | char ns_info[4]; /* comment */ | ||
23 | } t_nextstep; | ||
24 | |||
25 | #define NS_FORMAT_LINEAR_16 3 | ||
26 | #define NS_FORMAT_LINEAR_24 4 | ||
27 | #define NS_FORMAT_FLOAT 6 | ||
28 | #define SCALE (1./(1024. * 1024. * 1024. * 2.)) | ||
29 | |||
30 | /* the WAVE header. All Wave files are little endian. We assume | ||
31 | the "fmt" chunk comes first which is usually the case but perhaps not | ||
32 | always; same for AIFF and the "COMM" chunk. */ | ||
33 | |||
34 | typedef unsigned word; | ||
35 | typedef unsigned long dword; | ||
36 | |||
37 | typedef struct _wave | ||
38 | { | ||
39 | char w_fileid[4]; /* chunk id 'RIFF' */ | ||
40 | uint32 w_chunksize; /* chunk size */ | ||
41 | char w_waveid[4]; /* wave chunk id 'WAVE' */ | ||
42 | char w_fmtid[4]; /* format chunk id 'fmt ' */ | ||
43 | uint32 w_fmtchunksize; /* format chunk size */ | ||
44 | uint16 w_fmttag; /* format tag, 1 for PCM */ | ||
45 | uint16 w_nchannels; /* number of channels */ | ||
46 | uint32 w_samplespersec; /* sample rate in hz */ | ||
47 | uint32 w_navgbytespersec; /* average bytes per second */ | ||
48 | uint16 w_nblockalign; /* number of bytes per sample */ | ||
49 | uint16 w_nbitspersample; /* number of bits in a sample */ | ||
50 | char w_datachunkid[4]; /* data chunk id 'data' */ | ||
51 | uint32 w_datachunksize; /* length of data chunk */ | ||
52 | } t_wave; | ||
53 | |||
54 | |||
55 | #endif | ||
56 | |||
57 | #ifndef SFORMAT_H__ | ||
58 | #define SFORMAT_H__ | ||
59 | |||
60 | typedef unsigned short uint16; | ||
61 | typedef unsigned long uint32; | ||
62 | |||
63 | #define FORMAT_WAVE 0 | ||
64 | #define FORMAT_AIFF 1 | ||
65 | #define FORMAT_NEXT 2 | ||
66 | |||
67 | /* the NeXTStep sound header structure; can be big or little endian */ | ||
68 | |||
69 | typedef struct _nextstep | ||
70 | { | ||
71 | char ns_fileid[4]; /* magic number '.snd' if file is big-endian */ | ||
72 | uint32 ns_onset; /* byte offset of first sample */ | ||
73 | uint32 ns_length; /* length of sound in bytes */ | ||
74 | uint32 ns_format; /* format; see below */ | ||
75 | uint32 ns_sr; /* sample rate */ | ||
76 | uint32 ns_nchans; /* number of channels */ | ||
77 | char ns_info[4]; /* comment */ | ||
78 | } t_nextstep; | ||
79 | |||
80 | #define NS_FORMAT_LINEAR_16 3 | ||
81 | #define NS_FORMAT_LINEAR_24 4 | ||
82 | #define NS_FORMAT_FLOAT 6 | ||
83 | #define SCALE (1./(1024. * 1024. * 1024. * 2.)) | ||
84 | |||
85 | /* the WAVE header. All Wave files are little endian. We assume | ||
86 | the "fmt" chunk comes first which is usually the case but perhaps not | ||
87 | always; same for AIFF and the "COMM" chunk. */ | ||
88 | |||
89 | typedef unsigned word; | ||
90 | typedef unsigned long dword; | ||
91 | |||
92 | typedef struct _wave | ||
93 | { | ||
94 | char w_fileid[4]; /* chunk id 'RIFF' */ | ||
95 | uint32 w_chunksize; /* chunk size */ | ||
96 | char w_waveid[4]; /* wave chunk id 'WAVE' */ | ||
97 | char w_fmtid[4]; /* format chunk id 'fmt ' */ | ||
98 | uint32 w_fmtchunksize; /* format chunk size */ | ||
99 | uint16 w_fmttag; /* format tag, 1 for PCM */ | ||
100 | uint16 w_nchannels; /* number of channels */ | ||
101 | uint32 w_samplespersec; /* sample rate in hz */ | ||
102 | uint32 w_navgbytespersec; /* average bytes per second */ | ||
103 | uint16 w_nblockalign; /* number of bytes per sample */ | ||
104 | uint16 w_nbitspersample; /* number of bits in a sample */ | ||
105 | char w_datachunkid[4]; /* data chunk id 'data' */ | ||
106 | uint32 w_datachunksize; /* length of data chunk */ | ||
107 | } t_wave; | ||
108 | |||
109 | |||
110 | #endif | ||