gosu 1.1.1.1 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +83 -7
- data/dependencies/SDL_sound/SDL_sound.h +4 -4
- data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
- data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
- data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
- data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
- data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
- data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
- data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
- data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
- data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
- data/dependencies/SDL_sound/dr_flac.h +618 -220
- data/dependencies/SDL_sound/dr_mp3.h +263 -94
- data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
- data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
- data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +508 -325
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4594 -0
- data/ext/gosu/extconf.rb +29 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +63 -107
- data/include/Gosu/Font.hpp +44 -48
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Graphics.hpp +64 -75
- data/include/Gosu/GraphicsBase.hpp +32 -39
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +73 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +28 -37
- data/lib/gosu/swig_patches.rb +31 -3
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +9 -1
- data/src/Audio.cpp +88 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.hpp +5 -5
- data/src/Bitmap.cpp +13 -13
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +62 -55
- data/src/EmptyImageData.hpp +16 -18
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +52 -57
- data/src/GosuViewController.cpp +2 -0
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +42 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +120 -113
- data/src/LargeImageData.hpp +18 -16
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +35 -37
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +12 -7
- data/src/RubyGosu.cxx +471 -502
- data/src/RubyGosu.h +3 -2
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +58 -59
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +108 -108
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +27 -23
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +82 -23
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +103 -86
- data/src/WindowUIKit.cpp +48 -51
- metadata +8 -20
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
@@ -7,13 +7,13 @@
|
|
7
7
|
#include "modplug.h"
|
8
8
|
#include "libmodplug.h"
|
9
9
|
|
10
|
-
void ModPlug_Quit(void) {
|
11
|
-
|
10
|
+
void ModPlug_Quit(void) {
|
11
|
+
}
|
12
12
|
int ModPlug_Init(void)
|
13
13
|
{
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
init_modplug_filters();
|
15
|
+
SDL_srand(SDL_GetPerformanceCounter());
|
16
|
+
return 1;
|
17
17
|
}
|
18
18
|
|
19
19
|
ModPlugFile* ModPlug_Load(const void* data, int size, const ModPlug_Settings *settings)
|
@@ -28,7 +28,7 @@ void ModPlug_Unload(ModPlugFile* file)
|
|
28
28
|
|
29
29
|
int ModPlug_Read(ModPlugFile* file, void* buffer, int size)
|
30
30
|
{
|
31
|
-
|
31
|
+
CSoundFile *sndfile = (CSoundFile *) file;
|
32
32
|
return CSoundFile_Read(sndfile, buffer, size) * sndfile->gSampleSize;
|
33
33
|
}
|
34
34
|
|
@@ -47,124 +47,8 @@ void ModPlug_Seek(ModPlugFile* file, int millisecond)
|
|
47
47
|
millisecond = maxtime;
|
48
48
|
maxpos = CSoundFile_GetMaxPosition((CSoundFile *) file);
|
49
49
|
postime = 0.0f;
|
50
|
-
if (maxtime != 0
|
50
|
+
if (maxtime != 0)
|
51
51
|
postime = (float)maxpos / (float)maxtime;
|
52
52
|
|
53
53
|
CSoundFile_SetCurrentPos((CSoundFile *) file, (int)(millisecond * postime));
|
54
54
|
}
|
55
|
-
|
56
|
-
// inefficient, but oh well.
|
57
|
-
char *rwops_fgets(char *buf, int buflen, SDL_RWops *rwops)
|
58
|
-
{
|
59
|
-
char *retval = buf;
|
60
|
-
if (!buflen) return buf;
|
61
|
-
while (buflen > 1) {
|
62
|
-
char ch;
|
63
|
-
if (SDL_RWread(rwops, &ch, 1, 1) != 1) {
|
64
|
-
break;
|
65
|
-
}
|
66
|
-
*(buf++) = ch;
|
67
|
-
buflen--;
|
68
|
-
if (ch == '\n') {
|
69
|
-
break;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
*(buf) = '\0';
|
73
|
-
return retval;
|
74
|
-
}
|
75
|
-
|
76
|
-
long mmftell(MMFILE *mmfile)
|
77
|
-
{
|
78
|
-
return mmfile->pos;
|
79
|
-
}
|
80
|
-
|
81
|
-
void mmfseek(MMFILE *mmfile, long p, int whence)
|
82
|
-
{
|
83
|
-
int newpos = mmfile->pos;
|
84
|
-
switch(whence) {
|
85
|
-
case SEEK_SET:
|
86
|
-
newpos = p;
|
87
|
-
break;
|
88
|
-
case SEEK_CUR:
|
89
|
-
newpos += p;
|
90
|
-
break;
|
91
|
-
case SEEK_END:
|
92
|
-
newpos = mmfile->sz + p;
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
if (newpos < mmfile->sz)
|
96
|
-
mmfile->pos = newpos;
|
97
|
-
else {
|
98
|
-
mmfile->error = 1;
|
99
|
-
// printf("WARNING: seeking too far\n");
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
void mmreadUBYTES(BYTE *buf, long sz, MMFILE *mmfile)
|
104
|
-
{
|
105
|
-
int sztr = sz;
|
106
|
-
// do not overread.
|
107
|
-
if (sz > mmfile->sz - mmfile->pos)
|
108
|
-
sztr = mmfile->sz - mmfile->pos;
|
109
|
-
SDL_memcpy(buf, &mmfile->mm[mmfile->pos], sztr);
|
110
|
-
mmfile->pos += sz;
|
111
|
-
// if truncated read, populate the rest of the array with zeros.
|
112
|
-
if (sz > sztr)
|
113
|
-
SDL_memset(buf+sztr, 0, sz-sztr);
|
114
|
-
}
|
115
|
-
|
116
|
-
void mmreadSBYTES(char *buf, long sz, MMFILE *mmfile)
|
117
|
-
{
|
118
|
-
// do not overread.
|
119
|
-
if (sz > mmfile->sz - mmfile->pos)
|
120
|
-
sz = mmfile->sz - mmfile->pos;
|
121
|
-
SDL_memcpy(buf, &mmfile->mm[mmfile->pos], sz);
|
122
|
-
mmfile->pos += sz;
|
123
|
-
}
|
124
|
-
|
125
|
-
BYTE mmreadUBYTE(MMFILE *mmfile)
|
126
|
-
{
|
127
|
-
BYTE b;
|
128
|
-
b = (BYTE)mmfile->mm[mmfile->pos];
|
129
|
-
mmfile->pos++;
|
130
|
-
return b;
|
131
|
-
}
|
132
|
-
|
133
|
-
void mmfclose(MMFILE *mmfile)
|
134
|
-
{
|
135
|
-
SDL_free(mmfile);
|
136
|
-
}
|
137
|
-
|
138
|
-
int mmfeof(MMFILE *mmfile)
|
139
|
-
{
|
140
|
-
if( mmfile->pos < 0 ) return TRUE;
|
141
|
-
if( mmfile->pos < mmfile->sz ) return FALSE;
|
142
|
-
return TRUE;
|
143
|
-
}
|
144
|
-
|
145
|
-
int mmfgetc(MMFILE *mmfile)
|
146
|
-
{
|
147
|
-
int b = EOF;
|
148
|
-
if( mmfeof(mmfile) ) return EOF;
|
149
|
-
b = mmfile->mm[mmfile->pos];
|
150
|
-
mmfile->pos++;
|
151
|
-
if( b=='\r' && !mmfeof(mmfile) && mmfile->mm[mmfile->pos] == '\n' ) {
|
152
|
-
b = '\n';
|
153
|
-
mmfile->pos++;
|
154
|
-
}
|
155
|
-
return b;
|
156
|
-
}
|
157
|
-
|
158
|
-
void mmfgets(char buf[], unsigned int bufsz, MMFILE *mmfile)
|
159
|
-
{
|
160
|
-
int i = 0;
|
161
|
-
int b;
|
162
|
-
for( i=0; i<(int)bufsz-1; i++ ) {
|
163
|
-
b = mmfgetc(mmfile);
|
164
|
-
if( b==EOF ) break;
|
165
|
-
buf[i] = b;
|
166
|
-
if( b == '\n' ) break;
|
167
|
-
}
|
168
|
-
buf[i] = '\0';
|
169
|
-
}
|
170
|
-
|
@@ -16,6 +16,35 @@ extern "C" {
|
|
16
16
|
struct _ModPlugFile;
|
17
17
|
typedef struct _ModPlugFile ModPlugFile;
|
18
18
|
|
19
|
+
/* [de]initialize the library */
|
20
|
+
int ModPlug_Init(void);
|
21
|
+
void ModPlug_Quit(void);
|
22
|
+
|
23
|
+
struct _ModPlug_Settings;
|
24
|
+
|
25
|
+
/* Load a mod file. [data] should point to a block of memory containing the complete
|
26
|
+
* file, and [size] should be the size of that block.
|
27
|
+
* Return the loaded mod file on success, or NULL on failure. */
|
28
|
+
MODPLUG_EXPORT ModPlugFile* ModPlug_Load(const void* data, int size, const struct _ModPlug_Settings *settings);
|
29
|
+
/* Unload a mod file. */
|
30
|
+
MODPLUG_EXPORT void ModPlug_Unload(ModPlugFile* file);
|
31
|
+
|
32
|
+
/* Read sample data into the buffer. Returns the number of bytes read. If the end
|
33
|
+
* of the mod has been reached, zero is returned. */
|
34
|
+
MODPLUG_EXPORT int ModPlug_Read(ModPlugFile* file, void* buffer, int size);
|
35
|
+
|
36
|
+
/* Get the length of the mod, in milliseconds. Note that this result is not always
|
37
|
+
* accurate, especially in the case of mods with loops. */
|
38
|
+
MODPLUG_EXPORT int ModPlug_GetLength(ModPlugFile* file);
|
39
|
+
|
40
|
+
/* Seek to a particular position in the song. Note that seeking and MODs don't mix very
|
41
|
+
* well. Some mods will be missing instruments for a short time after a seek, as ModPlug
|
42
|
+
* does not scan the sequence backwards to find out which instruments were supposed to be
|
43
|
+
* playing at that time. (Doing so would be difficult and not very reliable.) Also,
|
44
|
+
* note that seeking is not very exact in some mods -- especially those for which
|
45
|
+
* ModPlug_GetLength() does not report the full length. */
|
46
|
+
MODPLUG_EXPORT void ModPlug_Seek(ModPlugFile* file, int millisecond);
|
47
|
+
|
19
48
|
enum _ModPlug_Flags
|
20
49
|
{
|
21
50
|
MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */
|
@@ -36,7 +65,7 @@ enum _ModPlug_ResamplingMode
|
|
36
65
|
typedef struct _ModPlug_Settings
|
37
66
|
{
|
38
67
|
int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */
|
39
|
-
|
68
|
+
|
40
69
|
/* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then
|
41
70
|
* down-mixes to the settings you choose. */
|
42
71
|
int mChannels; /* Number of channels - 1 for mono or 2 for stereo */
|
@@ -46,7 +75,7 @@ typedef struct _ModPlug_Settings
|
|
46
75
|
|
47
76
|
int mStereoSeparation; /* Stereo separation, 1 - 256 */
|
48
77
|
int mMaxMixChannels; /* Maximum number of mixing channels (polyphony), 32 - 256 */
|
49
|
-
|
78
|
+
|
50
79
|
int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */
|
51
80
|
int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */
|
52
81
|
int mBassAmount; /* XBass level 0(quiet)-100(loud) */
|
@@ -54,35 +83,9 @@ typedef struct _ModPlug_Settings
|
|
54
83
|
int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */
|
55
84
|
int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */
|
56
85
|
int mLoopCount; /* Number of times to loop. Zero prevents looping.
|
57
|
-
|
86
|
+
* -1 loops forever. */
|
58
87
|
} ModPlug_Settings;
|
59
88
|
|
60
|
-
int ModPlug_Init(void);
|
61
|
-
void ModPlug_Quit(void);
|
62
|
-
|
63
|
-
/* Load a mod file. [data] should point to a block of memory containing the complete
|
64
|
-
* file, and [size] should be the size of that block.
|
65
|
-
* Return the loaded mod file on success, or NULL on failure. */
|
66
|
-
MODPLUG_EXPORT ModPlugFile* ModPlug_Load(const void* data, int size, const ModPlug_Settings *settings);
|
67
|
-
/* Unload a mod file. */
|
68
|
-
MODPLUG_EXPORT void ModPlug_Unload(ModPlugFile* file);
|
69
|
-
|
70
|
-
/* Read sample data into the buffer. Returns the number of bytes read. If the end
|
71
|
-
* of the mod has been reached, zero is returned. */
|
72
|
-
MODPLUG_EXPORT int ModPlug_Read(ModPlugFile* file, void* buffer, int size);
|
73
|
-
|
74
|
-
/* Get the length of the mod, in milliseconds. Note that this result is not always
|
75
|
-
* accurate, especially in the case of mods with loops. */
|
76
|
-
MODPLUG_EXPORT int ModPlug_GetLength(ModPlugFile* file);
|
77
|
-
|
78
|
-
/* Seek to a particular position in the song. Note that seeking and MODs don't mix very
|
79
|
-
* well. Some mods will be missing instruments for a short time after a seek, as ModPlug
|
80
|
-
* does not scan the sequence backwards to find out which instruments were supposed to be
|
81
|
-
* playing at that time. (Doing so would be difficult and not very reliable.) Also,
|
82
|
-
* note that seeking is not very exact in some mods -- especially those for which
|
83
|
-
* ModPlug_GetLength() does not report the full length. */
|
84
|
-
MODPLUG_EXPORT void ModPlug_Seek(ModPlugFile* file, int millisecond);
|
85
|
-
|
86
89
|
#ifdef __cplusplus
|
87
90
|
} /* extern "C" */
|
88
91
|
#endif
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
#ifndef NO_FILTER
|
14
14
|
|
15
|
-
DWORD
|
15
|
+
static DWORD CutOffToFrequency(CSoundFile *_this, UINT nCutOff, int flt_modifier)
|
16
16
|
//-----------------------------------------------------------------------
|
17
17
|
{
|
18
18
|
float Fc;
|
@@ -33,7 +33,7 @@ DWORD CSoundFile_CutOffToFrequency(CSoundFile *_this, UINT nCutOff, int flt_modi
|
|
33
33
|
void CSoundFile_SetupChannelFilter(CSoundFile *_this, MODCHANNEL *pChn, BOOL bReset, int flt_modifier)
|
34
34
|
//----------------------------------------------------------------------------------------
|
35
35
|
{
|
36
|
-
float fc = (float)
|
36
|
+
float fc = (float)CutOffToFrequency(_this, pChn->nCutOff, flt_modifier);
|
37
37
|
float fs = (float)_this->gdwMixingFreq;
|
38
38
|
float fg, fb0, fb1;
|
39
39
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
*/
|
6
6
|
|
7
7
|
#include "libmodplug.h"
|
8
|
-
#
|
8
|
+
#define SNDFX_C
|
9
9
|
#include "tables.h"
|
10
10
|
|
11
11
|
DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
@@ -13,9 +13,8 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
13
13
|
{
|
14
14
|
UINT dwElapsedTime=0, nRow=0, nCurrentPattern=0, nNextPattern=0, nPattern=0;
|
15
15
|
UINT nMusicSpeed=_this->m_nDefaultSpeed, nMusicTempo=_this->m_nDefaultTempo, nNextRow=0;
|
16
|
-
UINT nMaxRow = 0, nMaxPattern = 0;
|
16
|
+
UINT nMaxRow = 0, nMaxPattern = 0, nNextStartRow = 0;
|
17
17
|
LONG nGlbVol = _this->m_nDefaultGlobalVolume, nOldGlbVolSlide = 0;
|
18
|
-
BYTE samples[MAX_CHANNELS];
|
19
18
|
BYTE instr[MAX_CHANNELS];
|
20
19
|
BYTE notes[MAX_CHANNELS];
|
21
20
|
BYTE vols[MAX_CHANNELS];
|
@@ -29,7 +28,6 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
29
28
|
SDL_memset(patloop, 0, sizeof(patloop));
|
30
29
|
SDL_memset(oldparam, 0, sizeof(oldparam));
|
31
30
|
SDL_memset(chnvols, 64, sizeof(chnvols));
|
32
|
-
SDL_memset(samples, 0, sizeof(samples));
|
33
31
|
for (UINT icv=0; icv<_this->m_nChannels; icv++)
|
34
32
|
chnvols[icv] = _this->ChnSettings[icv].nVolume;
|
35
33
|
nMaxRow = _this->m_nNextRow;
|
@@ -40,7 +38,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
40
38
|
nRow = nNextRow;
|
41
39
|
nCurrentPattern = nNextPattern;
|
42
40
|
// Check if pattern is valid
|
43
|
-
nPattern = _this->Order[nCurrentPattern];
|
41
|
+
nPattern = (nCurrentPattern < MAX_ORDERS) ? _this->Order[nCurrentPattern] : 0xFF;
|
44
42
|
while (nPattern >= MAX_PATTERNS)
|
45
43
|
{
|
46
44
|
// End of song ?
|
@@ -55,7 +53,8 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
55
53
|
nNextPattern = nCurrentPattern;
|
56
54
|
}
|
57
55
|
// Weird stuff?
|
58
|
-
if ((nPattern >= MAX_PATTERNS) || (!_this->Patterns[nPattern])
|
56
|
+
if ((nPattern >= MAX_PATTERNS) || (!_this->Patterns[nPattern]) ||
|
57
|
+
_this->PatternSize[nPattern] == 0) break;
|
59
58
|
// Should never happen
|
60
59
|
if (nRow >= _this->PatternSize[nPattern]) nRow = 0;
|
61
60
|
// Update next position
|
@@ -63,7 +62,8 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
63
62
|
if (nNextRow >= _this->PatternSize[nPattern])
|
64
63
|
{
|
65
64
|
nNextPattern = nCurrentPattern + 1;
|
66
|
-
nNextRow =
|
65
|
+
nNextRow = nNextStartRow;
|
66
|
+
nNextStartRow = 0;
|
67
67
|
}
|
68
68
|
if (!nRow)
|
69
69
|
{
|
@@ -98,6 +98,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
98
98
|
if (param <= nCurrentPattern) goto EndMod;
|
99
99
|
nNextPattern = param;
|
100
100
|
nNextRow = 0;
|
101
|
+
nNextStartRow = 0;
|
101
102
|
if (bAdjust)
|
102
103
|
{
|
103
104
|
pChn->nPatternLoopCount = 0;
|
@@ -108,6 +109,7 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
108
109
|
case CMD_PATTERNBREAK:
|
109
110
|
nNextRow = param;
|
110
111
|
nNextPattern = nCurrentPattern + 1;
|
112
|
+
nNextStartRow = 0;
|
111
113
|
if (bAdjust)
|
112
114
|
{
|
113
115
|
pChn->nPatternLoopCount = 0;
|
@@ -149,7 +151,10 @@ DWORD CSoundFile_GetLength(CSoundFile *_this, BOOL bAdjust, BOOL bTotal)
|
|
149
151
|
if ((param & 0xF0) == 0x60)
|
150
152
|
{
|
151
153
|
if (param & 0x0F) dwElapsedTime += (dwElapsedTime - patloop[nChn]) * (param & 0x0F);
|
152
|
-
else
|
154
|
+
else {
|
155
|
+
patloop[nChn] = dwElapsedTime;
|
156
|
+
if (_this->m_nType & MOD_TYPE_XM) nNextStartRow = nRow;
|
157
|
+
}
|
153
158
|
}
|
154
159
|
break;
|
155
160
|
}
|
@@ -515,13 +520,13 @@ void CSoundFile_NoteChange(CSoundFile *_this, UINT nChn, int note, BOOL bPorta,
|
|
515
520
|
// Volume Swing
|
516
521
|
if (penv->nVolSwing)
|
517
522
|
{
|
518
|
-
int d = ((LONG)penv->nVolSwing*(LONG)((
|
523
|
+
int d = ((LONG)penv->nVolSwing*(LONG)((SDL_rand() & 0xFF) - 0x7F)) / 128;
|
519
524
|
pChn->nVolSwing = (signed short)((d * pChn->nVolume + 1)/128);
|
520
525
|
}
|
521
526
|
// Pan Swing
|
522
527
|
if (penv->nPanSwing)
|
523
528
|
{
|
524
|
-
int d = ((LONG)penv->nPanSwing*(LONG)((
|
529
|
+
int d = ((LONG)penv->nPanSwing*(LONG)((SDL_rand() & 0xFF) - 0x7F)) / 128;
|
525
530
|
pChn->nPanSwing = (signed short)d;
|
526
531
|
}
|
527
532
|
}
|
@@ -686,7 +691,7 @@ void CSoundFile_CheckNNA(CSoundFile *_this, UINT nChn, UINT instr, int note, BOO
|
|
686
691
|
UINT n = CSoundFile_GetNNAChannel(_this, nChn);
|
687
692
|
if (n)
|
688
693
|
{
|
689
|
-
|
694
|
+
p = &_this->Chn[n];
|
690
695
|
// Copy Channel
|
691
696
|
SDL_memcpy(p, pChn, sizeof (*p));
|
692
697
|
p->dwFlags &= ~(CHN_VIBRATO|CHN_TREMOLO|CHN_PANBRELLO|CHN_MUTE|CHN_PORTAMENTO);
|
@@ -1159,11 +1164,13 @@ BOOL CSoundFile_ProcessEffects(CSoundFile *_this)
|
|
1159
1164
|
// Position Jump
|
1160
1165
|
case CMD_POSITIONJUMP:
|
1161
1166
|
nPosJump = param;
|
1167
|
+
_this->m_nNextStartRow = 0;
|
1162
1168
|
break;
|
1163
1169
|
|
1164
1170
|
// Pattern Break
|
1165
1171
|
case CMD_PATTERNBREAK:
|
1166
1172
|
nBreakRow = param;
|
1173
|
+
_this->m_nNextStartRow = 0;
|
1167
1174
|
break;
|
1168
1175
|
|
1169
1176
|
// Midi Controller
|
@@ -1205,9 +1212,6 @@ BOOL CSoundFile_ProcessEffects(CSoundFile *_this)
|
|
1205
1212
|
if (_this->m_nRepeatCount > 0) _this->m_nRepeatCount--;
|
1206
1213
|
} else
|
1207
1214
|
{
|
1208
|
-
#ifdef MODPLUG_TRACKER
|
1209
|
-
if (_this->gdwSoundSetup & SNDMIX_NOBACKWARDJUMPS)
|
1210
|
-
#endif
|
1211
1215
|
// Backward jump disabled
|
1212
1216
|
bNoLoop = TRUE;
|
1213
1217
|
//reset repeat count incase there are multiple loops.
|
@@ -2039,8 +2043,6 @@ void CSoundFile_SetSpeed(CSoundFile *_this, UINT param)
|
|
2039
2043
|
//-----------------------------------
|
2040
2044
|
{
|
2041
2045
|
UINT max = (_this->m_nType == MOD_TYPE_IT) ? 256 : 128;
|
2042
|
-
// Modplug Tracker and Mod-Plugin don't do this check
|
2043
|
-
#ifndef MODPLUG_TRACKER
|
2044
2046
|
// Big Hack!!!
|
2045
2047
|
if ((!param) || (param >= 0x80) || ((_this->m_nType & (MOD_TYPE_MOD|MOD_TYPE_XM|MOD_TYPE_MT2)) && (param >= 0x1E)))
|
2046
2048
|
{
|
@@ -2049,7 +2051,6 @@ void CSoundFile_SetSpeed(CSoundFile *_this, UINT param)
|
|
2049
2051
|
CSoundFile_GlobalFadeSong(_this, 1000);
|
2050
2052
|
}
|
2051
2053
|
}
|
2052
|
-
#endif // MODPLUG_TRACKER
|
2053
2054
|
if ((_this->m_nType & MOD_TYPE_S3M) && (param > 0x80)) param -= 0x80;
|
2054
2055
|
if ((param) && (param <= max)) _this->m_nMusicSpeed = param;
|
2055
2056
|
}
|
@@ -2100,6 +2101,7 @@ int CSoundFile_PatternLoop(CSoundFile *_this, MODCHANNEL *pChn, UINT param)
|
|
2100
2101
|
} else
|
2101
2102
|
{
|
2102
2103
|
pChn->nPatternLoop = _this->m_nRow;
|
2104
|
+
if (_this->m_nType & MOD_TYPE_XM) _this->m_nNextStartRow = _this->m_nRow;
|
2103
2105
|
}
|
2104
2106
|
return -1;
|
2105
2107
|
}
|
@@ -2271,8 +2273,12 @@ UINT CSoundFile_GetPeriodFromNote(CSoundFile *_this, UINT note, int nFineTune, U
|
|
2271
2273
|
return (FreqS3MTable[note % 12] << 5) >> (note / 12);
|
2272
2274
|
} else
|
2273
2275
|
{
|
2276
|
+
int divider;
|
2274
2277
|
if (!nC4Speed) nC4Speed = 8363;
|
2275
|
-
|
2278
|
+
// if C4Speed is large, then up shifting may produce a zero divider
|
2279
|
+
divider = nC4Speed << (note / 12);
|
2280
|
+
if (!divider) divider = 1e6;
|
2281
|
+
return _muldiv(8363, (FreqS3MTable[note % 12] << 5), divider);
|
2276
2282
|
}
|
2277
2283
|
} else
|
2278
2284
|
if (_this->m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2))
|