gosu 0.8.0.pre3 → 0.8.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Buttons.hpp +13 -11
  3. data/{linux → ext/gosu}/extconf.rb +25 -47
  4. data/{GosuImpl/RubyGosu_wrap.cxx → ext/gosu/gosu_wrap.cxx} +3 -2
  5. data/{GosuImpl/RubyGosu_wrap.h → ext/gosu/gosu_wrap.h} +0 -0
  6. data/lib/gosu.rb +6 -7
  7. data/lib/gosu/zen.rb +12 -0
  8. data/{GosuImpl → src}/Audio/ALChannelManagement.hpp +0 -0
  9. data/{GosuImpl → src}/Audio/AudioFile.hpp +0 -0
  10. data/{GosuImpl → src}/Audio/AudioOpenAL.cpp +0 -0
  11. data/{GosuImpl → src}/Audio/AudioOpenAL.mm +0 -0
  12. data/{GosuImpl → src}/Audio/AudioToolboxFile.hpp +0 -0
  13. data/{GosuImpl → src}/Audio/OggFile.hpp +0 -0
  14. data/{GosuImpl → src}/Audio/SndFile.hpp +0 -0
  15. data/{GosuImpl/Graphics → src/Bitmap}/Bitmap.cpp +2 -0
  16. data/{GosuImpl/Graphics → src/Bitmap}/BitmapApple.mm +0 -0
  17. data/{GosuImpl/Graphics → src/Bitmap}/BitmapBMP.cpp +0 -0
  18. data/{GosuImpl/Graphics → src/Bitmap}/BitmapColorKey.cpp +0 -0
  19. data/{GosuImpl/Graphics → src/Bitmap}/BitmapFreeImage.cpp +0 -0
  20. data/{GosuImpl/Graphics → src/Bitmap}/BitmapGDIplus.cpp +0 -0
  21. data/{GosuImpl/Graphics → src/Bitmap}/BitmapUtils.cpp +0 -0
  22. data/{GosuImpl → src}/DirectoriesMac.mm +0 -0
  23. data/{GosuImpl → src}/DirectoriesTouch.mm +0 -0
  24. data/{GosuImpl → src}/DirectoriesUnix.cpp +0 -0
  25. data/{GosuImpl → src}/DirectoriesWin.cpp +0 -0
  26. data/{GosuImpl → src}/FileUnix.cpp +0 -0
  27. data/{GosuImpl → src}/FileWin.cpp +0 -0
  28. data/{GosuImpl/Graphics → src}/GosuView.hpp +0 -0
  29. data/{GosuImpl/Graphics → src}/GosuView.mm +0 -0
  30. data/{GosuImpl → src}/Graphics/BlockAllocator.cpp +0 -0
  31. data/{GosuImpl → src}/Graphics/BlockAllocator.hpp +0 -0
  32. data/{GosuImpl → src}/Graphics/ClipRectStack.hpp +0 -0
  33. data/{GosuImpl → src}/Graphics/Color.cpp +0 -0
  34. data/{GosuImpl → src}/Graphics/Common.hpp +0 -0
  35. data/{GosuImpl → src}/Graphics/DrawOp.hpp +0 -0
  36. data/{GosuImpl → src}/Graphics/DrawOpQueue.hpp +0 -0
  37. data/{GosuImpl → src}/Graphics/Graphics.cpp +0 -0
  38. data/{GosuImpl → src}/Graphics/Image.cpp +0 -0
  39. data/{GosuImpl → src}/Graphics/LargeImageData.cpp +0 -0
  40. data/{GosuImpl → src}/Graphics/LargeImageData.hpp +0 -0
  41. data/{GosuImpl → src}/Graphics/Macro.hpp +0 -0
  42. data/{GosuImpl → src}/Graphics/RenderState.hpp +0 -0
  43. data/{GosuImpl → src}/Graphics/TexChunk.cpp +0 -0
  44. data/{GosuImpl → src}/Graphics/TexChunk.hpp +0 -0
  45. data/{GosuImpl → src}/Graphics/Texture.cpp +0 -0
  46. data/{GosuImpl → src}/Graphics/Texture.hpp +0 -0
  47. data/{GosuImpl → src}/Graphics/Transform.cpp +0 -0
  48. data/{GosuImpl → src}/Graphics/TransformStack.hpp +0 -0
  49. data/{GosuImpl → src}/IO.cpp +0 -0
  50. data/{GosuImpl → src}/Iconv.hpp +0 -0
  51. data/{GosuImpl → src}/Input/AccelerometerReader.hpp +0 -0
  52. data/{GosuImpl → src}/Input/AccelerometerReader.mm +0 -0
  53. data/{GosuImpl → src/Input}/Input.cpp +0 -0
  54. data/{GosuImpl → src/Input}/InputTouch.mm +0 -0
  55. data/{GosuImpl → src/Input}/TextInput.cpp +0 -0
  56. data/{GosuImpl → src/Input}/TextInputMac.mm +0 -0
  57. data/{GosuImpl → src}/Inspection.cpp +0 -0
  58. data/{GosuImpl → src}/MacUtility.hpp +0 -0
  59. data/{GosuImpl → src}/Math.cpp +0 -0
  60. data/{GosuImpl → src}/Sockets/CommSocket.cpp +0 -0
  61. data/{GosuImpl → src}/Sockets/ListenerSocket.cpp +0 -0
  62. data/{GosuImpl → src}/Sockets/MessageSocket.cpp +0 -0
  63. data/{GosuImpl → src}/Sockets/Socket.cpp +0 -0
  64. data/{GosuImpl → src}/Sockets/Socket.hpp +0 -0
  65. data/{GosuImpl/Graphics → src/Text}/Font.cpp +1 -1
  66. data/{GosuImpl/Graphics → src/Text}/FormattedString.hpp +0 -0
  67. data/{GosuImpl/Graphics → src/Text}/Text.cpp +1 -1
  68. data/{GosuImpl/Graphics/TextTouch.mm → src/Text/TextApple.mm} +0 -0
  69. data/{GosuImpl/Graphics → src/Text}/TextMac.cpp +1 -1
  70. data/{GosuImpl/Graphics → src/Text}/TextTTFWin.cpp +0 -0
  71. data/{GosuImpl/Graphics → src/Text}/TextUnix.cpp +0 -0
  72. data/{GosuImpl/Graphics → src/Text}/TextWin.cpp +0 -0
  73. data/{GosuImpl → src}/TimingApple.cpp +0 -0
  74. data/{GosuImpl → src}/TimingUnix.cpp +0 -0
  75. data/{GosuImpl → src}/TimingWin.cpp +0 -0
  76. data/{GosuImpl → src}/Utility.cpp +0 -0
  77. data/{GosuImpl → src}/UtilityApple.mm +0 -0
  78. data/{GosuImpl → src}/UtilityWin.cpp +0 -0
  79. data/{GosuImpl → src}/WinMain.cpp +0 -0
  80. data/{GosuImpl → src}/WinUtility.cpp +0 -0
  81. data/{GosuImpl → src}/Window.cpp +0 -0
  82. data/{GosuImpl → src}/WindowTouch.mm +0 -0
  83. data/{GosuImpl → src}/X11vroot.h +0 -0
  84. metadata +97 -193
  85. data/.yardopts +0 -1
  86. data/COPYING +0 -29
  87. data/GosuImpl/InputMac.mm +0 -733
  88. data/GosuImpl/InputWin.cpp +0 -483
  89. data/GosuImpl/InputX.cpp +0 -243
  90. data/GosuImpl/RubyGosu.swg +0 -821
  91. data/GosuImpl/RubyGosu_SWIG_GC_PATCH.patch +0 -126
  92. data/GosuImpl/RubyGosu_SWIG_RENAME_PATCH.patch +0 -62
  93. data/GosuImpl/TextInputWin.cpp +0 -211
  94. data/GosuImpl/TextInputX.cpp +0 -217
  95. data/GosuImpl/WindowWin.cpp +0 -534
  96. data/GosuImpl/WindowX.cpp +0 -458
  97. data/README.txt +0 -25
  98. data/dependencies/libogg/AUTHORS +0 -4
  99. data/dependencies/libogg/CHANGES +0 -70
  100. data/dependencies/libogg/COPYING +0 -28
  101. data/dependencies/libogg/include/ogg/ogg.h +0 -209
  102. data/dependencies/libogg/include/ogg/os_types.h +0 -147
  103. data/dependencies/libogg/src/bitwise.c +0 -857
  104. data/dependencies/libogg/src/framing.c +0 -2089
  105. data/dependencies/libvorbis/AUTHORS +0 -3
  106. data/dependencies/libvorbis/CHANGES +0 -126
  107. data/dependencies/libvorbis/COPYING +0 -28
  108. data/dependencies/libvorbis/include/vorbis/codec.h +0 -243
  109. data/dependencies/libvorbis/include/vorbis/vorbisenc.h +0 -436
  110. data/dependencies/libvorbis/include/vorbis/vorbisfile.h +0 -206
  111. data/dependencies/libvorbis/lib/analysis.c +0 -120
  112. data/dependencies/libvorbis/lib/backends.h +0 -144
  113. data/dependencies/libvorbis/lib/barkmel.c +0 -64
  114. data/dependencies/libvorbis/lib/bitrate.c +0 -253
  115. data/dependencies/libvorbis/lib/bitrate.h +0 -59
  116. data/dependencies/libvorbis/lib/block.c +0 -1046
  117. data/dependencies/libvorbis/lib/books/coupled/res_books_51.h +0 -12257
  118. data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +0 -15783
  119. data/dependencies/libvorbis/lib/books/floor/floor_books.h +0 -1547
  120. data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +0 -7758
  121. data/dependencies/libvorbis/lib/codebook.c +0 -479
  122. data/dependencies/libvorbis/lib/codebook.h +0 -119
  123. data/dependencies/libvorbis/lib/codec_internal.h +0 -167
  124. data/dependencies/libvorbis/lib/envelope.c +0 -375
  125. data/dependencies/libvorbis/lib/envelope.h +0 -80
  126. data/dependencies/libvorbis/lib/floor0.c +0 -222
  127. data/dependencies/libvorbis/lib/floor1.c +0 -1099
  128. data/dependencies/libvorbis/lib/highlevel.h +0 -58
  129. data/dependencies/libvorbis/lib/info.c +0 -664
  130. data/dependencies/libvorbis/lib/lookup.c +0 -94
  131. data/dependencies/libvorbis/lib/lookup.h +0 -32
  132. data/dependencies/libvorbis/lib/lookup_data.h +0 -192
  133. data/dependencies/libvorbis/lib/lpc.c +0 -160
  134. data/dependencies/libvorbis/lib/lpc.h +0 -29
  135. data/dependencies/libvorbis/lib/lsp.c +0 -456
  136. data/dependencies/libvorbis/lib/lsp.h +0 -28
  137. data/dependencies/libvorbis/lib/mapping0.c +0 -816
  138. data/dependencies/libvorbis/lib/masking.h +0 -785
  139. data/dependencies/libvorbis/lib/mdct.c +0 -563
  140. data/dependencies/libvorbis/lib/mdct.h +0 -71
  141. data/dependencies/libvorbis/lib/misc.h +0 -57
  142. data/dependencies/libvorbis/lib/modes/floor_all.h +0 -260
  143. data/dependencies/libvorbis/lib/modes/psych_11.h +0 -51
  144. data/dependencies/libvorbis/lib/modes/psych_16.h +0 -133
  145. data/dependencies/libvorbis/lib/modes/psych_44.h +0 -642
  146. data/dependencies/libvorbis/lib/modes/psych_8.h +0 -101
  147. data/dependencies/libvorbis/lib/modes/residue_16.h +0 -163
  148. data/dependencies/libvorbis/lib/modes/residue_44.h +0 -292
  149. data/dependencies/libvorbis/lib/modes/residue_44p51.h +0 -451
  150. data/dependencies/libvorbis/lib/modes/residue_44u.h +0 -318
  151. data/dependencies/libvorbis/lib/modes/residue_8.h +0 -109
  152. data/dependencies/libvorbis/lib/modes/setup_11.h +0 -143
  153. data/dependencies/libvorbis/lib/modes/setup_16.h +0 -153
  154. data/dependencies/libvorbis/lib/modes/setup_22.h +0 -128
  155. data/dependencies/libvorbis/lib/modes/setup_32.h +0 -132
  156. data/dependencies/libvorbis/lib/modes/setup_44.h +0 -117
  157. data/dependencies/libvorbis/lib/modes/setup_44p51.h +0 -74
  158. data/dependencies/libvorbis/lib/modes/setup_44u.h +0 -74
  159. data/dependencies/libvorbis/lib/modes/setup_8.h +0 -149
  160. data/dependencies/libvorbis/lib/modes/setup_X.h +0 -225
  161. data/dependencies/libvorbis/lib/os.h +0 -186
  162. data/dependencies/libvorbis/lib/psy.c +0 -1203
  163. data/dependencies/libvorbis/lib/psy.h +0 -154
  164. data/dependencies/libvorbis/lib/psytune.c +0 -524
  165. data/dependencies/libvorbis/lib/registry.c +0 -45
  166. data/dependencies/libvorbis/lib/registry.h +0 -32
  167. data/dependencies/libvorbis/lib/res0.c +0 -889
  168. data/dependencies/libvorbis/lib/scales.h +0 -90
  169. data/dependencies/libvorbis/lib/sharedbook.c +0 -579
  170. data/dependencies/libvorbis/lib/smallft.c +0 -1255
  171. data/dependencies/libvorbis/lib/smallft.h +0 -34
  172. data/dependencies/libvorbis/lib/synthesis.c +0 -184
  173. data/dependencies/libvorbis/lib/tone.c +0 -54
  174. data/dependencies/libvorbis/lib/vorbisenc.c +0 -1215
  175. data/dependencies/libvorbis/lib/vorbisfile.c +0 -2337
  176. data/dependencies/libvorbis/lib/window.c +0 -2135
  177. data/dependencies/libvorbis/lib/window.h +0 -26
  178. data/dependencies/ogg_vorbis.license +0 -28
  179. data/reference/gosu.rb +0 -1284
@@ -1,206 +0,0 @@
1
- /********************************************************************
2
- * *
3
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
- * *
8
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9
- * by the Xiph.Org Foundation http://www.xiph.org/ *
10
- * *
11
- ********************************************************************
12
-
13
- function: stdio-based convenience library for opening/seeking/decoding
14
- last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #ifndef _OV_FILE_H_
19
- #define _OV_FILE_H_
20
-
21
- #ifdef __cplusplus
22
- extern "C"
23
- {
24
- #endif /* __cplusplus */
25
-
26
- #include <stdio.h>
27
- #include "codec.h"
28
-
29
- /* The function prototypes for the callbacks are basically the same as for
30
- * the stdio functions fread, fseek, fclose, ftell.
31
- * The one difference is that the FILE * arguments have been replaced with
32
- * a void * - this is to be used as a pointer to whatever internal data these
33
- * functions might need. In the stdio case, it's just a FILE * cast to a void *
34
- *
35
- * If you use other functions, check the docs for these functions and return
36
- * the right values. For seek_func(), you *MUST* return -1 if the stream is
37
- * unseekable
38
- */
39
- typedef struct {
40
- size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
41
- int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
42
- int (*close_func) (void *datasource);
43
- long (*tell_func) (void *datasource);
44
- } ov_callbacks;
45
-
46
- #ifndef OV_EXCLUDE_STATIC_CALLBACKS
47
-
48
- /* a few sets of convenient callbacks, especially for use under
49
- * Windows where ov_open_callbacks() should always be used instead of
50
- * ov_open() to avoid problems with incompatible crt.o version linking
51
- * issues. */
52
-
53
- static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
54
- if(f==NULL)return(-1);
55
-
56
- #ifdef __MINGW32__
57
- return fseeko64(f,off,whence);
58
- #elif defined (_WIN32)
59
- return _fseeki64(f,off,whence);
60
- #else
61
- return fseek(f,off,whence);
62
- #endif
63
- }
64
-
65
- /* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
66
- * static data. That means that every file which includes this header
67
- * will get its own copy of these structs whether it uses them or
68
- * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
69
- * These static symbols are essential on platforms such as Windows on
70
- * which several different versions of stdio support may be linked to
71
- * by different DLLs, and we need to be certain we know which one
72
- * we're using (the same one as the main application).
73
- */
74
-
75
- static ov_callbacks OV_CALLBACKS_DEFAULT = {
76
- (size_t (*)(void *, size_t, size_t, void *)) fread,
77
- (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
78
- (int (*)(void *)) fclose,
79
- (long (*)(void *)) ftell
80
- };
81
-
82
- static ov_callbacks OV_CALLBACKS_NOCLOSE = {
83
- (size_t (*)(void *, size_t, size_t, void *)) fread,
84
- (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
85
- (int (*)(void *)) NULL,
86
- (long (*)(void *)) ftell
87
- };
88
-
89
- static ov_callbacks OV_CALLBACKS_STREAMONLY = {
90
- (size_t (*)(void *, size_t, size_t, void *)) fread,
91
- (int (*)(void *, ogg_int64_t, int)) NULL,
92
- (int (*)(void *)) fclose,
93
- (long (*)(void *)) NULL
94
- };
95
-
96
- static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
97
- (size_t (*)(void *, size_t, size_t, void *)) fread,
98
- (int (*)(void *, ogg_int64_t, int)) NULL,
99
- (int (*)(void *)) NULL,
100
- (long (*)(void *)) NULL
101
- };
102
-
103
- #endif
104
-
105
- #define NOTOPEN 0
106
- #define PARTOPEN 1
107
- #define OPENED 2
108
- #define STREAMSET 3
109
- #define INITSET 4
110
-
111
- typedef struct OggVorbis_File {
112
- void *datasource; /* Pointer to a FILE *, etc. */
113
- int seekable;
114
- ogg_int64_t offset;
115
- ogg_int64_t end;
116
- ogg_sync_state oy;
117
-
118
- /* If the FILE handle isn't seekable (eg, a pipe), only the current
119
- stream appears */
120
- int links;
121
- ogg_int64_t *offsets;
122
- ogg_int64_t *dataoffsets;
123
- long *serialnos;
124
- ogg_int64_t *pcmlengths; /* overloaded to maintain binary
125
- compatibility; x2 size, stores both
126
- beginning and end values */
127
- vorbis_info *vi;
128
- vorbis_comment *vc;
129
-
130
- /* Decoding working state local storage */
131
- ogg_int64_t pcm_offset;
132
- int ready_state;
133
- long current_serialno;
134
- int current_link;
135
-
136
- double bittrack;
137
- double samptrack;
138
-
139
- ogg_stream_state os; /* take physical pages, weld into a logical
140
- stream of packets */
141
- vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
142
- vorbis_block vb; /* local working space for packet->PCM decode */
143
-
144
- ov_callbacks callbacks;
145
-
146
- } OggVorbis_File;
147
-
148
-
149
- extern int ov_clear(OggVorbis_File *vf);
150
- extern int ov_fopen(const char *path,OggVorbis_File *vf);
151
- extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
152
- extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
153
- const char *initial, long ibytes, ov_callbacks callbacks);
154
-
155
- extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
156
- extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
157
- const char *initial, long ibytes, ov_callbacks callbacks);
158
- extern int ov_test_open(OggVorbis_File *vf);
159
-
160
- extern long ov_bitrate(OggVorbis_File *vf,int i);
161
- extern long ov_bitrate_instant(OggVorbis_File *vf);
162
- extern long ov_streams(OggVorbis_File *vf);
163
- extern long ov_seekable(OggVorbis_File *vf);
164
- extern long ov_serialnumber(OggVorbis_File *vf,int i);
165
-
166
- extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
167
- extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
168
- extern double ov_time_total(OggVorbis_File *vf,int i);
169
-
170
- extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
171
- extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
172
- extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
173
- extern int ov_time_seek(OggVorbis_File *vf,double pos);
174
- extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
175
-
176
- extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
177
- extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
178
- extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
179
- extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
180
- extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
181
-
182
- extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
183
- extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
184
- extern double ov_time_tell(OggVorbis_File *vf);
185
-
186
- extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
187
- extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
188
-
189
- extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
190
- int *bitstream);
191
- extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
192
- int bigendianp,int word,int sgned,int *bitstream,
193
- void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
194
- extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
195
- int bigendianp,int word,int sgned,int *bitstream);
196
- extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
197
-
198
- extern int ov_halfrate(OggVorbis_File *vf,int flag);
199
- extern int ov_halfrate_p(OggVorbis_File *vf);
200
-
201
- #ifdef __cplusplus
202
- }
203
- #endif /* __cplusplus */
204
-
205
- #endif
206
-
@@ -1,120 +0,0 @@
1
- /********************************************************************
2
- * *
3
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
- * *
8
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9
- * by the Xiph.Org Foundation http://www.xiph.org/ *
10
- * *
11
- ********************************************************************
12
-
13
- function: single-block PCM analysis mode dispatch
14
- last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
15
-
16
- ********************************************************************/
17
-
18
- #include <stdio.h>
19
- #include <string.h>
20
- #include <math.h>
21
- #include <ogg/ogg.h>
22
- #include "vorbis/codec.h"
23
- #include "codec_internal.h"
24
- #include "registry.h"
25
- #include "scales.h"
26
- #include "os.h"
27
- #include "misc.h"
28
-
29
- /* decides between modes, dispatches to the appropriate mapping. */
30
- int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
31
- int ret,i;
32
- vorbis_block_internal *vbi=vb->internal;
33
-
34
- vb->glue_bits=0;
35
- vb->time_bits=0;
36
- vb->floor_bits=0;
37
- vb->res_bits=0;
38
-
39
- /* first things first. Make sure encode is ready */
40
- for(i=0;i<PACKETBLOBS;i++)
41
- oggpack_reset(vbi->packetblob[i]);
42
-
43
- /* we only have one mapping type (0), and we let the mapping code
44
- itself figure out what soft mode to use. This allows easier
45
- bitrate management */
46
-
47
- if((ret=_mapping_P[0]->forward(vb)))
48
- return(ret);
49
-
50
- if(op){
51
- if(vorbis_bitrate_managed(vb))
52
- /* The app is using a bitmanaged mode... but not using the
53
- bitrate management interface. */
54
- return(OV_EINVAL);
55
-
56
- op->packet=oggpack_get_buffer(&vb->opb);
57
- op->bytes=oggpack_bytes(&vb->opb);
58
- op->b_o_s=0;
59
- op->e_o_s=vb->eofflag;
60
- op->granulepos=vb->granulepos;
61
- op->packetno=vb->sequence; /* for sake of completeness */
62
- }
63
- return(0);
64
- }
65
-
66
- #ifdef ANALYSIS
67
- int analysis_noisy=1;
68
-
69
- /* there was no great place to put this.... */
70
- void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
71
- int j;
72
- FILE *of;
73
- char buffer[80];
74
-
75
- sprintf(buffer,"%s_%d.m",base,i);
76
- of=fopen(buffer,"w");
77
-
78
- if(!of)perror("failed to open data dump file");
79
-
80
- for(j=0;j<n;j++){
81
- if(bark){
82
- float b=toBARK((4000.f*j/n)+.25);
83
- fprintf(of,"%f ",b);
84
- }else
85
- if(off!=0)
86
- fprintf(of,"%f ",(double)(j+off)/8000.);
87
- else
88
- fprintf(of,"%f ",(double)j);
89
-
90
- if(dB){
91
- float val;
92
- if(v[j]==0.)
93
- val=-140.;
94
- else
95
- val=todB(v+j);
96
- fprintf(of,"%f\n",val);
97
- }else{
98
- fprintf(of,"%f\n",v[j]);
99
- }
100
- }
101
- fclose(of);
102
- }
103
-
104
- void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
105
- ogg_int64_t off){
106
- if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
107
- }
108
-
109
- #endif
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
@@ -1,144 +0,0 @@
1
- /********************************************************************
2
- * *
3
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
- * *
8
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9
- * by the Xiph.Org Foundation http://www.xiph.org/ *
10
- * *
11
- ********************************************************************
12
-
13
- function: libvorbis backend and mapping structures; needed for
14
- static mode headers
15
- last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
16
-
17
- ********************************************************************/
18
-
19
- /* this is exposed up here because we need it for static modes.
20
- Lookups for each backend aren't exposed because there's no reason
21
- to do so */
22
-
23
- #ifndef _vorbis_backend_h_
24
- #define _vorbis_backend_h_
25
-
26
- #include "codec_internal.h"
27
-
28
- /* this would all be simpler/shorter with templates, but.... */
29
- /* Floor backend generic *****************************************/
30
- typedef struct{
31
- void (*pack) (vorbis_info_floor *,oggpack_buffer *);
32
- vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
33
- vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_floor *);
34
- void (*free_info) (vorbis_info_floor *);
35
- void (*free_look) (vorbis_look_floor *);
36
- void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
37
- int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
38
- void *buffer,float *);
39
- } vorbis_func_floor;
40
-
41
- typedef struct{
42
- int order;
43
- long rate;
44
- long barkmap;
45
-
46
- int ampbits;
47
- int ampdB;
48
-
49
- int numbooks; /* <= 16 */
50
- int books[16];
51
-
52
- float lessthan; /* encode-only config setting hacks for libvorbis */
53
- float greaterthan; /* encode-only config setting hacks for libvorbis */
54
-
55
- } vorbis_info_floor0;
56
-
57
-
58
- #define VIF_POSIT 63
59
- #define VIF_CLASS 16
60
- #define VIF_PARTS 31
61
- typedef struct{
62
- int partitions; /* 0 to 31 */
63
- int partitionclass[VIF_PARTS]; /* 0 to 15 */
64
-
65
- int class_dim[VIF_CLASS]; /* 1 to 8 */
66
- int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
67
- int class_book[VIF_CLASS]; /* subs ^ dim entries */
68
- int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
69
-
70
-
71
- int mult; /* 1 2 3 or 4 */
72
- int postlist[VIF_POSIT+2]; /* first two implicit */
73
-
74
-
75
- /* encode side analysis parameters */
76
- float maxover;
77
- float maxunder;
78
- float maxerr;
79
-
80
- float twofitweight;
81
- float twofitatten;
82
-
83
- int n;
84
-
85
- } vorbis_info_floor1;
86
-
87
- /* Residue backend generic *****************************************/
88
- typedef struct{
89
- void (*pack) (vorbis_info_residue *,oggpack_buffer *);
90
- vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
91
- vorbis_look_residue *(*look) (vorbis_dsp_state *,
92
- vorbis_info_residue *);
93
- void (*free_info) (vorbis_info_residue *);
94
- void (*free_look) (vorbis_look_residue *);
95
- long **(*class) (struct vorbis_block *,vorbis_look_residue *,
96
- int **,int *,int);
97
- int (*forward) (oggpack_buffer *,struct vorbis_block *,
98
- vorbis_look_residue *,
99
- int **,int *,int,long **,int);
100
- int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
101
- float **,int *,int);
102
- } vorbis_func_residue;
103
-
104
- typedef struct vorbis_info_residue0{
105
- /* block-partitioned VQ coded straight residue */
106
- long begin;
107
- long end;
108
-
109
- /* first stage (lossless partitioning) */
110
- int grouping; /* group n vectors per partition */
111
- int partitions; /* possible codebooks for a partition */
112
- int partvals; /* partitions ^ groupbook dim */
113
- int groupbook; /* huffbook for partitioning */
114
- int secondstages[64]; /* expanded out to pointers in lookup */
115
- int booklist[512]; /* list of second stage books */
116
-
117
- const int classmetric1[64];
118
- const int classmetric2[64];
119
- } vorbis_info_residue0;
120
-
121
- /* Mapping backend generic *****************************************/
122
- typedef struct{
123
- void (*pack) (vorbis_info *,vorbis_info_mapping *,
124
- oggpack_buffer *);
125
- vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
126
- void (*free_info) (vorbis_info_mapping *);
127
- int (*forward) (struct vorbis_block *vb);
128
- int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *);
129
- } vorbis_func_mapping;
130
-
131
- typedef struct vorbis_info_mapping0{
132
- int submaps; /* <= 16 */
133
- int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
134
-
135
- int floorsubmap[16]; /* [mux] submap to floors */
136
- int residuesubmap[16]; /* [mux] submap to residue */
137
-
138
- int coupling_steps;
139
- int coupling_mag[256];
140
- int coupling_ang[256];
141
-
142
- } vorbis_info_mapping0;
143
-
144
- #endif