gosu 0.15.2 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +138 -0
  3. data/dependencies/SDL/include/SDL_assert.h +293 -0
  4. data/dependencies/SDL/include/SDL_atomic.h +295 -0
  5. data/dependencies/SDL/include/SDL_audio.h +859 -0
  6. data/dependencies/SDL/include/SDL_bits.h +121 -0
  7. data/dependencies/SDL/include/SDL_blendmode.h +123 -0
  8. data/dependencies/SDL/include/SDL_clipboard.h +71 -0
  9. data/dependencies/SDL/include/SDL_config.h +55 -0
  10. data/dependencies/SDL/include/SDL_config_android.h +182 -0
  11. data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
  12. data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
  13. data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
  14. data/dependencies/SDL/include/SDL_config_os2.h +188 -0
  15. data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
  16. data/dependencies/SDL/include/SDL_config_psp.h +165 -0
  17. data/dependencies/SDL/include/SDL_config_windows.h +288 -0
  18. data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
  19. data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
  20. data/dependencies/SDL/include/SDL_copying.h +20 -0
  21. data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
  22. data/dependencies/SDL/include/SDL_egl.h +1676 -0
  23. data/dependencies/SDL/include/SDL_endian.h +263 -0
  24. data/dependencies/SDL/include/SDL_error.h +112 -0
  25. data/dependencies/SDL/include/SDL_events.h +827 -0
  26. data/dependencies/SDL/include/SDL_filesystem.h +136 -0
  27. data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
  28. data/dependencies/SDL/include/SDL_gesture.h +87 -0
  29. data/dependencies/SDL/include/SDL_haptic.h +1247 -0
  30. data/dependencies/SDL/include/SDL_hints.h +1578 -0
  31. data/dependencies/SDL/include/SDL_joystick.h +499 -0
  32. data/dependencies/SDL/include/SDL_keyboard.h +217 -0
  33. data/dependencies/SDL/include/SDL_keycode.h +351 -0
  34. data/dependencies/SDL/include/SDL_loadso.h +81 -0
  35. data/dependencies/SDL/include/SDL_locale.h +101 -0
  36. data/dependencies/SDL/include/SDL_log.h +211 -0
  37. data/dependencies/SDL/include/SDL_main.h +180 -0
  38. data/dependencies/SDL/include/SDL_messagebox.h +146 -0
  39. data/dependencies/SDL/include/SDL_metal.h +117 -0
  40. data/dependencies/SDL/include/SDL_misc.h +75 -0
  41. data/dependencies/SDL/include/SDL_mouse.h +302 -0
  42. data/dependencies/SDL/include/SDL_mutex.h +251 -0
  43. data/dependencies/SDL/include/SDL_name.h +33 -0
  44. data/dependencies/SDL/include/SDL_opengl.h +2183 -0
  45. data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
  46. data/dependencies/SDL/include/SDL_opengles.h +39 -0
  47. data/dependencies/SDL/include/SDL_opengles2.h +52 -0
  48. data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
  49. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
  50. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
  51. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
  52. data/dependencies/SDL/include/SDL_pixels.h +479 -0
  53. data/dependencies/SDL/include/SDL_platform.h +198 -0
  54. data/dependencies/SDL/include/SDL_power.h +75 -0
  55. data/dependencies/SDL/include/SDL_quit.h +58 -0
  56. data/dependencies/SDL/include/SDL_rect.h +174 -0
  57. data/dependencies/SDL/include/SDL_render.h +1158 -0
  58. data/dependencies/SDL/include/SDL_revision.h +2 -0
  59. data/dependencies/SDL/include/SDL_rwops.h +283 -0
  60. data/dependencies/SDL/include/SDL_scancode.h +413 -0
  61. data/dependencies/SDL/include/SDL_sensor.h +267 -0
  62. data/dependencies/SDL/include/SDL_shape.h +144 -0
  63. data/dependencies/SDL/include/SDL_stdinc.h +647 -0
  64. data/dependencies/SDL/include/SDL_surface.h +563 -0
  65. data/dependencies/SDL/include/SDL_system.h +325 -0
  66. data/dependencies/SDL/include/SDL_syswm.h +354 -0
  67. data/dependencies/SDL/include/SDL_test.h +69 -0
  68. data/dependencies/SDL/include/SDL_test_assert.h +105 -0
  69. data/dependencies/SDL/include/SDL_test_common.h +218 -0
  70. data/dependencies/SDL/include/SDL_test_compare.h +69 -0
  71. data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
  72. data/dependencies/SDL/include/SDL_test_font.h +81 -0
  73. data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
  74. data/dependencies/SDL/include/SDL_test_harness.h +134 -0
  75. data/dependencies/SDL/include/SDL_test_images.h +78 -0
  76. data/dependencies/SDL/include/SDL_test_log.h +67 -0
  77. data/dependencies/SDL/include/SDL_test_md5.h +129 -0
  78. data/dependencies/SDL/include/SDL_test_memory.h +63 -0
  79. data/dependencies/SDL/include/SDL_test_random.h +115 -0
  80. data/dependencies/SDL/include/SDL_thread.h +366 -0
  81. data/dependencies/SDL/include/SDL_timer.h +115 -0
  82. data/dependencies/SDL/include/SDL_touch.h +102 -0
  83. data/dependencies/SDL/include/SDL_types.h +29 -0
  84. data/dependencies/SDL/include/SDL_version.h +162 -0
  85. data/dependencies/SDL/include/SDL_video.h +1282 -0
  86. data/dependencies/SDL/include/SDL_vulkan.h +276 -0
  87. data/dependencies/SDL/include/begin_code.h +166 -0
  88. data/dependencies/SDL/include/close_code.h +40 -0
  89. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  90. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  91. data/dependencies/SDL_sound/SDL_sound.c +795 -0
  92. data/dependencies/SDL_sound/SDL_sound.h +725 -0
  93. data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
  94. data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
  95. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
  96. data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
  97. data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
  98. data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
  99. data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
  100. data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
  101. data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
  102. data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
  103. data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
  104. data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
  105. data/dependencies/SDL_sound/dr_flac.h +5906 -0
  106. data/dependencies/SDL_sound/dr_mp3.h +2832 -0
  107. data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
  108. data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
  109. data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
  110. data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
  111. data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
  112. data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
  113. data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
  114. data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
  115. data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
  116. data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
  117. data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
  118. data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
  119. data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
  120. data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
  121. data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
  122. data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
  123. data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
  124. data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
  125. data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
  126. data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
  127. data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
  128. data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
  129. data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
  130. data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
  131. data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
  132. data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
  133. data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
  134. data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
  135. data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
  136. data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
  137. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
  138. data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
  139. data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
  140. data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
  141. data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
  142. data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
  143. data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +143 -78
  144. data/dependencies/al_soft/AL/al.h +655 -0
  145. data/dependencies/al_soft/AL/alc.h +270 -0
  146. data/dependencies/al_soft/AL/alext.h +585 -0
  147. data/dependencies/al_soft/AL/efx-creative.h +3 -0
  148. data/dependencies/al_soft/AL/efx-presets.h +402 -0
  149. data/dependencies/al_soft/AL/efx.h +762 -0
  150. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  151. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  152. data/{src → dependencies/stb}/stb_image.h +330 -127
  153. data/{src → dependencies/stb}/stb_image_write.h +156 -85
  154. data/{src → dependencies/stb}/stb_truetype.h +192 -69
  155. data/{src → dependencies/utf8proc}/utf8proc.c +0 -0
  156. data/{src → dependencies/utf8proc}/utf8proc.h +0 -0
  157. data/{src → dependencies/utf8proc}/utf8proc_data.h +0 -0
  158. data/ext/gosu/extconf.rb +56 -22
  159. data/{Gosu → include/Gosu}/Audio.hpp +6 -8
  160. data/{Gosu → include/Gosu}/AutoLink.hpp +0 -0
  161. data/include/Gosu/Bitmap.hpp +100 -0
  162. data/{Gosu → include/Gosu}/Buttons.hpp +94 -35
  163. data/{Gosu → include/Gosu}/Channel.h +0 -0
  164. data/{Gosu → include/Gosu}/Color.h +0 -0
  165. data/{Gosu → include/Gosu}/Color.hpp +0 -0
  166. data/{Gosu → include/Gosu}/Directories.hpp +0 -0
  167. data/{Gosu → include/Gosu}/Font.h +0 -0
  168. data/{Gosu → include/Gosu}/Font.hpp +0 -0
  169. data/{Gosu → include/Gosu}/Fwd.hpp +0 -0
  170. data/{Gosu → include/Gosu}/Gosu.h +3 -0
  171. data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
  172. data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
  173. data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
  174. data/{Gosu → include/Gosu}/IO.hpp +0 -0
  175. data/{Gosu → include/Gosu}/Image.h +0 -0
  176. data/{Gosu → include/Gosu}/Image.hpp +7 -6
  177. data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
  178. data/{Gosu → include/Gosu}/Input.hpp +30 -15
  179. data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
  180. data/{Gosu → include/Gosu}/Math.hpp +0 -0
  181. data/{Gosu → include/Gosu}/Platform.hpp +0 -0
  182. data/{Gosu → include/Gosu}/Sample.h +0 -0
  183. data/{Gosu → include/Gosu}/Song.h +0 -0
  184. data/{Gosu → include/Gosu}/Text.hpp +0 -0
  185. data/{Gosu → include/Gosu}/TextInput.h +0 -0
  186. data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
  187. data/{Gosu → include/Gosu}/Timing.hpp +0 -0
  188. data/{Gosu → include/Gosu}/Utility.hpp +1 -1
  189. data/{Gosu → include/Gosu}/Version.hpp +0 -0
  190. data/{Gosu → include/Gosu}/Window.h +2 -0
  191. data/{Gosu → include/Gosu}/Window.hpp +21 -13
  192. data/lib/OpenAL32.dll +0 -0
  193. data/lib/SDL2.dll +0 -0
  194. data/lib/gosu.rb +0 -3
  195. data/lib/gosu/patches.rb +0 -9
  196. data/lib/gosu/swig_patches.rb +3 -2
  197. data/lib/libmpg123.dll +0 -0
  198. data/lib/libsndfile.dll +0 -0
  199. data/lib64/OpenAL32.dll +0 -0
  200. data/lib64/SDL2.dll +0 -0
  201. data/lib64/libmpg123.dll +0 -0
  202. data/lib64/libsndfile.dll +0 -0
  203. data/rdoc/gosu.rb +95 -20
  204. data/src/Audio.cpp +50 -224
  205. data/src/AudioFile.hpp +17 -37
  206. data/src/AudioFileAudioToolbox.cpp +237 -0
  207. data/src/AudioFileSDLSound.cpp +147 -0
  208. data/src/AudioImpl.cpp +3 -12
  209. data/src/AudioImpl.hpp +3 -1
  210. data/src/Bitmap.cpp +85 -83
  211. data/src/BitmapIO.cpp +52 -58
  212. data/src/Constants.cpp +80 -33
  213. data/src/Font.cpp +3 -1
  214. data/src/GosuWrapper.cpp +19 -0
  215. data/src/Graphics.cpp +7 -4
  216. data/src/Image.cpp +13 -16
  217. data/src/Input.cpp +408 -159
  218. data/src/LargeImageData.cpp +1 -1
  219. data/src/MarkupParser.cpp +2 -1
  220. data/src/RubyGosu.cxx +349 -83
  221. data/src/RubyGosu.h +4 -2
  222. data/src/TexChunk.cpp +1 -1
  223. data/src/TextBuilder.cpp +3 -1
  224. data/src/Texture.cpp +1 -1
  225. data/src/TrueTypeFont.cpp +1 -1
  226. data/src/Utility.cpp +11 -7
  227. data/src/Window.cpp +30 -39
  228. data/src/WindowWrapper.cpp +28 -0
  229. metadata +207 -52
  230. data/Gosu/Bitmap.hpp +0 -113
  231. data/src/AudioToolboxFile.hpp +0 -210
  232. data/src/OggFile.hpp +0 -92
  233. data/src/SndFile.hpp +0 -174
  234. data/src/WinMain.cpp +0 -64
@@ -0,0 +1,1001 @@
1
+ /*
2
+ * This source code is public domain.
3
+ *
4
+ * Authors: Rani Assaf <rani@magic.metawire.com>,
5
+ * Olivier Lapicque <olivierl@jps.net>,
6
+ * Adam Goode <adam@evdebs.org> (endian and char fixes for PPC)
7
+ */
8
+
9
+ #ifndef _INCL_LIBMODPLUG_H_
10
+ #define _INCL_LIBMODPLUG_H_
11
+
12
+ #include "SDL.h"
13
+
14
+ #if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)
15
+ #pragma GCC visibility push(hidden)
16
+ #endif
17
+
18
+ #ifdef _WIN32
19
+
20
+ #ifdef MSC_VER
21
+ #pragma warning (disable:4201)
22
+ #pragma warning (disable:4514)
23
+ #endif
24
+
25
+ #define WIN32_LEAN_AND_MEAN
26
+ #include <windows.h>
27
+ #include <windowsx.h>
28
+ #include <mmsystem.h>
29
+ #include <stdio.h>
30
+ #include <malloc.h>
31
+ #include <stdint.h>
32
+
33
+ #define srandom(_seed) srand(_seed)
34
+ #define random() rand()
35
+
36
+ #else
37
+
38
+ #include <stdlib.h>
39
+ #include <stdio.h>
40
+ #include <string.h>
41
+
42
+ typedef Sint8 CHAR;
43
+ typedef Uint8 UCHAR;
44
+ typedef Uint8* PUCHAR;
45
+ typedef Uint16 USHORT;
46
+ typedef Uint32 ULONG;
47
+ typedef Uint32 UINT;
48
+ typedef Uint32 DWORD;
49
+ typedef Sint32 LONG;
50
+ typedef Sint64 LONGLONG;
51
+ typedef Sint32* LPLONG;
52
+ typedef Uint32* LPDWORD;
53
+ typedef Uint16 WORD;
54
+ typedef Uint8 BYTE;
55
+ typedef Uint8* LPBYTE;
56
+ typedef int BOOL;
57
+ typedef char* LPSTR;
58
+ typedef void* LPVOID;
59
+ typedef Uint16* LPWORD;
60
+ typedef const char* LPCSTR;
61
+ typedef void* PVOID;
62
+ typedef void VOID;
63
+
64
+ inline LONG MulDiv (long a, long b, long c)
65
+ {
66
+ // if (!c) return 0;
67
+ return ((uint64_t) a * (uint64_t) b ) / c;
68
+ }
69
+
70
+ #define LPCTSTR LPCSTR
71
+ #define WAVE_FORMAT_PCM 1
72
+ //#define ENABLE_EQ
73
+
74
+ #define GHND 0
75
+
76
+ #define GlobalAllocPtr(x, size) ((int8_t *) SDL_calloc(1, (size)))
77
+ #define GlobalFreePtr(p) SDL_free((void *)(p))
78
+
79
+ #ifndef FALSE
80
+ #define FALSE 0
81
+ #endif
82
+
83
+ #ifndef TRUE
84
+ #define TRUE 1
85
+ #endif
86
+
87
+ #endif // _WIN32
88
+
89
+
90
+ typedef struct {
91
+ char *mm;
92
+ int sz;
93
+ int pos;
94
+ int error;
95
+ } MMFILE;
96
+
97
+ void mmfclose(MMFILE *mmfile);
98
+ int mmfeof(MMFILE *mmfile);
99
+ int mmfgetc(MMFILE *mmfile);
100
+ void mmfgets(char buf[], unsigned int bufsz, MMFILE *mmfile);
101
+ long mmftell(MMFILE *mmfile);
102
+ void mmfseek(MMFILE *mmfile, long p, int whence);
103
+ BYTE mmreadUBYTE(MMFILE *mmfile);
104
+ void mmreadUBYTES(BYTE *buf, long sz, MMFILE *mmfile);
105
+ void mmreadSBYTES(char *buf, long sz, MMFILE *mmfile);
106
+ char *rwops_fgets(char *buf, int buflen, SDL_RWops *rwops);
107
+
108
+ #define MMSTREAM SDL_RWops
109
+ #define _mm_fopen(name,mode) SDL_RWFromFile(name, mode)
110
+ #define _mm_fgets(f,buf,sz) rwops_fgets(buf,sz,f)
111
+ #define _mm_fseek(f,pos,whence) SDL_RWseek(f,pos,whence)
112
+ #define _mm_ftell(f) SDL_RWtell(f)
113
+ #define _mm_read_UBYTES(buf,sz,f) SDL_RWread(f, buf, 1, sz)
114
+ #define _mm_read_SBYTES(buf,sz,f) SDL_RWread(f, buf, 1, sz)
115
+ #define _mm_feof(f) (SDL_RWtell(f) >= SDL_RWsize(f))
116
+ #define _mm_fclose(f) SDL_RWclose(f)
117
+ #define DupStr(h,buf,sz) SDL_strdup(buf)
118
+ #define _mm_calloc(h,n,sz) SDL_calloc(n,sz)
119
+ #define _mm_recalloc(h,buf,sz,elsz) SDL_realloc(buf,sz)
120
+ #define _mm_free(h,p) SDL_free(p)
121
+
122
+
123
+ #define MODPLUG_EXPORT
124
+
125
+
126
+
127
+ /*
128
+ * This source code is public domain.
129
+ *
130
+ * Authors: Olivier Lapicque <olivierl@jps.net>,
131
+ * Adam Goode <adam@evdebs.org> (endian and char fixes for PPC)
132
+ */
133
+
134
+ #ifndef LPCBYTE
135
+ typedef const BYTE * LPCBYTE;
136
+ #endif
137
+
138
+ #define MOD_AMIGAC2 0x1AB
139
+ #define MAX_SAMPLE_LENGTH 16000000
140
+ #define MAX_SAMPLE_RATE 192000
141
+ #define MAX_ORDERS 256
142
+ #define MAX_PATTERNS 240
143
+ #define MAX_SAMPLES 240
144
+ #define MAX_INSTRUMENTS MAX_SAMPLES
145
+ #define MAX_CHANNELS 128
146
+ #define MAX_BASECHANNELS 64
147
+ #define MAX_ENVPOINTS 32
148
+ #define MIN_PERIOD 0x0020
149
+ #define MAX_PERIOD 0xFFFF
150
+ #define MAX_PATTERNNAME 32
151
+ #define MAX_CHANNELNAME 20
152
+ #define MAX_INFONAME 80
153
+ #define MAX_EQ_BANDS 6
154
+ #define MAX_MIXPLUGINS 8
155
+
156
+
157
+ #define MOD_TYPE_NONE 0x00
158
+ #define MOD_TYPE_MOD 0x01
159
+ #define MOD_TYPE_S3M 0x02
160
+ #define MOD_TYPE_XM 0x04
161
+ #define MOD_TYPE_MED 0x08
162
+ #define MOD_TYPE_MTM 0x10
163
+ #define MOD_TYPE_IT 0x20
164
+ #define MOD_TYPE_669 0x40
165
+ #define MOD_TYPE_ULT 0x80
166
+ #define MOD_TYPE_STM 0x100
167
+ #define MOD_TYPE_FAR 0x200
168
+ #define MOD_TYPE_WAV 0x400
169
+ #define MOD_TYPE_AMF 0x800
170
+ #define MOD_TYPE_AMS 0x1000
171
+ #define MOD_TYPE_DSM 0x2000
172
+ #define MOD_TYPE_MDL 0x4000
173
+ #define MOD_TYPE_OKT 0x8000
174
+ #define MOD_TYPE_MID 0x10000
175
+ #define MOD_TYPE_DMF 0x20000
176
+ #define MOD_TYPE_PTM 0x40000
177
+ #define MOD_TYPE_DBM 0x80000
178
+ #define MOD_TYPE_MT2 0x100000
179
+ #define MOD_TYPE_AMF0 0x200000
180
+ #define MOD_TYPE_PSM 0x400000
181
+ #define MOD_TYPE_J2B 0x800000
182
+ #define MOD_TYPE_ABC 0x1000000
183
+ #define MOD_TYPE_PAT 0x2000000
184
+ #define MOD_TYPE_UMX 0x80000000 // Fake type
185
+ #define MAX_MODTYPE 24
186
+
187
+
188
+
189
+ // Channel flags:
190
+ // Bits 0-7: Sample Flags
191
+ #define CHN_16BIT 0x01
192
+ #define CHN_LOOP 0x02
193
+ #define CHN_PINGPONGLOOP 0x04
194
+ #define CHN_SUSTAINLOOP 0x08
195
+ #define CHN_PINGPONGSUSTAIN 0x10
196
+ #define CHN_PANNING 0x20
197
+ #define CHN_STEREO 0x40
198
+ #define CHN_PINGPONGFLAG 0x80
199
+ // Bits 8-31: Channel Flags
200
+ #define CHN_MUTE 0x100
201
+ #define CHN_KEYOFF 0x200
202
+ #define CHN_NOTEFADE 0x400
203
+ #define CHN_SURROUND 0x800
204
+ #define CHN_NOIDO 0x1000
205
+ #define CHN_HQSRC 0x2000
206
+ #define CHN_FILTER 0x4000
207
+ #define CHN_VOLUMERAMP 0x8000
208
+ #define CHN_VIBRATO 0x10000
209
+ #define CHN_TREMOLO 0x20000
210
+ #define CHN_PANBRELLO 0x40000
211
+ #define CHN_PORTAMENTO 0x80000
212
+ #define CHN_GLISSANDO 0x100000
213
+ #define CHN_VOLENV 0x200000
214
+ #define CHN_PANENV 0x400000
215
+ #define CHN_PITCHENV 0x800000
216
+ #define CHN_FASTVOLRAMP 0x1000000
217
+ #define CHN_EXTRALOUD 0x2000000
218
+ #define CHN_REVERB 0x4000000
219
+ #define CHN_NOREVERB 0x8000000
220
+
221
+
222
+ #define ENV_VOLUME 0x0001
223
+ #define ENV_VOLSUSTAIN 0x0002
224
+ #define ENV_VOLLOOP 0x0004
225
+ #define ENV_PANNING 0x0008
226
+ #define ENV_PANSUSTAIN 0x0010
227
+ #define ENV_PANLOOP 0x0020
228
+ #define ENV_PITCH 0x0040
229
+ #define ENV_PITCHSUSTAIN 0x0080
230
+ #define ENV_PITCHLOOP 0x0100
231
+ #define ENV_SETPANNING 0x0200
232
+ #define ENV_FILTER 0x0400
233
+ #define ENV_VOLCARRY 0x0800
234
+ #define ENV_PANCARRY 0x1000
235
+ #define ENV_PITCHCARRY 0x2000
236
+
237
+ #define CMD_NONE 0
238
+ #define CMD_ARPEGGIO 1
239
+ #define CMD_PORTAMENTOUP 2
240
+ #define CMD_PORTAMENTODOWN 3
241
+ #define CMD_TONEPORTAMENTO 4
242
+ #define CMD_VIBRATO 5
243
+ #define CMD_TONEPORTAVOL 6
244
+ #define CMD_VIBRATOVOL 7
245
+ #define CMD_TREMOLO 8
246
+ #define CMD_PANNING8 9
247
+ #define CMD_OFFSET 10
248
+ #define CMD_VOLUMESLIDE 11
249
+ #define CMD_POSITIONJUMP 12
250
+ #define CMD_VOLUME 13
251
+ #define CMD_PATTERNBREAK 14
252
+ #define CMD_RETRIG 15
253
+ #define CMD_SPEED 16
254
+ #define CMD_TEMPO 17
255
+ #define CMD_TREMOR 18
256
+ #define CMD_MODCMDEX 19
257
+ #define CMD_S3MCMDEX 20
258
+ #define CMD_CHANNELVOLUME 21
259
+ #define CMD_CHANNELVOLSLIDE 22
260
+ #define CMD_GLOBALVOLUME 23
261
+ #define CMD_GLOBALVOLSLIDE 24
262
+ #define CMD_KEYOFF 25
263
+ #define CMD_FINEVIBRATO 26
264
+ #define CMD_PANBRELLO 27
265
+ #define CMD_XFINEPORTAUPDOWN 28
266
+ #define CMD_PANNINGSLIDE 29
267
+ #define CMD_SETENVPOSITION 30
268
+ #define CMD_MIDI 31
269
+
270
+
271
+ // Volume Column commands
272
+ #define VOLCMD_VOLUME 1
273
+ #define VOLCMD_PANNING 2
274
+ #define VOLCMD_VOLSLIDEUP 3
275
+ #define VOLCMD_VOLSLIDEDOWN 4
276
+ #define VOLCMD_FINEVOLUP 5
277
+ #define VOLCMD_FINEVOLDOWN 6
278
+ #define VOLCMD_VIBRATOSPEED 7
279
+ #define VOLCMD_VIBRATO 8
280
+ #define VOLCMD_PANSLIDELEFT 9
281
+ #define VOLCMD_PANSLIDERIGHT 10
282
+ #define VOLCMD_TONEPORTAMENTO 11
283
+ #define VOLCMD_PORTAUP 12
284
+ #define VOLCMD_PORTADOWN 13
285
+
286
+ #define RSF_16BIT 0x04
287
+ #define RSF_STEREO 0x08
288
+
289
+ #define RS_PCM8S 0 // 8-bit signed
290
+ #define RS_PCM8U 1 // 8-bit unsigned
291
+ #define RS_PCM8D 2 // 8-bit delta values
292
+ #define RS_ADPCM4 3 // 4-bit ADPCM-packed
293
+ #define RS_PCM16D 4 // 16-bit delta values
294
+ #define RS_PCM16S 5 // 16-bit signed
295
+ #define RS_PCM16U 6 // 16-bit unsigned
296
+ #define RS_PCM16M 7 // 16-bit motorola order
297
+ #define RS_STPCM8S (RS_PCM8S|RSF_STEREO) // stereo 8-bit signed
298
+ #define RS_STPCM8U (RS_PCM8U|RSF_STEREO) // stereo 8-bit unsigned
299
+ #define RS_STPCM8D (RS_PCM8D|RSF_STEREO) // stereo 8-bit delta values
300
+ #define RS_STPCM16S (RS_PCM16S|RSF_STEREO) // stereo 16-bit signed
301
+ #define RS_STPCM16U (RS_PCM16U|RSF_STEREO) // stereo 16-bit unsigned
302
+ #define RS_STPCM16D (RS_PCM16D|RSF_STEREO) // stereo 16-bit delta values
303
+ #define RS_STPCM16M (RS_PCM16M|RSF_STEREO) // stereo 16-bit signed big endian
304
+ // IT 2.14 compressed samples
305
+ #define RS_IT2148 0x10
306
+ #define RS_IT21416 0x14
307
+ #define RS_IT2158 0x12
308
+ #define RS_IT21516 0x16
309
+ // AMS Packed Samples
310
+ #define RS_AMS8 0x11
311
+ #define RS_AMS16 0x15
312
+ // DMF Huffman compression
313
+ #define RS_DMF8 0x13
314
+ #define RS_DMF16 0x17
315
+ // MDL Huffman compression
316
+ #define RS_MDL8 0x20
317
+ #define RS_MDL16 0x24
318
+ #define RS_PTM8DTO16 0x25
319
+ // Stereo Interleaved Samples
320
+ #define RS_STIPCM8S (RS_PCM8S|0x40|RSF_STEREO) // stereo 8-bit signed
321
+ #define RS_STIPCM8U (RS_PCM8U|0x40|RSF_STEREO) // stereo 8-bit unsigned
322
+ #define RS_STIPCM16S (RS_PCM16S|0x40|RSF_STEREO) // stereo 16-bit signed
323
+ #define RS_STIPCM16U (RS_PCM16U|0x40|RSF_STEREO) // stereo 16-bit unsigned
324
+ #define RS_STIPCM16M (RS_PCM16M|0x40|RSF_STEREO) // stereo 16-bit signed big endian
325
+ // 24-bit signed
326
+ #define RS_PCM24S (RS_PCM16S|0x80) // mono 24-bit signed
327
+ #define RS_STIPCM24S (RS_PCM16S|0x80|RSF_STEREO) // stereo 24-bit signed
328
+ #define RS_PCM32S (RS_PCM16S|0xC0) // mono 24-bit signed
329
+ #define RS_STIPCM32S (RS_PCM16S|0xC0|RSF_STEREO) // stereo 24-bit signed
330
+
331
+ // NNA types
332
+ #define NNA_NOTECUT 0
333
+ #define NNA_CONTINUE 1
334
+ #define NNA_NOTEOFF 2
335
+ #define NNA_NOTEFADE 3
336
+
337
+ // DCT types
338
+ #define DCT_NONE 0
339
+ #define DCT_NOTE 1
340
+ #define DCT_SAMPLE 2
341
+ #define DCT_INSTRUMENT 3
342
+
343
+ // DNA types
344
+ #define DNA_NOTECUT 0
345
+ #define DNA_NOTEOFF 1
346
+ #define DNA_NOTEFADE 2
347
+
348
+ // Mixer Hardware-Dependent features
349
+ #define SYSMIX_WINDOWSNT 0x02
350
+ #define SYSMIX_SLOWCPU 0x04
351
+ #define SYSMIX_FASTCPU 0x08
352
+
353
+ // Module flags
354
+ #define SONG_EMBEDMIDICFG 0x0001
355
+ #define SONG_FASTVOLSLIDES 0x0002
356
+ #define SONG_ITOLDEFFECTS 0x0004
357
+ #define SONG_ITCOMPATMODE 0x0008
358
+ #define SONG_LINEARSLIDES 0x0010
359
+ #define SONG_PATTERNLOOP 0x0020
360
+ #define SONG_STEP 0x0040
361
+ #define SONG_PAUSED 0x0080
362
+ #define SONG_FADINGSONG 0x0100
363
+ #define SONG_ENDREACHED 0x0200
364
+ #define SONG_GLOBALFADE 0x0400
365
+ #define SONG_CPUVERYHIGH 0x0800
366
+ #define SONG_FIRSTTICK 0x1000
367
+ #define SONG_MPTFILTERMODE 0x2000
368
+ #define SONG_SURROUNDPAN 0x4000
369
+ #define SONG_EXFILTERRANGE 0x8000
370
+ #define SONG_AMIGALIMITS 0x10000
371
+
372
+ // Global Options (Renderer)
373
+ #define SNDMIX_REVERSESTEREO 0x0001
374
+ #define SNDMIX_NOISEREDUCTION 0x0002
375
+ #define SNDMIX_AGC 0x0004
376
+ #define SNDMIX_NORESAMPLING 0x0008
377
+ #define SNDMIX_HQRESAMPLER 0x0010
378
+ #define SNDMIX_MEGABASS 0x0020
379
+ #define SNDMIX_SURROUND 0x0040
380
+ #define SNDMIX_REVERB 0x0080
381
+ #define SNDMIX_EQ 0x0100
382
+ #define SNDMIX_SOFTPANNING 0x0200
383
+ #define SNDMIX_ULTRAHQSRCMODE 0x0400
384
+ // Misc Flags (can safely be turned on or off)
385
+ #define SNDMIX_DIRECTTODISK 0x10000
386
+ #define SNDMIX_NOBACKWARDJUMPS 0x40000
387
+ #define SNDMIX_MAXDEFAULTPAN 0x80000 // Used by the MOD loader
388
+
389
+ // Delayed Surround Filters
390
+ #define nDolbyHiFltAttn 6
391
+ #define nDolbyHiFltMask 3
392
+ #define DOLBYATTNROUNDUP 31
393
+
394
+ // Bass Expansion
395
+ #define XBASS_DELAY 14 // 2.5 ms
396
+
397
+ // Buffer Sizes
398
+ #define XBASSBUFFERSIZE 64 // 2 ms at 50KHz
399
+ #define FILTERBUFFERSIZE 64 // 1.25 ms
400
+ #define SURROUNDBUFFERSIZE ((MAX_SAMPLE_RATE * 50) / 1000)
401
+ #define REVERBBUFFERSIZE ((MAX_SAMPLE_RATE * 200) / 1000)
402
+ #define REVERBBUFFERSIZE2 ((REVERBBUFFERSIZE*13) / 17)
403
+ #define REVERBBUFFERSIZE3 ((REVERBBUFFERSIZE*7) / 13)
404
+ #define REVERBBUFFERSIZE4 ((REVERBBUFFERSIZE*7) / 19)
405
+
406
+ #define MIXBUFFERSIZE 512
407
+ #define MIXING_ATTENUATION 4
408
+ #define MIXING_CLIPMIN (-0x08000000)
409
+ #define MIXING_CLIPMAX (0x07FFFFFF)
410
+ #define VOLUMERAMPPRECISION 12
411
+ #define FADESONGDELAY 100
412
+ #define EQ_BUFFERSIZE (MIXBUFFERSIZE)
413
+ #define AGC_PRECISION 9
414
+ #define AGC_UNITY (1 << AGC_PRECISION)
415
+
416
+ #define MPPASMCALL
417
+ #define MPPFASTCALL
418
+
419
+ #define MOD2XMFineTune(k) ((int)( (signed char)((k)<<4) ))
420
+ #define XM2MODFineTune(k) ((int)( (k>>4)&0x0f ))
421
+
422
+ int _muldiv(long a, long b, long c);
423
+ int _muldivr(long a, long b, long c);
424
+
425
+ #define bswapLE16(X) SDL_SwapLE16((X))
426
+ #define bswapLE32(X) SDL_SwapLE32((X))
427
+ #define bswapBE16(X) SDL_SwapBE16((X))
428
+ #define bswapBE32(X) SDL_SwapBE32((X))
429
+
430
+ // Reverb Types (GM2 Presets)
431
+ enum {
432
+ REVERBTYPE_SMALLROOM,
433
+ REVERBTYPE_MEDIUMROOM,
434
+ REVERBTYPE_LARGEROOM,
435
+ REVERBTYPE_SMALLHALL,
436
+ REVERBTYPE_MEDIUMHALL,
437
+ REVERBTYPE_LARGEHALL,
438
+ NUM_REVERBTYPES
439
+ };
440
+
441
+
442
+ enum {
443
+ SRCMODE_NEAREST,
444
+ SRCMODE_LINEAR,
445
+ SRCMODE_SPLINE,
446
+ SRCMODE_POLYPHASE,
447
+ NUM_SRC_MODES
448
+ };
449
+
450
+
451
+ // Sample Struct
452
+ typedef struct _MODINSTRUMENT
453
+ {
454
+ UINT nLength,nLoopStart,nLoopEnd;
455
+ UINT nSustainStart, nSustainEnd;
456
+ signed char *pSample;
457
+ UINT nC4Speed;
458
+ WORD nPan;
459
+ WORD nVolume;
460
+ WORD nGlobalVol;
461
+ WORD uFlags;
462
+ signed char RelativeTone;
463
+ signed char nFineTune;
464
+ BYTE nVibType;
465
+ BYTE nVibSweep;
466
+ BYTE nVibDepth;
467
+ BYTE nVibRate;
468
+ } MODINSTRUMENT;
469
+
470
+
471
+ // Instrument Struct
472
+ typedef struct _INSTRUMENTHEADER
473
+ {
474
+ UINT nFadeOut;
475
+ DWORD dwFlags;
476
+ WORD nGlobalVol;
477
+ WORD nPan;
478
+ WORD VolPoints[MAX_ENVPOINTS];
479
+ WORD PanPoints[MAX_ENVPOINTS];
480
+ WORD PitchPoints[MAX_ENVPOINTS];
481
+ BYTE VolEnv[MAX_ENVPOINTS];
482
+ BYTE PanEnv[MAX_ENVPOINTS];
483
+ BYTE PitchEnv[MAX_ENVPOINTS];
484
+ BYTE Keyboard[128];
485
+ BYTE NoteMap[128];
486
+
487
+ BYTE nVolEnv;
488
+ BYTE nPanEnv;
489
+ BYTE nPitchEnv;
490
+ BYTE nVolLoopStart;
491
+ BYTE nVolLoopEnd;
492
+ BYTE nVolSustainBegin;
493
+ BYTE nVolSustainEnd;
494
+ BYTE nPanLoopStart;
495
+ BYTE nPanLoopEnd;
496
+ BYTE nPanSustainBegin;
497
+ BYTE nPanSustainEnd;
498
+ BYTE nPitchLoopStart;
499
+ BYTE nPitchLoopEnd;
500
+ BYTE nPitchSustainBegin;
501
+ BYTE nPitchSustainEnd;
502
+ BYTE nNNA;
503
+ BYTE nDCT;
504
+ BYTE nDNA;
505
+ BYTE nPanSwing;
506
+ BYTE nVolSwing;
507
+ BYTE nIFC;
508
+ BYTE nIFR;
509
+ WORD wMidiBank;
510
+ BYTE nMidiProgram;
511
+ BYTE nMidiChannel;
512
+ BYTE nMidiDrumKey;
513
+ signed char nPPS;
514
+ unsigned char nPPC;
515
+ CHAR filename[12];
516
+ } INSTRUMENTHEADER;
517
+
518
+
519
+ // Channel Struct
520
+ typedef struct _MODCHANNEL
521
+ {
522
+ // First 32-bytes: Most used mixing information: don't change it
523
+ signed char * pCurrentSample;
524
+ DWORD nPos;
525
+ DWORD nPosLo; // actually 16-bit
526
+ LONG nInc; // 16.16
527
+ LONG nRightVol;
528
+ LONG nLeftVol;
529
+ LONG nRightRamp;
530
+ LONG nLeftRamp;
531
+ // 2nd cache line
532
+ DWORD nLength;
533
+ DWORD dwFlags;
534
+ DWORD nLoopStart;
535
+ DWORD nLoopEnd;
536
+ LONG nRampRightVol;
537
+ LONG nRampLeftVol;
538
+ LONG nFilter_Y1, nFilter_Y2, nFilter_Y3, nFilter_Y4;
539
+ LONG nFilter_A0, nFilter_B0, nFilter_B1;
540
+ LONG nROfs, nLOfs;
541
+ LONG nRampLength;
542
+ // Information not used in the mixer
543
+ signed char * pSample;
544
+ LONG nNewRightVol, nNewLeftVol;
545
+ LONG nRealVolume, nRealPan;
546
+ LONG nVolume, nPan, nFadeOutVol;
547
+ LONG nPeriod, nC4Speed, nPortamentoDest;
548
+ INSTRUMENTHEADER *pHeader;
549
+ MODINSTRUMENT *pInstrument;
550
+ DWORD nVolEnvPosition, nPanEnvPosition, nPitchEnvPosition;
551
+ DWORD nMasterChn;
552
+ LONG nGlobalVol, nInsVol;
553
+ LONG nFineTune, nTranspose;
554
+ LONG nPortamentoSlide, nAutoVibDepth;
555
+ UINT nAutoVibPos, nVibratoPos, nTremoloPos, nPanbrelloPos;
556
+ // 16-bit members
557
+ signed short nVolSwing, nPanSwing;
558
+ // 8-bit members
559
+ BYTE nNote, nNNA;
560
+ BYTE nNewNote, nNewIns, nCommand, nArpeggio;
561
+ BYTE nOldVolumeSlide, nOldFineVolUpDown;
562
+ BYTE nOldPortaUpDown, nOldFinePortaUpDown;
563
+ BYTE nOldPanSlide, nOldChnVolSlide;
564
+ BYTE nVibratoType, nVibratoSpeed, nVibratoDepth;
565
+ BYTE nTremoloType, nTremoloSpeed, nTremoloDepth;
566
+ BYTE nPanbrelloType, nPanbrelloSpeed, nPanbrelloDepth;
567
+ BYTE nOldCmdEx, nOldVolParam, nOldTempo;
568
+ BYTE nOldOffset, nOldHiOffset;
569
+ BYTE nCutOff, nResonance;
570
+ BYTE nRetrigCount, nRetrigParam;
571
+ BYTE nTremorCount, nTremorParam;
572
+ BYTE nPatternLoop, nPatternLoopCount;
573
+ BYTE nRowNote, nRowInstr;
574
+ BYTE nRowVolCmd, nRowVolume;
575
+ BYTE nRowCommand, nRowParam;
576
+ BYTE nActiveMacro, nPadding;
577
+ } MODCHANNEL;
578
+
579
+
580
+ typedef struct _MODCHANNELSETTINGS
581
+ {
582
+ UINT nPan;
583
+ UINT nVolume;
584
+ DWORD dwFlags;
585
+ UINT nMixPlugin;
586
+ } MODCHANNELSETTINGS;
587
+
588
+
589
+ typedef struct _MODCOMMAND
590
+ {
591
+ BYTE note;
592
+ BYTE instr;
593
+ BYTE volcmd;
594
+ BYTE command;
595
+ BYTE vol;
596
+ BYTE param;
597
+ } MODCOMMAND, *LPMODCOMMAND;
598
+
599
+ ////////////////////////////////////////////////////////////////////
600
+
601
+ enum {
602
+ MIDIOUT_START=0,
603
+ MIDIOUT_STOP,
604
+ MIDIOUT_TICK,
605
+ MIDIOUT_NOTEON,
606
+ MIDIOUT_NOTEOFF,
607
+ MIDIOUT_VOLUME,
608
+ MIDIOUT_PAN,
609
+ MIDIOUT_BANKSEL,
610
+ MIDIOUT_PROGRAM,
611
+ };
612
+
613
+
614
+ typedef struct MODMIDICFG
615
+ {
616
+ char szMidiGlb[9*32]; // changed from CHAR
617
+ char szMidiSFXExt[16*32]; // changed from CHAR
618
+ char szMidiZXXExt[128*32]; // changed from CHAR
619
+ } MODMIDICFG, *LPMODMIDICFG;
620
+
621
+ #define NOTE_MAX 120 //Defines maximum notevalue as well as maximum number of notes.
622
+
623
+ typedef struct CSoundFile
624
+ {
625
+ MODCHANNEL Chn[MAX_CHANNELS]; // Channels
626
+ UINT ChnMix[MAX_CHANNELS]; // Channels to be mixed
627
+ MODINSTRUMENT Ins[MAX_SAMPLES]; // Instruments
628
+ INSTRUMENTHEADER *Headers[MAX_INSTRUMENTS]; // Instrument Headers
629
+ MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; // Channels settings
630
+ MODCOMMAND *Patterns[MAX_PATTERNS]; // Patterns
631
+ WORD PatternSize[MAX_PATTERNS]; // Patterns Lengths
632
+ BYTE Order[MAX_ORDERS]; // Pattern Orders
633
+ MODMIDICFG m_MidiCfg; // Midi macro config table
634
+ UINT m_nDefaultSpeed, m_nDefaultTempo, m_nDefaultGlobalVolume;
635
+ DWORD m_dwSongFlags; // Song flags SONG_XXXX
636
+ UINT m_nChannels, m_nMixChannels, m_nMixStat, m_nBufferCount;
637
+ UINT m_nType, m_nSamples, m_nInstruments;
638
+ UINT m_nTickCount, m_nTotalCount, m_nPatternDelay, m_nFrameDelay;
639
+ UINT m_nMusicSpeed, m_nMusicTempo;
640
+ UINT m_nNextRow, m_nRow;
641
+ UINT m_nPattern,m_nCurrentPattern,m_nNextPattern,m_nRestartPos;
642
+ UINT m_nMasterVolume, m_nGlobalVolume, m_nSongPreAmp;
643
+ UINT m_nFreqFactor, m_nTempoFactor, m_nOldGlbVolSlide;
644
+ LONG m_nMinPeriod, m_nMaxPeriod, m_nRepeatCount, m_nInitialRepeatCount;
645
+ DWORD m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples;
646
+ UINT m_nMaxOrderPosition;
647
+ UINT m_nPatternNames;
648
+ LPSTR m_lpszPatternNames;
649
+ CHAR CompressionTable[16];
650
+ UINT m_nXBassDepth, m_nXBassRange;
651
+ UINT m_nReverbDepth, m_nReverbDelay;
652
+ UINT m_nProLogicDepth, m_nProLogicDelay;
653
+ UINT m_nStereoSeparation;
654
+ UINT m_nMaxMixChannels;
655
+ DWORD gdwSoundSetup, gdwMixingFreq, gnBitsPerSample, gnChannels;
656
+ UINT gnVolumeRampSamples;
657
+ UINT gSampleSize;
658
+ int MixSoundBuffer[MIXBUFFERSIZE*4];
659
+ #ifndef MODPLUG_NO_REVERB
660
+ int MixReverbBuffer[MIXBUFFERSIZE*2];
661
+ UINT gnReverbSend;
662
+ #endif
663
+ int MixRearBuffer[MIXBUFFERSIZE*2];
664
+ float MixFloatBuffer[MIXBUFFERSIZE*2];
665
+
666
+ // Bass Expansion: low-pass filter
667
+ LONG nXBassSum;
668
+ LONG nXBassBufferPos;
669
+ LONG nXBassDlyPos;
670
+ LONG nXBassMask;
671
+
672
+ // Noise Reduction: simple low-pass filter
673
+ LONG nLeftNR;
674
+ LONG nRightNR;
675
+
676
+ // Surround Encoding: 1 delay line + low-pass filter + high-pass filter
677
+ LONG nSurroundSize;
678
+ LONG nSurroundPos;
679
+ LONG nDolbyDepth;
680
+ LONG nDolbyLoDlyPos;
681
+ LONG nDolbyLoFltPos;
682
+ LONG nDolbyLoFltSum;
683
+ LONG nDolbyHiFltPos;
684
+ LONG nDolbyHiFltSum;
685
+
686
+ // Reverb: 4 delay lines + high-pass filter + low-pass filter
687
+ #ifndef MODPLUG_NO_REVERB
688
+ LONG nReverbSize;
689
+ LONG nReverbBufferPos;
690
+ LONG nReverbSize2;
691
+ LONG nReverbBufferPos2;
692
+ LONG nReverbSize3;
693
+ LONG nReverbBufferPos3;
694
+ LONG nReverbSize4;
695
+ LONG nReverbBufferPos4;
696
+ LONG nReverbLoFltSum;
697
+ LONG nReverbLoFltPos;
698
+ LONG nReverbLoDlyPos;
699
+ LONG nFilterAttn;
700
+ LONG gRvbLowPass[8];
701
+ LONG gRvbLPPos;
702
+ LONG gRvbLPSum;
703
+ LONG ReverbLoFilterBuffer[XBASSBUFFERSIZE];
704
+ LONG ReverbLoFilterDelay[XBASSBUFFERSIZE];
705
+ LONG ReverbBuffer[REVERBBUFFERSIZE];
706
+ LONG ReverbBuffer2[REVERBBUFFERSIZE2];
707
+ LONG ReverbBuffer3[REVERBBUFFERSIZE3];
708
+ LONG ReverbBuffer4[REVERBBUFFERSIZE4];
709
+ #endif
710
+
711
+ LONG XBassBuffer[XBASSBUFFERSIZE];
712
+ LONG XBassDelay[XBASSBUFFERSIZE];
713
+ LONG DolbyLoFilterBuffer[XBASSBUFFERSIZE];
714
+ LONG DolbyLoFilterDelay[XBASSBUFFERSIZE];
715
+ LONG DolbyHiFilterBuffer[FILTERBUFFERSIZE];
716
+ LONG SurroundBuffer[SURROUNDBUFFERSIZE];
717
+ LONG gnDryROfsVol;
718
+ LONG gnDryLOfsVol;
719
+ LONG gnRvbROfsVol;
720
+ LONG gnRvbLOfsVol;
721
+ int gbInitPlugins;
722
+ } CSoundFile;
723
+
724
+ typedef struct _ModPlug_Settings ModPlug_Settings;
725
+ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Settings *settings);
726
+ void delete_CSoundFile(CSoundFile *_this);
727
+
728
+ UINT CSoundFile_GetMaxPosition(CSoundFile *_this);
729
+ void CSoundFile_SetCurrentPos(CSoundFile *_this, UINT nPos);
730
+ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal);
731
+ void CSoundFile_SetRepeatCount(CSoundFile *_this, int n);
732
+ BOOL CSoundFile_SetPatternName(CSoundFile *_this, UINT nPat, LPCSTR lpszName);
733
+ // Module Loaders
734
+ BOOL CSoundFile_ReadXM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
735
+ BOOL CSoundFile_ReadS3M(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
736
+ BOOL CSoundFile_ReadMod(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
737
+ BOOL CSoundFile_ReadMed(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
738
+ BOOL CSoundFile_ReadMTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
739
+ BOOL CSoundFile_ReadSTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
740
+ BOOL CSoundFile_ReadIT(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
741
+ BOOL CSoundFile_Read669(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
742
+ BOOL CSoundFile_ReadUlt(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
743
+ BOOL CSoundFile_ReadDSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
744
+ BOOL CSoundFile_ReadFAR(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
745
+ BOOL CSoundFile_ReadAMS(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
746
+ BOOL CSoundFile_ReadAMS2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
747
+ BOOL CSoundFile_ReadMDL(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
748
+ BOOL CSoundFile_ReadOKT(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
749
+ BOOL CSoundFile_ReadDMF(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
750
+ BOOL CSoundFile_ReadPTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
751
+ BOOL CSoundFile_ReadDBM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
752
+ BOOL CSoundFile_ReadAMF(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
753
+ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
754
+ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
755
+ BOOL CSoundFile_ReadJ2B(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
756
+ BOOL CSoundFile_ReadUMX(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
757
+ BOOL CSoundFile_ReadABC(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
758
+ BOOL CSoundFile_ReadMID(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
759
+ BOOL CSoundFile_ReadPAT(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength);
760
+
761
+ BOOL CSoundFile_TestABC(LPCBYTE lpStream, DWORD dwMemLength);
762
+ BOOL CSoundFile_TestMID(LPCBYTE lpStream, DWORD dwMemLength);
763
+ BOOL CSoundFile_TestPAT(LPCBYTE lpStream, DWORD dwMemLength);
764
+
765
+ // MOD Convert function
766
+ void CSoundFile_ConvertModCommand(CSoundFile *_this, MODCOMMAND *);
767
+ void CSoundFile_S3MConvert(MODCOMMAND *m, BOOL bIT);
768
+
769
+ // Real-time sound functions
770
+ UINT CSoundFile_Read(CSoundFile *_this, LPVOID lpBuffer, UINT cbBuffer);
771
+ UINT CSoundFile_CreateStereoMix(CSoundFile *_this, int count);
772
+ BOOL CSoundFile_FadeSong(CSoundFile *_this, UINT msec);
773
+ BOOL CSoundFile_GlobalFadeSong(CSoundFile *_this, UINT msec);
774
+
775
+ // Mixer Config
776
+ BOOL CSoundFile_InitPlayer(CSoundFile *_this, BOOL bReset);
777
+ BOOL CSoundFile_SetMixConfig(CSoundFile *_this, UINT nStereoSeparation, UINT nMaxMixChannels);
778
+ BOOL CSoundFile_SetWaveConfig(CSoundFile *_this, UINT nRate,UINT nBits,UINT nChannels);
779
+ BOOL CSoundFile_SetResamplingMode(CSoundFile *_this, UINT nMode); // SRCMODE_XXXX
780
+ DWORD CSoundFile_InitSysInfo(CSoundFile *_this);
781
+
782
+ //GCCFIX -- added these functions back in!
783
+ BOOL CSoundFile_SetWaveConfigEx(CSoundFile *_this, BOOL bSurround,BOOL bNoOverSampling,BOOL bReverb,BOOL hqido,BOOL bMegaBass,BOOL bNR,BOOL bEQ);
784
+ // DSP Effects
785
+ void CSoundFile_InitializeDSP(CSoundFile *_this, BOOL bReset);
786
+ void CSoundFile_ProcessStereoDSP(CSoundFile *_this, int count);
787
+ // [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms]
788
+ BOOL CSoundFile_SetReverbParameters(CSoundFile *_this, UINT nDepth, UINT nDelay);
789
+ // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100]
790
+ BOOL CSoundFile_SetXBassParameters(CSoundFile *_this, UINT nDepth, UINT nRange);
791
+ // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms]
792
+ BOOL CSoundFile_SetSurroundParameters(CSoundFile *_this, UINT nDepth, UINT nDelay);
793
+
794
+ BOOL CSoundFile_ReadNote(CSoundFile *_this);
795
+ BOOL CSoundFile_ProcessRow(CSoundFile *_this);
796
+ BOOL CSoundFile_ProcessEffects(CSoundFile *_this);
797
+ UINT CSoundFile_GetNNAChannel(CSoundFile *_this, UINT nChn);
798
+ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOOL bForceCut);
799
+ void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta, BOOL bResetEnv);
800
+ void CSoundFile_InstrumentChange(CSoundFile *_this, MODCHANNEL *pChn, UINT instr, BOOL bPorta,BOOL bUpdVol,BOOL bResetEnv);
801
+ // Channel Effects
802
+ void CSoundFile_PortamentoUp(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
803
+ void CSoundFile_PortamentoDown(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
804
+ void CSoundFile_FinePortamentoUp(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
805
+ void CSoundFile_FinePortamentoDown(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
806
+ void CSoundFile_ExtraFinePortamentoUp(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
807
+ void CSoundFile_ExtraFinePortamentoDown(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
808
+ void CSoundFile_TonePortamento(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
809
+ void CSoundFile_Vibrato(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
810
+ void CSoundFile_FineVibrato(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
811
+ void CSoundFile_VolumeSlide(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
812
+ void CSoundFile_PanningSlide(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
813
+ void CSoundFile_ChannelVolSlide(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
814
+ void CSoundFile_FineVolumeUp(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
815
+ void CSoundFile_FineVolumeDown(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
816
+ void CSoundFile_Tremolo(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
817
+ void CSoundFile_Panbrello(CSoundFile *_this, MODCHANNEL *pChn, UINT param);
818
+ void CSoundFile_RetrigNote(CSoundFile *_this, UINT nChn, UINT param);
819
+ void CSoundFile_NoteCut(CSoundFile *_this, UINT nChn, UINT nTick);
820
+ void CSoundFile_KeyOff(CSoundFile *_this, UINT nChn);
821
+ int CSoundFile_PatternLoop(CSoundFile *_this, MODCHANNEL *, UINT param);
822
+ void CSoundFile_ExtendedMODCommands(CSoundFile *_this, UINT nChn, UINT param);
823
+ void CSoundFile_ExtendedS3MCommands(CSoundFile *_this, UINT nChn, UINT param);
824
+ void CSoundFile_ExtendedChannelEffect(CSoundFile *_this, MODCHANNEL *, UINT param);
825
+ void CSoundFile_ProcessMidiMacro(CSoundFile *_this, UINT nChn, LPCSTR pszMidiMacro, UINT param);
826
+ void CSoundFile_SetupChannelFilter(CSoundFile *_this, MODCHANNEL *pChn, BOOL bReset, int flt_modifier);
827
+ // Low-Level effect processing
828
+ void CSoundFile_DoFreqSlide(CSoundFile *_this, MODCHANNEL *pChn, LONG nFreqSlide);
829
+ // Global Effects
830
+ void CSoundFile_SetTempo(CSoundFile *_this, UINT param);
831
+ void CSoundFile_SetSpeed(CSoundFile *_this, UINT param);
832
+ void CSoundFile_GlobalVolSlide(CSoundFile *_this, UINT param);
833
+ DWORD CSoundFile_IsSongFinished(CSoundFile *_this, UINT nOrder, UINT nRow);
834
+ BOOL CSoundFile_IsValidBackwardJump(CSoundFile *_this, UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow);
835
+ // Read/Write sample functions
836
+ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags, LPCSTR pMemFile, DWORD dwMemLength);
837
+ BOOL CSoundFile_DestroySample(CSoundFile *_this, UINT nSample);
838
+ BOOL CSoundFile_DestroyInstrument(CSoundFile *_this, UINT nInstr);
839
+ BOOL CSoundFile_IsSampleUsed(CSoundFile *_this, UINT nSample);
840
+ BOOL CSoundFile_IsInstrumentUsed(CSoundFile *_this, UINT nInstr);
841
+ BOOL CSoundFile_RemoveInstrumentSamples(CSoundFile *_this, UINT nInstr);
842
+ UINT CSoundFile_DetectUnusedSamples(CSoundFile *_this, BOOL *);
843
+ void CSoundFile_AdjustSampleLoop(CSoundFile *_this, MODINSTRUMENT *pIns);
844
+ // I/O from another sound file
845
+ BOOL CSoundFile_ReadInstrumentFromSong(CSoundFile *_this, UINT nInstr, CSoundFile *, UINT nSrcInstrument);
846
+ BOOL CSoundFile_ReadSampleFromSong(CSoundFile *_this, UINT nSample, CSoundFile *, UINT nSrcSample);
847
+ // Period/Note functions
848
+ UINT CSoundFile_GetNoteFromPeriod(CSoundFile *_this, UINT period);
849
+ UINT CSoundFile_GetPeriodFromNote(CSoundFile *_this, UINT note, int nFineTune, UINT nC4Speed);
850
+ UINT CSoundFile_GetFreqFromPeriod(CSoundFile *_this, UINT period, UINT nC4Speed, int nPeriodFrac);
851
+ // Misc functions
852
+ void CSoundFile_ResetMidiCfg(CSoundFile *_this);
853
+ UINT CSoundFile_MapMidiInstrument(CSoundFile *_this, DWORD dwProgram, UINT nChannel, UINT nNote);
854
+ BOOL CSoundFile_ITInstrToMPT(const void *p, INSTRUMENTHEADER *penv, UINT trkvers);
855
+
856
+ UINT CSoundFile_LoadMixPlugins(CSoundFile *_this, const void *pData, UINT nLen);
857
+ #ifndef NO_FILTER
858
+ DWORD CSoundFile_CutOffToFrequency(CSoundFile *_this, UINT nCutOff, int flt_modifier); // [0-255] => [1-10KHz]
859
+ #endif
860
+
861
+ DWORD CSoundFile_TransposeToFrequency(int transp, int ftune);
862
+ int CSoundFile_FrequencyToTranspose(DWORD freq);
863
+ void CSoundFile_FrequencyToTransposeInstrument(MODINSTRUMENT *psmp);
864
+
865
+ MODCOMMAND *CSoundFile_AllocatePattern(UINT rows, UINT nchns);
866
+ signed char* CSoundFile_AllocateSample(UINT nbytes);
867
+ void CSoundFile_FreePattern(LPVOID pat);
868
+ void CSoundFile_FreeSample(LPVOID p);
869
+ UINT CSoundFile_Normalize24BitBuffer(LPBYTE pbuffer, UINT cbsizebytes, DWORD lmax24, DWORD dwByteInc);
870
+
871
+
872
+
873
+ #pragma pack(1)
874
+
875
+ typedef struct tagITFILEHEADER
876
+ {
877
+ DWORD id; // 0x4D504D49
878
+ CHAR songname[26];
879
+ WORD reserved1; // 0x1004
880
+ WORD ordnum;
881
+ WORD insnum;
882
+ WORD smpnum;
883
+ WORD patnum;
884
+ WORD cwtv;
885
+ WORD cmwt;
886
+ WORD flags;
887
+ WORD special;
888
+ BYTE globalvol;
889
+ BYTE mv;
890
+ BYTE speed;
891
+ BYTE tempo;
892
+ BYTE sep;
893
+ BYTE zero;
894
+ WORD msglength;
895
+ DWORD msgoffset;
896
+ DWORD reserved2;
897
+ BYTE chnpan[64];
898
+ BYTE chnvol[64];
899
+ } ITFILEHEADER;
900
+
901
+
902
+ typedef struct tagITENVELOPE
903
+ {
904
+ BYTE flags;
905
+ BYTE num;
906
+ BYTE lpb;
907
+ BYTE lpe;
908
+ BYTE slb;
909
+ BYTE sle;
910
+ BYTE data[25*3];
911
+ BYTE reserved;
912
+ } ITENVELOPE;
913
+
914
+ // Old Impulse Instrument Format (cmwt < 0x200)
915
+ typedef struct tagITOLDINSTRUMENT
916
+ {
917
+ DWORD id; // IMPI = 0x49504D49
918
+ CHAR filename[12]; // DOS file name
919
+ BYTE zero;
920
+ BYTE flags;
921
+ BYTE vls;
922
+ BYTE vle;
923
+ BYTE sls;
924
+ BYTE sle;
925
+ WORD reserved1;
926
+ WORD fadeout;
927
+ BYTE nna;
928
+ BYTE dnc;
929
+ WORD trkvers;
930
+ BYTE nos;
931
+ BYTE reserved2;
932
+ WORD reserved3[3];
933
+ BYTE keyboard[240];
934
+ BYTE volenv[200];
935
+ BYTE nodes[50];
936
+ } ITOLDINSTRUMENT;
937
+
938
+
939
+ // Impulse Instrument Format
940
+ typedef struct tagITINSTRUMENT
941
+ {
942
+ DWORD id;
943
+ CHAR filename[12];
944
+ BYTE zero;
945
+ BYTE nna;
946
+ BYTE dct;
947
+ BYTE dca;
948
+ WORD fadeout;
949
+ signed char pps;
950
+ BYTE ppc;
951
+ BYTE gbv;
952
+ BYTE dfp;
953
+ BYTE rv;
954
+ BYTE rp;
955
+ WORD trkvers;
956
+ BYTE nos;
957
+ BYTE reserved1;
958
+ BYTE ifc;
959
+ BYTE ifr;
960
+ BYTE mch;
961
+ BYTE mpr;
962
+ WORD mbank;
963
+ BYTE keyboard[240];
964
+ ITENVELOPE volenv;
965
+ ITENVELOPE panenv;
966
+ ITENVELOPE pitchenv;
967
+ BYTE dummy[4]; // was 7, but IT v2.17 saves 554 bytes
968
+ } ITINSTRUMENT;
969
+
970
+
971
+ // IT Sample Format
972
+ typedef struct ITSAMPLESTRUCT
973
+ {
974
+ DWORD id; // 0x53504D49
975
+ CHAR filename[12];
976
+ BYTE zero;
977
+ BYTE gvl;
978
+ BYTE flags;
979
+ BYTE vol;
980
+ BYTE cvt;
981
+ BYTE dfp;
982
+ DWORD length;
983
+ DWORD loopbegin;
984
+ DWORD loopend;
985
+ DWORD C5Speed;
986
+ DWORD susloopbegin;
987
+ DWORD susloopend;
988
+ DWORD samplepointer;
989
+ BYTE vis;
990
+ BYTE vid;
991
+ BYTE vir;
992
+ BYTE vit;
993
+ } ITSAMPLESTRUCT;
994
+
995
+ #pragma pack()
996
+
997
+ extern BYTE autovibit2xm[8];
998
+ extern BYTE autovibxm2it[8];
999
+
1000
+ #endif
1001
+