gosu 1.3.0 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +108 -14
  3. data/dependencies/SDL/include/SDL_assert.h +81 -50
  4. data/dependencies/SDL/include/SDL_atomic.h +135 -35
  5. data/dependencies/SDL/include/SDL_audio.h +960 -355
  6. data/dependencies/SDL/include/SDL_bits.h +11 -6
  7. data/dependencies/SDL/include/SDL_blendmode.h +91 -14
  8. data/dependencies/SDL/include/SDL_clipboard.h +30 -7
  9. data/dependencies/SDL/include/SDL_config.h +277 -27
  10. data/dependencies/SDL/include/SDL_config_android.h +13 -38
  11. data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
  12. data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
  13. data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
  14. data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
  15. data/dependencies/SDL/include/SDL_config_psp.h +16 -37
  16. data/dependencies/SDL/include/SDL_config_windows.h +28 -91
  17. data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
  18. data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
  19. data/dependencies/SDL/include/SDL_copying.h +1 -1
  20. data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
  21. data/dependencies/SDL/include/SDL_egl.h +906 -280
  22. data/dependencies/SDL/include/SDL_endian.h +101 -47
  23. data/dependencies/SDL/include/SDL_error.h +70 -19
  24. data/dependencies/SDL/include/SDL_events.h +387 -79
  25. data/dependencies/SDL/include/SDL_filesystem.h +73 -64
  26. data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
  27. data/dependencies/SDL/include/SDL_gesture.h +36 -6
  28. data/dependencies/SDL/include/SDL_haptic.h +304 -210
  29. data/dependencies/SDL/include/SDL_hidapi.h +451 -0
  30. data/dependencies/SDL/include/SDL_hints.h +1286 -897
  31. data/dependencies/SDL/include/SDL_joystick.h +577 -130
  32. data/dependencies/SDL/include/SDL_keyboard.h +162 -63
  33. data/dependencies/SDL/include/SDL_keycode.h +7 -5
  34. data/dependencies/SDL/include/SDL_loadso.h +42 -8
  35. data/dependencies/SDL/include/SDL_locale.h +34 -32
  36. data/dependencies/SDL/include/SDL_log.h +212 -19
  37. data/dependencies/SDL/include/SDL_main.h +72 -17
  38. data/dependencies/SDL/include/SDL_messagebox.h +70 -23
  39. data/dependencies/SDL/include/SDL_metal.h +27 -32
  40. data/dependencies/SDL/include/SDL_misc.h +19 -15
  41. data/dependencies/SDL/include/SDL_mouse.h +262 -110
  42. data/dependencies/SDL/include/SDL_mutex.h +286 -66
  43. data/dependencies/SDL/include/SDL_name.h +1 -1
  44. data/dependencies/SDL/include/SDL_opengl.h +1 -1
  45. data/dependencies/SDL/include/SDL_opengles.h +1 -1
  46. data/dependencies/SDL/include/SDL_opengles2.h +2 -2
  47. data/dependencies/SDL/include/SDL_pixels.h +199 -34
  48. data/dependencies/SDL/include/SDL_platform.h +39 -2
  49. data/dependencies/SDL/include/SDL_power.h +23 -10
  50. data/dependencies/SDL/include/SDL_quit.h +1 -1
  51. data/dependencies/SDL/include/SDL_rect.h +78 -28
  52. data/dependencies/SDL/include/SDL_render.h +1204 -472
  53. data/dependencies/SDL/include/SDL_revision.h +2 -2
  54. data/dependencies/SDL/include/SDL_rwops.h +605 -33
  55. data/dependencies/SDL/include/SDL_scancode.h +1 -1
  56. data/dependencies/SDL/include/SDL_sensor.h +76 -42
  57. data/dependencies/SDL/include/SDL_shape.h +38 -27
  58. data/dependencies/SDL/include/SDL_stdinc.h +96 -24
  59. data/dependencies/SDL/include/SDL_surface.h +571 -139
  60. data/dependencies/SDL/include/SDL_system.h +339 -101
  61. data/dependencies/SDL/include/SDL_syswm.h +50 -20
  62. data/dependencies/SDL/include/SDL_test.h +1 -1
  63. data/dependencies/SDL/include/SDL_test_assert.h +2 -2
  64. data/dependencies/SDL/include/SDL_test_common.h +23 -6
  65. data/dependencies/SDL/include/SDL_test_compare.h +1 -1
  66. data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
  67. data/dependencies/SDL/include/SDL_test_font.h +3 -3
  68. data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
  69. data/dependencies/SDL/include/SDL_test_harness.h +6 -6
  70. data/dependencies/SDL/include/SDL_test_images.h +1 -1
  71. data/dependencies/SDL/include/SDL_test_log.h +1 -1
  72. data/dependencies/SDL/include/SDL_test_md5.h +1 -1
  73. data/dependencies/SDL/include/SDL_test_memory.h +1 -1
  74. data/dependencies/SDL/include/SDL_test_random.h +2 -2
  75. data/dependencies/SDL/include/SDL_thread.h +226 -128
  76. data/dependencies/SDL/include/SDL_timer.h +129 -22
  77. data/dependencies/SDL/include/SDL_touch.h +48 -8
  78. data/dependencies/SDL/include/SDL_types.h +1 -1
  79. data/dependencies/SDL/include/SDL_version.h +72 -46
  80. data/dependencies/SDL/include/SDL_video.h +1266 -460
  81. data/dependencies/SDL/include/SDL_vulkan.h +100 -161
  82. data/dependencies/SDL/include/begin_code.h +22 -1
  83. data/dependencies/SDL/include/close_code.h +1 -1
  84. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  85. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  86. data/dependencies/SDL_sound/SDL_sound.c +104 -70
  87. data/dependencies/SDL_sound/SDL_sound.h +6 -6
  88. data/dependencies/SDL_sound/SDL_sound_aiff.c +32 -32
  89. data/dependencies/SDL_sound/SDL_sound_au.c +14 -14
  90. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +6 -7
  91. data/dependencies/SDL_sound/SDL_sound_flac.c +28 -30
  92. data/dependencies/SDL_sound/SDL_sound_internal.h +21 -14
  93. data/dependencies/SDL_sound/SDL_sound_modplug.c +26 -28
  94. data/dependencies/SDL_sound/SDL_sound_mp3.c +20 -36
  95. data/dependencies/SDL_sound/SDL_sound_raw.c +15 -16
  96. data/dependencies/SDL_sound/SDL_sound_shn.c +11 -10
  97. data/dependencies/SDL_sound/SDL_sound_voc.c +20 -18
  98. data/dependencies/SDL_sound/SDL_sound_vorbis.c +11 -9
  99. data/dependencies/SDL_sound/SDL_sound_wav.c +49 -43
  100. data/dependencies/SDL_sound/dr_flac.h +10925 -4466
  101. data/dependencies/SDL_sound/dr_mp3.h +2802 -844
  102. data/dependencies/SDL_sound/libmodplug/fastmix.c +63 -64
  103. data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
  104. data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
  105. data/dependencies/SDL_sound/libmodplug/load_amf.c +12 -7
  106. data/dependencies/SDL_sound/libmodplug/load_ams.c +103 -44
  107. data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
  108. data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
  109. data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
  110. data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
  111. data/dependencies/SDL_sound/libmodplug/load_it.c +61 -61
  112. data/dependencies/SDL_sound/libmodplug/load_mdl.c +94 -58
  113. data/dependencies/SDL_sound/libmodplug/load_med.c +20 -11
  114. data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
  115. data/dependencies/SDL_sound/libmodplug/load_mt2.c +50 -19
  116. data/dependencies/SDL_sound/libmodplug/load_okt.c +59 -28
  117. data/dependencies/SDL_sound/libmodplug/load_psm.c +104 -79
  118. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
  119. data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
  120. data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
  121. data/dependencies/SDL_sound/libmodplug/load_ult.c +4 -3
  122. data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
  123. data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
  124. data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
  125. data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
  126. data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
  127. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
  128. data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
  129. data/dependencies/SDL_sound/libmodplug/snd_fx.c +32 -19
  130. data/dependencies/SDL_sound/libmodplug/sndfile.c +76 -160
  131. data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
  132. data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
  133. data/dependencies/SDL_sound/stb_vorbis.h +504 -329
  134. data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
  135. data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
  136. data/dependencies/mojoAL/mojoal.c +4848 -0
  137. data/dependencies/stb/stb_image.h +208 -73
  138. data/dependencies/stb/stb_image_write.h +57 -23
  139. data/dependencies/stb/stb_truetype.h +345 -279
  140. data/dependencies/utf8proc/utf8proc.c +37 -18
  141. data/dependencies/utf8proc/utf8proc.h +17 -5
  142. data/dependencies/utf8proc/utf8proc_data.h +12012 -10089
  143. data/ext/gosu/extconf.rb +29 -30
  144. data/include/Gosu/Audio.hpp +70 -85
  145. data/include/Gosu/Buttons.hpp +103 -103
  146. data/include/Gosu/Color.hpp +19 -11
  147. data/include/Gosu/Directories.hpp +31 -24
  148. data/include/Gosu/Font.hpp +42 -44
  149. data/include/Gosu/Gosu.hpp +5 -8
  150. data/include/Gosu/Graphics.hpp +58 -71
  151. data/include/Gosu/GraphicsBase.hpp +26 -33
  152. data/include/Gosu/IO.hpp +0 -3
  153. data/include/Gosu/Image.hpp +56 -62
  154. data/include/Gosu/ImageData.hpp +23 -27
  155. data/include/Gosu/Inspection.hpp +1 -4
  156. data/include/Gosu/Math.hpp +0 -3
  157. data/include/Gosu/TextInput.hpp +34 -40
  158. data/include/Gosu/Timing.hpp +2 -8
  159. data/include/Gosu/Version.hpp +2 -2
  160. data/include/Gosu/Window.hpp +71 -70
  161. data/lib/SDL2.dll +0 -0
  162. data/lib/gosu/compat.rb +24 -37
  163. data/lib/gosu.rb +2 -2
  164. data/lib64/SDL2.dll +0 -0
  165. data/src/Audio.cpp +88 -86
  166. data/src/AudioFile.hpp +6 -6
  167. data/src/AudioFileAudioToolbox.cpp +1 -1
  168. data/src/AudioFileSDLSound.cpp +1 -1
  169. data/src/AudioImpl.cpp +0 -7
  170. data/src/AudioImpl.hpp +6 -8
  171. data/src/BitmapIO.cpp +23 -22
  172. data/src/BlockAllocator.cpp +2 -1
  173. data/src/Channel.cpp +22 -20
  174. data/src/Color.cpp +12 -9
  175. data/src/DirectoriesApple.cpp +25 -24
  176. data/src/DirectoriesUnix.cpp +14 -12
  177. data/src/DirectoriesWin.cpp +26 -30
  178. data/src/EmptyImageData.hpp +15 -17
  179. data/src/FileUnix.cpp +1 -1
  180. data/src/FileWin.cpp +1 -1
  181. data/src/Font.cpp +59 -54
  182. data/src/Graphics.cpp +135 -143
  183. data/src/Image.cpp +41 -47
  184. data/src/Input.cpp +1 -1
  185. data/src/InputUIKit.cpp +1 -1
  186. data/src/LargeImageData.cpp +108 -101
  187. data/src/LargeImageData.hpp +17 -15
  188. data/src/Log.hpp +6 -6
  189. data/src/Macro.cpp +35 -37
  190. data/src/Macro.hpp +11 -11
  191. data/src/Math.cpp +8 -1
  192. data/src/Resolution.cpp +12 -7
  193. data/src/RubyGosu.cxx +11 -39
  194. data/src/TexChunk.cpp +50 -41
  195. data/src/TexChunk.hpp +22 -22
  196. data/src/Text.cpp +37 -37
  197. data/src/TextBuilder.cpp +60 -57
  198. data/src/TextBuilder.hpp +20 -20
  199. data/src/TextInput.cpp +127 -135
  200. data/src/TimingApple.cpp +1 -7
  201. data/src/TimingUnix.cpp +0 -6
  202. data/src/TimingWin.cpp +0 -6
  203. data/src/TrueTypeFont.cpp +107 -107
  204. data/src/TrueTypeFont.hpp +39 -38
  205. data/src/TrueTypeFontApple.cpp +19 -22
  206. data/src/TrueTypeFontUnix.cpp +21 -26
  207. data/src/TrueTypeFontWin.cpp +30 -30
  208. data/src/Window.cpp +97 -87
  209. data/src/WindowUIKit.cpp +46 -49
  210. metadata +7 -17
  211. data/dependencies/SDL/include/SDL_config_os2.h +0 -188
  212. data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
  213. data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
  214. data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
  215. data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
  216. data/dependencies/al_soft/AL/alext.h +0 -585
  217. data/dependencies/al_soft/AL/efx-creative.h +0 -3
  218. data/dependencies/al_soft/AL/efx-presets.h +0 -402
  219. data/dependencies/al_soft/AL/efx.h +0 -762
  220. data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
  221. data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
  222. data/lib/OpenAL32.dll +0 -0
  223. data/lib64/OpenAL32.dll +0 -0
@@ -5,7 +5,6 @@
5
5
  * Adam Goode <adam@evdebs.org> (endian and char fixes for PPC)
6
6
  */
7
7
 
8
- #include <math.h> //for GCCFIX
9
8
  #include "modplug.h"
10
9
  #include "libmodplug.h"
11
10
 
@@ -15,26 +14,8 @@ extern BOOL MMCMP_Unpack(LPCBYTE *ppMemFile, LPDWORD pdwMemLength);
15
14
  extern void AMSUnpack(const char *psrc, UINT inputlen, char *pdest, UINT dmax, char packcharacter);
16
15
  extern WORD MDLReadBits(DWORD *bitbuf, UINT *bitnum, LPBYTE *ibuf, CHAR n);
17
16
  extern int DMFUnpack(LPBYTE psample, LPBYTE ibuf, LPBYTE ibufmax, UINT maxlen);
18
- extern void ITUnpack8Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215);
19
- extern void ITUnpack16Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, BOOL b215);
20
-
21
-
22
- #define MAX_PACK_TABLES 3
23
-
24
-
25
- // Compression table
26
- static const signed char UnpackTable[MAX_PACK_TABLES][16] =
27
- //--------------------------------------------
28
- {
29
- // CPU-generated dynamic table
30
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
31
- // u-Law table
32
- {0, 1, 2, 4, 8, 16, 32, 64,
33
- -1, -2, -4, -8, -16, -32, -48, -64},
34
- // Linear table
35
- {0, 1, 2, 3, 5, 7, 12, 19,
36
- -1, -2, -3, -5, -7, -12, -19, -31}
37
- };
17
+ extern DWORD ITUnpack8Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, DWORD channels, BOOL b215);
18
+ extern DWORD ITUnpack16Bit(signed char *pSample, DWORD dwLen, LPBYTE lpMemFile, DWORD dwMemLength, DWORD channels, BOOL b215);
38
19
 
39
20
 
40
21
  static void CSoundFile_UpdateSettings(CSoundFile *_this, const ModPlug_Settings *settings)
@@ -55,35 +36,36 @@ static void CSoundFile_UpdateSettings(CSoundFile *_this, const ModPlug_Settings
55
36
  _this->gSampleSize = settings->mBits / 8 * settings->mChannels;
56
37
 
57
38
  CSoundFile_SetWaveConfigEx(_this, settings->mFlags & MODPLUG_ENABLE_SURROUND,
58
- !(settings->mFlags & MODPLUG_ENABLE_OVERSAMPLING),
59
- settings->mFlags & MODPLUG_ENABLE_REVERB,
60
- TRUE,
61
- settings->mFlags & MODPLUG_ENABLE_MEGABASS,
62
- settings->mFlags & MODPLUG_ENABLE_NOISE_REDUCTION,
63
- FALSE);
39
+ !(settings->mFlags & MODPLUG_ENABLE_OVERSAMPLING),
40
+ settings->mFlags & MODPLUG_ENABLE_REVERB,
41
+ TRUE,
42
+ settings->mFlags & MODPLUG_ENABLE_MEGABASS,
43
+ settings->mFlags & MODPLUG_ENABLE_NOISE_REDUCTION,
44
+ FALSE);
64
45
  CSoundFile_SetResamplingMode(_this, settings->mResamplingMode);
65
46
  }
66
47
 
67
48
  CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Settings *settings)
68
49
  //----------------------------------------------------------
69
50
  {
70
- CSoundFile *_this = (CSoundFile *) SDL_calloc(1, sizeof (CSoundFile));
71
- if (!_this) return NULL;
72
51
  int i;
73
52
 
74
- _this->m_nXBassDepth = 6;
75
- _this->m_nXBassRange = XBASS_DELAY;
76
- _this->m_nReverbDepth = 1;
77
- _this->m_nReverbDelay = 100;
78
- _this->m_nProLogicDepth = 12;
79
- _this->m_nProLogicDelay = 20;
80
- _this->m_nStereoSeparation = 128;
81
- _this->m_nMaxMixChannels = 32;
82
- _this->gnChannels = 1;
83
- _this->gdwSoundSetup = 0;
84
- _this->gdwMixingFreq = 44100;
85
- _this->gnBitsPerSample = 16;
86
- _this->gnVolumeRampSamples = 64;
53
+ CSoundFile *_this = (CSoundFile *) SDL_calloc(1, sizeof (CSoundFile));
54
+ if (!_this) return NULL;
55
+
56
+ _this->m_nXBassDepth = 6;
57
+ _this->m_nXBassRange = XBASS_DELAY;
58
+ _this->m_nReverbDepth = 1;
59
+ _this->m_nReverbDelay = 100;
60
+ _this->m_nProLogicDepth = 12;
61
+ _this->m_nProLogicDelay = 20;
62
+ _this->m_nStereoSeparation = 128;
63
+ _this->m_nMaxMixChannels = 32;
64
+ _this->gnChannels = 1;
65
+ _this->gdwSoundSetup = 0;
66
+ _this->gdwMixingFreq = 44100;
67
+ _this->gnBitsPerSample = 16;
68
+ _this->gnVolumeRampSamples = 64;
87
69
 
88
70
  _this->m_nFreqFactor = _this->m_nTempoFactor = 128;
89
71
  _this->m_nMasterVolume = 128;
@@ -109,10 +91,6 @@ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Se
109
91
  && (!CSoundFile_ReadS3M(_this, lpStream, dwMemLength))
110
92
  && (!CSoundFile_ReadIT(_this, lpStream, dwMemLength))
111
93
  #ifndef MODPLUG_BASIC_SUPPORT
112
- /* Sequencer File Format Support */
113
- && (!CSoundFile_ReadABC(_this, lpStream, dwMemLength))
114
- && (!CSoundFile_ReadMID(_this, lpStream, dwMemLength))
115
- && (!CSoundFile_ReadPAT(_this, lpStream, dwMemLength))
116
94
  && (!CSoundFile_ReadSTM(_this, lpStream, dwMemLength))
117
95
  && (!CSoundFile_ReadMed(_this, lpStream, dwMemLength))
118
96
  && (!CSoundFile_ReadMTM(_this, lpStream, dwMemLength))
@@ -126,6 +104,7 @@ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Se
126
104
  && (!CSoundFile_ReadUlt(_this, lpStream, dwMemLength))
127
105
  && (!CSoundFile_ReadDMF(_this, lpStream, dwMemLength))
128
106
  && (!CSoundFile_ReadDSM(_this, lpStream, dwMemLength))
107
+ && (!CSoundFile_ReadGDM(_this, lpStream, dwMemLength))
129
108
  && (!CSoundFile_ReadUMX(_this, lpStream, dwMemLength))
130
109
  && (!CSoundFile_ReadAMF(_this, lpStream, dwMemLength))
131
110
  && (!CSoundFile_ReadPSM(_this, lpStream, dwMemLength))
@@ -134,7 +113,7 @@ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Se
134
113
  && (!CSoundFile_ReadMod(_this, lpStream, dwMemLength))) _this->m_nType = MOD_TYPE_NONE;
135
114
  if (bMMCmp)
136
115
  {
137
- GlobalFreePtr(lpStream);
116
+ SDL_free((void*)lpStream);
138
117
  lpStream = NULL;
139
118
  }
140
119
  }
@@ -181,7 +160,7 @@ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Se
181
160
  if (pins->nGlobalVol > 64) pins->nGlobalVol = 64;
182
161
  }
183
162
  // Check invalid instruments
184
- while ((_this->m_nInstruments > 0) && (!_this->Headers[_this->m_nInstruments]))
163
+ while ((_this->m_nInstruments > 0) && (!_this->Headers[_this->m_nInstruments]))
185
164
  _this->m_nInstruments--;
186
165
  // Set default values
187
166
  if (_this->m_nSongPreAmp < 0x20) _this->m_nSongPreAmp = 0x20;
@@ -203,10 +182,10 @@ CSoundFile *new_CSoundFile(LPCBYTE lpStream, DWORD dwMemLength, const ModPlug_Se
203
182
  UINT maxpreamp = 0x10+(_this->m_nChannels*8);
204
183
  if (maxpreamp > 100) maxpreamp = 100;
205
184
  if (_this->m_nSongPreAmp > maxpreamp) _this->m_nSongPreAmp = maxpreamp;
206
- CSoundFile_UpdateSettings(_this, settings);
185
+ CSoundFile_UpdateSettings(_this, settings);
207
186
  return _this;
208
187
  }
209
- SDL_free(_this);
188
+ SDL_free(_this);
210
189
  return NULL;
211
190
  }
212
191
 
@@ -245,7 +224,7 @@ void delete_CSoundFile(CSoundFile *_this)
245
224
  _this->m_nType = MOD_TYPE_NONE;
246
225
  _this->m_nChannels = _this->m_nSamples = _this->m_nInstruments = 0;
247
226
 
248
- SDL_free(_this);
227
+ SDL_free(_this);
249
228
  }
250
229
 
251
230
 
@@ -269,7 +248,7 @@ void CSoundFile_FreePattern(LPVOID pat)
269
248
  signed char* CSoundFile_AllocateSample(UINT nbytes)
270
249
  //-------------------------------------------
271
250
  {
272
- signed char * p = (signed char *)GlobalAllocPtr(GHND, (nbytes+39) & ~7);
251
+ signed char * p = (signed char *) SDL_calloc(1, (nbytes+39) & ~7);
273
252
  if (p) p += 16;
274
253
  return p;
275
254
  }
@@ -278,9 +257,8 @@ signed char* CSoundFile_AllocateSample(UINT nbytes)
278
257
  void CSoundFile_FreeSample(LPVOID p)
279
258
  //-----------------------------------
280
259
  {
281
- if (p)
282
- {
283
- GlobalFreePtr(((LPSTR)p)-16);
260
+ if (p) {
261
+ SDL_free((char*)p - 16);
284
262
  }
285
263
  }
286
264
 
@@ -302,8 +280,6 @@ void CSoundFile_ResetMidiCfg(CSoundFile *_this)
302
280
  }
303
281
 
304
282
 
305
-
306
-
307
283
  BOOL CSoundFile_SetWaveConfig(CSoundFile *_this, UINT nRate,UINT nBits,UINT nChannels)
308
284
  //----------------------------------------------------------------------------
309
285
  {
@@ -456,6 +432,7 @@ void CSoundFile_SetCurrentPos(CSoundFile *_this, UINT nPos)
456
432
  }
457
433
  _this->m_nNextPattern = nPattern;
458
434
  _this->m_nNextRow = nRow;
435
+ _this->m_nNextStartRow = 0;
459
436
  _this->m_nTickCount = _this->m_nMusicSpeed;
460
437
  _this->m_nBufferCount = 0;
461
438
  _this->m_nPatternDelay = 0;
@@ -476,11 +453,12 @@ void CSoundFile_SetCurrentPos(CSoundFile *_this, UINT nPos)
476
453
  UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags, LPCSTR lpMemFile, DWORD dwMemLength)
477
454
  //------------------------------------------------------------------------------
478
455
  {
479
- UINT len = 0, mem = pIns->nLength+6;
456
+ UINT len = 0, mem;
480
457
 
481
458
  // Disable >2Gb samples,(preventing buffer overflow in AllocateSample)
482
459
  if ((!pIns) || ((int)pIns->nLength < 4) || (!lpMemFile)) return 0;
483
460
  if (pIns->nLength > MAX_SAMPLE_LENGTH) pIns->nLength = MAX_SAMPLE_LENGTH;
461
+ mem = pIns->nLength+6;
484
462
  pIns->uFlags &= ~(CHN_16BIT|CHN_STEREO);
485
463
  if (nFlags & RSF_16BIT)
486
464
  {
@@ -530,18 +508,18 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
530
508
  case RS_ADPCM4:
531
509
  {
532
510
  len = (pIns->nLength + 1) / 2;
533
- if (len > dwMemLength - 16) break;
511
+ if (len > dwMemLength - 16 || dwMemLength < 16) break;
534
512
  SDL_memcpy(_this->CompressionTable, lpMemFile, 16);
535
513
  lpMemFile += 16;
536
514
  signed char *pSample = pIns->pSample;
537
- signed char delta = 0;
515
+ signed char delta = 0;
538
516
  for (UINT j=0; j<len; j++)
539
517
  {
540
518
  const BYTE b0 = (BYTE)lpMemFile[j];
541
519
  const BYTE b1 = (BYTE)(lpMemFile[j] >> 4);
542
- delta = (signed char)(delta + _this->CompressionTable[b0 & 0x0F]);
520
+ delta = (signed char)(delta + _this->CompressionTable[b0 & 0x0F]);
543
521
  pSample[0] = delta;
544
- delta = (signed char)(delta + _this->CompressionTable[b1 & 0x0F]);
522
+ delta = (signed char)(delta + _this->CompressionTable[b1 & 0x0F]);
545
523
  pSample[1] = (signed char)(delta + _this->CompressionTable[b1 & 0x0F]);
546
524
  pSample += 2;
547
525
  }
@@ -687,9 +665,26 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
687
665
  len = dwMemLength;
688
666
  if (len < 4) break;
689
667
  if ((nFlags == RS_IT2148) || (nFlags == RS_IT2158))
690
- ITUnpack8Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, (nFlags == RS_IT2158));
668
+ ITUnpack8Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, 1, (nFlags == RS_IT2158));
691
669
  else
692
- ITUnpack16Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, (nFlags == RS_IT21516));
670
+ ITUnpack16Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, 1, (nFlags == RS_IT21516));
671
+ break;
672
+
673
+ case RS_IT2148 | RSF_STEREO:
674
+ case RS_IT21416 | RSF_STEREO:
675
+ case RS_IT2158 | RSF_STEREO:
676
+ case RS_IT21516 | RSF_STEREO:
677
+ len = dwMemLength;
678
+ if (len < 4) break;
679
+ if ((nFlags == (RS_IT2148 | RSF_STEREO)) || (nFlags == (RS_IT2158 | RSF_STEREO)))
680
+ {
681
+ DWORD offset = ITUnpack8Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, 2, (nFlags == (RS_IT2158 | RSF_STEREO)));
682
+ ITUnpack8Bit(pIns->pSample + 1, pIns->nLength, (LPBYTE)lpMemFile + offset, dwMemLength - offset, 2, (nFlags == (RS_IT2158 | RSF_STEREO)));
683
+ } else
684
+ {
685
+ DWORD offset = ITUnpack16Bit(pIns->pSample, pIns->nLength, (LPBYTE)lpMemFile, dwMemLength, 2, (nFlags == (RS_IT21516 | RSF_STEREO)));
686
+ ITUnpack16Bit(pIns->pSample + 2, pIns->nLength, (LPBYTE)lpMemFile + offset, dwMemLength - offset, 2, (nFlags == (RS_IT21516 | RSF_STEREO)));
687
+ }
693
688
  break;
694
689
 
695
690
  #ifndef MODPLUG_BASIC_SUPPORT
@@ -741,28 +736,30 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
741
736
  {
742
737
  const char *psrc = lpMemFile;
743
738
  char packcharacter = lpMemFile[8], *pdest = (char *)pIns->pSample;
744
- len += bswapLE32(*((LPDWORD)(lpMemFile+4)));
745
- if (len > dwMemLength) len = dwMemLength;
739
+ UINT smplen = bswapLE32(*((LPDWORD)(lpMemFile+4)));
740
+ if (smplen > dwMemLength - 9) smplen = dwMemLength - 9;
741
+ len += smplen;
746
742
  UINT dmax = pIns->nLength;
747
743
  if (pIns->uFlags & CHN_16BIT) dmax <<= 1;
748
- AMSUnpack(psrc+9, len-9, pdest, dmax, packcharacter);
744
+ AMSUnpack(psrc+9, smplen, pdest, dmax, packcharacter);
749
745
  }
750
746
  break;
751
747
 
752
748
  // PTM 8bit delta to 16-bit sample
753
749
  case RS_PTM8DTO16:
754
750
  {
751
+ UINT j;
755
752
  len = pIns->nLength * 2;
756
753
  if (len > dwMemLength) break;
757
754
  int8_t *pSample = (int8_t *)pIns->pSample;
758
755
  int8_t delta8 = 0;
759
- for (UINT j=0; j<len; j++)
756
+ for (j=0; j<len; j++)
760
757
  {
761
758
  delta8 += lpMemFile[j];
762
759
  *pSample++ = delta8;
763
760
  }
764
761
  uint16_t *pSampleW = (uint16_t *)pIns->pSample;
765
- for (UINT j=0; j<len; j+=2) // swaparoni!
762
+ for (j=0; j<len; j+=2) // swaparoni!
766
763
  {
767
764
  uint16_t rawSample = *pSampleW;
768
765
  *pSampleW++ = bswapLE16(rawSample);
@@ -781,8 +778,9 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
781
778
  DWORD bitbuf = bswapLE32(*((DWORD *)ibuf));
782
779
  UINT bitnum = 32;
783
780
  BYTE dlt = 0, lowbyte = 0;
781
+ LPBYTE ibufend = (LPBYTE)lpMemFile + dwMemLength - 1;
784
782
  ibuf += 4;
785
- for (UINT j=0; j<pIns->nLength; j++)
783
+ for (UINT j=0; j<pIns->nLength && ibuf < ibufend; j++)
786
784
  {
787
785
  BYTE hibyte;
788
786
  BYTE sign;
@@ -794,7 +792,9 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
794
792
  } else
795
793
  {
796
794
  hibyte = 8;
797
- while (!MDLReadBits(&bitbuf, &bitnum, &ibuf, 1)) hibyte += 0x10;
795
+ while (ibuf < ibufend && !MDLReadBits(&bitbuf, &bitnum, &ibuf, 1))
796
+ hibyte += 0x10;
797
+ if (ibuf < ibufend)
798
798
  hibyte += MDLReadBits(&bitbuf, &bitnum, &ibuf, 4);
799
799
  }
800
800
  if (sign) hibyte = ~hibyte;
@@ -821,88 +821,6 @@ UINT CSoundFile_ReadSample(CSoundFile *_this, MODINSTRUMENT *pIns, UINT nFlags,
821
821
  len = DMFUnpack((LPBYTE)pIns->pSample, ibuf, ibufmax, maxlen);
822
822
  }
823
823
  break;
824
-
825
- #ifdef MODPLUG_TRACKER
826
- // PCM 24-bit signed -> load sample, and normalize it to 16-bit
827
- case RS_PCM24S:
828
- case RS_PCM32S:
829
- len = pIns->nLength * 3;
830
- if (nFlags == RS_PCM32S) len += pIns->nLength;
831
- if (len > dwMemLength) break;
832
- if (len > 4*8)
833
- {
834
- UINT slsize = (nFlags == RS_PCM32S) ? 4 : 3;
835
- LPBYTE pSrc = (LPBYTE)lpMemFile;
836
- LONG max = 255;
837
- if (nFlags == RS_PCM32S) pSrc++;
838
- for (UINT j=0; j<len; j+=slsize)
839
- {
840
- LONG l = ((((pSrc[j+2] << 8) + pSrc[j+1]) << 8) + pSrc[j]) << 8;
841
- l /= 256;
842
- if (l > max) max = l;
843
- if (-l > max) max = -l;
844
- }
845
- max = (max / 128) + 1;
846
- int16_t *pDest = (int16_t *)pIns->pSample;
847
- for (UINT k=0; k<len; k+=slsize)
848
- {
849
- LONG l = ((((pSrc[k+2] << 8) + pSrc[k+1]) << 8) + pSrc[k]) << 8;
850
- *pDest++ = (uint16_t)(l / max);
851
- }
852
- }
853
- break;
854
-
855
- // Stereo PCM 24-bit signed -> load sample, and normalize it to 16-bit
856
- case RS_STIPCM24S:
857
- case RS_STIPCM32S:
858
- len = pIns->nLength * 6;
859
- if (nFlags == RS_STIPCM32S) len += pIns->nLength * 2;
860
- if (len > dwMemLength) break;
861
- if (len > 8*8)
862
- {
863
- UINT slsize = (nFlags == RS_STIPCM32S) ? 4 : 3;
864
- LPBYTE pSrc = (LPBYTE)lpMemFile;
865
- LONG max = 255;
866
- if (nFlags == RS_STIPCM32S) pSrc++;
867
- for (UINT j=0; j<len; j+=slsize)
868
- {
869
- LONG l = ((((pSrc[j+2] << 8) + pSrc[j+1]) << 8) + pSrc[j]) << 8;
870
- l /= 256;
871
- if (l > max) max = l;
872
- if (-l > max) max = -l;
873
- }
874
- max = (max / 128) + 1;
875
- int16_t *pDest = (int16_t *)pIns->pSample;
876
- for (UINT k=0; k<len; k+=slsize)
877
- {
878
- LONG lr = ((((pSrc[k+2] << 8) + pSrc[k+1]) << 8) + pSrc[k]) << 8;
879
- k += slsize;
880
- LONG ll = ((((pSrc[k+2] << 8) + pSrc[k+1]) << 8) + pSrc[k]) << 8;
881
- pDest[0] = (int16_t)ll;
882
- pDest[1] = (int16_t)lr;
883
- pDest += 2;
884
- }
885
- }
886
- break;
887
-
888
- // 16-bit signed big endian interleaved stereo
889
- case RS_STIPCM16M:
890
- {
891
- len = pIns->nLength;
892
- if (len*4 > dwMemLength) len = dwMemLength >> 2;
893
- LPCBYTE psrc = (LPCBYTE)lpMemFile;
894
- int16_t *pSample = (int16_t *)pIns->pSample;
895
- for (UINT j=0; j<len; j++)
896
- {
897
- pSample[j*2] = (int16_t)(((UINT)psrc[0] << 8) | (psrc[1]));
898
- pSample[j*2+1] = (int16_t)(((UINT)psrc[2] << 8) | (psrc[3]));
899
- psrc += 4;
900
- }
901
- len *= 4;
902
- }
903
- break;
904
-
905
- #endif // MODPLUG_TRACKER
906
824
  #endif // !MODPLUG_BASIC_SUPPORT
907
825
 
908
826
  // Default: 8-bit signed PCM data
@@ -992,7 +910,6 @@ void CSoundFile_AdjustSampleLoop(CSoundFile *_this, MODINSTRUMENT *pIns)
992
910
  }
993
911
  }
994
912
  }
995
-
996
913
  // Adjust end of sample
997
914
  if (pIns->uFlags & CHN_STEREO)
998
915
  {
@@ -1056,15 +973,15 @@ void CSoundFile_FrequencyToTransposeInstrument(MODINSTRUMENT *psmp)
1056
973
 
1057
974
  void CSoundFile_SetRepeatCount(CSoundFile *_this, int n)
1058
975
  {
1059
- _this->m_nRepeatCount = n;
1060
- _this->m_nInitialRepeatCount = n;
976
+ _this->m_nRepeatCount = n;
977
+ _this->m_nInitialRepeatCount = n;
1061
978
  }
1062
979
 
1063
980
  BOOL CSoundFile_SetPatternName(CSoundFile *_this, UINT nPat, LPCSTR lpszName)
1064
981
  //---------------------------------------------------------
1065
982
  {
1066
- char szName[MAX_PATTERNNAME];
1067
- szName[0] = 0;
983
+ char szName[MAX_PATTERNNAME];
984
+ szName[0] = 0;
1068
985
  // check input arguments
1069
986
  if (nPat >= MAX_PATTERNS) return FALSE;
1070
987
  if (lpszName == NULL) return(FALSE);
@@ -1076,9 +993,8 @@ BOOL CSoundFile_SetPatternName(CSoundFile *_this, UINT nPat, LPCSTR lpszName)
1076
993
  {
1077
994
  if (!lpszName[0]) return TRUE;
1078
995
  UINT len = (nPat+1)*MAX_PATTERNNAME;
1079
- char *p = (char *) SDL_malloc(len);
996
+ char *p = (char *) SDL_calloc(1, len);
1080
997
  if (!p) return FALSE;
1081
- SDL_memset(p, 0, len);
1082
998
  if (_this->m_lpszPatternNames)
1083
999
  {
1084
1000
  SDL_memcpy(p, _this->m_lpszPatternNames, _this->m_nPatternNames * MAX_PATTERNNAME);
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  #include "libmodplug.h"
8
+ #define SNDMIX_C
8
9
  #include "tables.h"
9
10
 
10
11
  // Volume ramp length, in 1/10 ms
@@ -25,7 +26,7 @@ extern VOID MPPASMCALL X86_MonoFromStereo(int *pMixBuf, UINT nSamples);
25
26
 
26
27
  // Log tables for pre-amp
27
28
  // We don't want the tracker to get too loud
28
- const UINT PreAmpTable[16] =
29
+ static const UINT PreAmpTable[16] =
29
30
  {
30
31
  0x60, 0x60, 0x60, 0x70, // 0-7
31
32
  0x80, 0x88, 0x90, 0x98, // 8-15
@@ -33,7 +34,7 @@ const UINT PreAmpTable[16] =
33
34
  0xB4, 0xB8, 0xBC, 0xC0, // 24-31
34
35
  };
35
36
 
36
- const UINT PreAmpAGCTable[16] =
37
+ static const UINT PreAmpAGCTable[16] =
37
38
  {
38
39
  0x60, 0x60, 0x60, 0x60,
39
40
  0x68, 0x70, 0x78, 0x80,
@@ -48,7 +49,6 @@ int _muldiv(long a, long b, long c)
48
49
  return ((uint64_t) a * (uint64_t) b ) / c;
49
50
  }
50
51
 
51
-
52
52
  // Return (a*b+c/2)/c - no divide error
53
53
  int _muldivr(long a, long b, long c)
54
54
  {
@@ -188,7 +188,6 @@ MixDone:
188
188
  }
189
189
 
190
190
 
191
-
192
191
  /////////////////////////////////////////////////////////////////////////////
193
192
  // Handles navigation/effects
194
193
 
@@ -260,14 +259,16 @@ BOOL CSoundFile_ProcessRow(CSoundFile *_this)
260
259
  _this->m_nNextPattern = _this->m_nCurrentPattern;
261
260
  }
262
261
  // Weird stuff?
263
- if ((_this->m_nPattern >= MAX_PATTERNS) || (!_this->Patterns[_this->m_nPattern])) return FALSE;
262
+ if ((_this->m_nPattern >= MAX_PATTERNS) || (!_this->Patterns[_this->m_nPattern]) ||
263
+ _this->PatternSize[_this->m_nPattern] == 0) return FALSE;
264
264
  // Should never happen
265
265
  if (_this->m_nRow >= _this->PatternSize[_this->m_nPattern]) _this->m_nRow = 0;
266
266
  _this->m_nNextRow = _this->m_nRow + 1;
267
267
  if (_this->m_nNextRow >= _this->PatternSize[_this->m_nPattern])
268
268
  {
269
269
  if (!(_this->m_dwSongFlags & SONG_PATTERNLOOP)) _this->m_nNextPattern = _this->m_nCurrentPattern + 1;
270
- _this->m_nNextRow = 0;
270
+ _this->m_nNextRow = _this->m_nNextStartRow;
271
+ _this->m_nNextStartRow = 0;
271
272
  }
272
273
  // Reset channel values
273
274
  MODCHANNEL *pChn = _this->Chn;
@@ -890,11 +891,7 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
890
891
  pChn->pCurrentSample = ((pChn->pSample) && (pChn->nLength) && (pChn->nInc)) ? pChn->pSample : NULL;
891
892
  if (pChn->pCurrentSample)
892
893
  {
893
- #ifdef MODPLUG_TRACKER
894
- UINT kChnMasterVol = (pChn->dwFlags & CHN_EXTRALOUD) ? 0x100 : nMasterVol;
895
- #else
896
894
  #define kChnMasterVol nMasterVol
897
- #endif // MODPLUG_TRACKER
898
895
  // Adjusting volumes
899
896
  if (_this->gnChannels >= 2)
900
897
  {
@@ -1030,5 +1027,3 @@ BOOL CSoundFile_ReadNote(CSoundFile *_this)
1030
1027
  }
1031
1028
  return TRUE;
1032
1029
  }
1033
-
1034
-
@@ -6,6 +6,7 @@
6
6
 
7
7
  #include "libmodplug.h"
8
8
 
9
+ #ifdef SNDFX_C
9
10
  static const BYTE ImpulseTrackerPortaVolCmd[16] =
10
11
  {
11
12
  0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60,
@@ -23,7 +24,6 @@ static const WORD ProTrackerPeriodTable[6*12] =
23
24
  53,50,47,45,42,40,37,35,33,31,30,28
24
25
  };
25
26
 
26
-
27
27
  static const WORD ProTrackerTunedPeriods[16*12] =
28
28
  {
29
29
  1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907,
@@ -44,7 +44,6 @@ static const WORD ProTrackerTunedPeriods[16*12] =
44
44
  1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914
45
45
  };
46
46
 
47
-
48
47
  // S3M C-4 periods
49
48
  static const WORD FreqS3MTable[16] =
50
49
  {
@@ -53,15 +52,15 @@ static const WORD FreqS3MTable[16] =
53
52
  0,0,0,0
54
53
  };
55
54
 
56
-
57
55
  // S3M FineTune frequencies
58
56
  static const WORD S3MFineTuneTable[16] =
59
57
  {
60
58
  7895,7941,7985,8046,8107,8169,8232,8280,
61
59
  8363,8413,8463,8529,8581,8651,8723,8757, // 8363*2^((i-8)/(12*8))
62
60
  };
61
+ #endif
63
62
 
64
-
63
+ #ifdef SNDMIX_C
65
64
  // Sinus table
66
65
  static const int16_t ModSinusTable[64] =
67
66
  {
@@ -97,8 +96,9 @@ static const int16_t ModRandomTable[64] =
97
96
  -23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118,
98
97
  42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95
99
98
  };
99
+ #endif
100
100
 
101
-
101
+ #ifdef SNDFX_C
102
102
  // volume fade tables for Retrig Note:
103
103
  static const int8_t retrigTable1[16] =
104
104
  { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 };
@@ -106,8 +106,6 @@ static const int8_t retrigTable1[16] =
106
106
  static const int8_t retrigTable2[16] =
107
107
  { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 };
108
108
 
109
-
110
-
111
109
  static const WORD XMPeriodTable[104] =
112
110
  {
113
111
  907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814,
@@ -119,7 +117,6 @@ static const WORD XMPeriodTable[104] =
119
117
  453,450,447,443,440,437,434,431
120
118
  };
121
119
 
122
-
123
120
  static const uint32_t XMLinearTable[768] =
124
121
  {
125
122
  535232,534749,534266,533784,533303,532822,532341,531861,
@@ -220,8 +217,9 @@ static const uint32_t XMLinearTable[768] =
220
217
  271508,271263,271018,270774,270530,270286,270042,269798,
221
218
  269555,269312,269069,268826,268583,268341,268099,267857
222
219
  };
220
+ #endif
223
221
 
224
-
222
+ #ifdef SNDMIX_C
225
223
  static const int8_t ft2VibratoTable[256] =
226
224
  {
227
225
  0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
@@ -241,8 +239,7 @@ static const int8_t ft2VibratoTable[256] =
241
239
  48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27,
242
240
  26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2
243
241
  };
244
-
245
-
242
+ #endif
246
243
 
247
244
  static const DWORD FineLinearSlideUpTable[16] =
248
245
  {
@@ -250,14 +247,12 @@ static const DWORD FineLinearSlideUpTable[16] =
250
247
  66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429
251
248
  };
252
249
 
253
-
254
250
  static const DWORD FineLinearSlideDownTable[16] =
255
251
  {
256
252
  65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123,
257
253
  65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645
258
254
  };
259
255
 
260
-
261
256
  static const DWORD LinearSlideUpTable[256] =
262
257
  {
263
258
  65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213,
@@ -294,7 +289,6 @@ static const DWORD LinearSlideUpTable[256] =
294
289
  160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545,
295
290
  };
296
291
 
297
-
298
292
  static const DWORD LinearSlideDownTable[256] =
299
293
  {
300
294
  65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900,
@@ -332,7 +326,7 @@ static const DWORD LinearSlideDownTable[256] =
332
326
  26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102,
333
327
  };
334
328
 
335
-
329
+ #if 0
336
330
  static const int SpectrumSinusTable[256*2] =
337
331
  {
338
332
  0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11,
@@ -368,4 +362,5 @@ static const int SpectrumSinusTable[256*2] =
368
362
  -24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13,
369
363
  -12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0,
370
364
  };
365
+ #endif
371
366