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.
- checksums.yaml +4 -4
- data/dependencies/SDL/include/SDL.h +138 -0
- data/dependencies/SDL/include/SDL_assert.h +293 -0
- data/dependencies/SDL/include/SDL_atomic.h +295 -0
- data/dependencies/SDL/include/SDL_audio.h +859 -0
- data/dependencies/SDL/include/SDL_bits.h +121 -0
- data/dependencies/SDL/include/SDL_blendmode.h +123 -0
- data/dependencies/SDL/include/SDL_clipboard.h +71 -0
- data/dependencies/SDL/include/SDL_config.h +55 -0
- data/dependencies/SDL/include/SDL_config_android.h +182 -0
- data/dependencies/SDL/include/SDL_config_iphoneos.h +207 -0
- data/dependencies/SDL/include/SDL_config_macosx.h +266 -0
- data/dependencies/SDL/include/SDL_config_minimal.h +85 -0
- data/dependencies/SDL/include/SDL_config_os2.h +188 -0
- data/dependencies/SDL/include/SDL_config_pandora.h +135 -0
- data/dependencies/SDL/include/SDL_config_psp.h +165 -0
- data/dependencies/SDL/include/SDL_config_windows.h +288 -0
- data/dependencies/SDL/include/SDL_config_winrt.h +243 -0
- data/dependencies/SDL/include/SDL_config_wiz.h +149 -0
- data/dependencies/SDL/include/SDL_copying.h +20 -0
- data/dependencies/SDL/include/SDL_cpuinfo.h +299 -0
- data/dependencies/SDL/include/SDL_egl.h +1676 -0
- data/dependencies/SDL/include/SDL_endian.h +263 -0
- data/dependencies/SDL/include/SDL_error.h +112 -0
- data/dependencies/SDL/include/SDL_events.h +827 -0
- data/dependencies/SDL/include/SDL_filesystem.h +136 -0
- data/dependencies/SDL/include/SDL_gamecontroller.h +541 -0
- data/dependencies/SDL/include/SDL_gesture.h +87 -0
- data/dependencies/SDL/include/SDL_haptic.h +1247 -0
- data/dependencies/SDL/include/SDL_hints.h +1578 -0
- data/dependencies/SDL/include/SDL_joystick.h +499 -0
- data/dependencies/SDL/include/SDL_keyboard.h +217 -0
- data/dependencies/SDL/include/SDL_keycode.h +351 -0
- data/dependencies/SDL/include/SDL_loadso.h +81 -0
- data/dependencies/SDL/include/SDL_locale.h +101 -0
- data/dependencies/SDL/include/SDL_log.h +211 -0
- data/dependencies/SDL/include/SDL_main.h +180 -0
- data/dependencies/SDL/include/SDL_messagebox.h +146 -0
- data/dependencies/SDL/include/SDL_metal.h +117 -0
- data/dependencies/SDL/include/SDL_misc.h +75 -0
- data/dependencies/SDL/include/SDL_mouse.h +302 -0
- data/dependencies/SDL/include/SDL_mutex.h +251 -0
- data/dependencies/SDL/include/SDL_name.h +33 -0
- data/dependencies/SDL/include/SDL_opengl.h +2183 -0
- data/dependencies/SDL/include/SDL_opengl_glext.h +11180 -0
- data/dependencies/SDL/include/SDL_opengles.h +39 -0
- data/dependencies/SDL/include/SDL_opengles2.h +52 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2.h +621 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +2050 -0
- data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +30 -0
- data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +282 -0
- data/dependencies/SDL/include/SDL_pixels.h +479 -0
- data/dependencies/SDL/include/SDL_platform.h +198 -0
- data/dependencies/SDL/include/SDL_power.h +75 -0
- data/dependencies/SDL/include/SDL_quit.h +58 -0
- data/dependencies/SDL/include/SDL_rect.h +174 -0
- data/dependencies/SDL/include/SDL_render.h +1158 -0
- data/dependencies/SDL/include/SDL_revision.h +2 -0
- data/dependencies/SDL/include/SDL_rwops.h +283 -0
- data/dependencies/SDL/include/SDL_scancode.h +413 -0
- data/dependencies/SDL/include/SDL_sensor.h +267 -0
- data/dependencies/SDL/include/SDL_shape.h +144 -0
- data/dependencies/SDL/include/SDL_stdinc.h +647 -0
- data/dependencies/SDL/include/SDL_surface.h +563 -0
- data/dependencies/SDL/include/SDL_system.h +325 -0
- data/dependencies/SDL/include/SDL_syswm.h +354 -0
- data/dependencies/SDL/include/SDL_test.h +69 -0
- data/dependencies/SDL/include/SDL_test_assert.h +105 -0
- data/dependencies/SDL/include/SDL_test_common.h +218 -0
- data/dependencies/SDL/include/SDL_test_compare.h +69 -0
- data/dependencies/SDL/include/SDL_test_crc32.h +124 -0
- data/dependencies/SDL/include/SDL_test_font.h +81 -0
- data/dependencies/SDL/include/SDL_test_fuzzer.h +384 -0
- data/dependencies/SDL/include/SDL_test_harness.h +134 -0
- data/dependencies/SDL/include/SDL_test_images.h +78 -0
- data/dependencies/SDL/include/SDL_test_log.h +67 -0
- data/dependencies/SDL/include/SDL_test_md5.h +129 -0
- data/dependencies/SDL/include/SDL_test_memory.h +63 -0
- data/dependencies/SDL/include/SDL_test_random.h +115 -0
- data/dependencies/SDL/include/SDL_thread.h +366 -0
- data/dependencies/SDL/include/SDL_timer.h +115 -0
- data/dependencies/SDL/include/SDL_touch.h +102 -0
- data/dependencies/SDL/include/SDL_types.h +29 -0
- data/dependencies/SDL/include/SDL_version.h +162 -0
- data/dependencies/SDL/include/SDL_video.h +1282 -0
- data/dependencies/SDL/include/SDL_vulkan.h +276 -0
- data/dependencies/SDL/include/begin_code.h +166 -0
- data/dependencies/SDL/include/close_code.h +40 -0
- 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 +795 -0
- data/dependencies/SDL_sound/SDL_sound.h +725 -0
- data/dependencies/SDL_sound/SDL_sound_aiff.c +537 -0
- data/dependencies/SDL_sound/SDL_sound_au.c +352 -0
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +747 -0
- data/dependencies/SDL_sound/SDL_sound_flac.c +182 -0
- data/dependencies/SDL_sound/SDL_sound_internal.h +304 -0
- data/dependencies/SDL_sound/SDL_sound_modplug.c +228 -0
- data/dependencies/SDL_sound/SDL_sound_mp3.c +184 -0
- data/dependencies/SDL_sound/SDL_sound_raw.c +164 -0
- data/dependencies/SDL_sound/SDL_sound_shn.c +1309 -0
- data/dependencies/SDL_sound/SDL_sound_voc.c +550 -0
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +223 -0
- data/dependencies/SDL_sound/SDL_sound_wav.c +783 -0
- data/dependencies/SDL_sound/dr_flac.h +5906 -0
- data/dependencies/SDL_sound/dr_mp3.h +2832 -0
- data/dependencies/SDL_sound/libmodplug/fastmix.c +1748 -0
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +1001 -0
- data/dependencies/SDL_sound/libmodplug/load_669.c +188 -0
- data/dependencies/SDL_sound/libmodplug/load_abc.c +4725 -0
- data/dependencies/SDL_sound/libmodplug/load_amf.c +403 -0
- data/dependencies/SDL_sound/libmodplug/load_ams.c +587 -0
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +357 -0
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +531 -0
- data/dependencies/SDL_sound/libmodplug/load_dsm.c +232 -0
- data/dependencies/SDL_sound/libmodplug/load_far.c +253 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +796 -0
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +488 -0
- data/dependencies/SDL_sound/libmodplug/load_med.c +757 -0
- data/dependencies/SDL_sound/libmodplug/load_mid.c +1405 -0
- data/dependencies/SDL_sound/libmodplug/load_mod.c +269 -0
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +546 -0
- data/dependencies/SDL_sound/libmodplug/load_mtm.c +142 -0
- data/dependencies/SDL_sound/libmodplug/load_okt.c +192 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.c +1143 -0
- data/dependencies/SDL_sound/libmodplug/load_pat.h +25 -0
- data/dependencies/SDL_sound/libmodplug/load_psm.c +350 -0
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +204 -0
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +325 -0
- data/dependencies/SDL_sound/libmodplug/load_stm.c +180 -0
- data/dependencies/SDL_sound/libmodplug/load_ult.c +206 -0
- data/dependencies/SDL_sound/libmodplug/load_umx.c +51 -0
- data/dependencies/SDL_sound/libmodplug/load_xm.c +554 -0
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +382 -0
- data/dependencies/SDL_sound/libmodplug/modplug.c +170 -0
- data/dependencies/SDL_sound/libmodplug/modplug.h +90 -0
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +301 -0
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +63 -0
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +2350 -0
- data/dependencies/SDL_sound/libmodplug/sndfile.c +1169 -0
- data/dependencies/SDL_sound/libmodplug/sndmix.c +1034 -0
- data/dependencies/SDL_sound/libmodplug/tables.h +371 -0
- data/{src/stb_vorbis.c → dependencies/SDL_sound/stb_vorbis.h} +143 -78
- data/dependencies/al_soft/AL/al.h +655 -0
- data/dependencies/al_soft/AL/alc.h +270 -0
- data/dependencies/al_soft/AL/alext.h +585 -0
- data/dependencies/al_soft/AL/efx-creative.h +3 -0
- data/dependencies/al_soft/AL/efx-presets.h +402 -0
- data/dependencies/al_soft/AL/efx.h +762 -0
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/{src → dependencies/stb}/stb_image.h +330 -127
- data/{src → dependencies/stb}/stb_image_write.h +156 -85
- data/{src → dependencies/stb}/stb_truetype.h +192 -69
- data/{src → dependencies/utf8proc}/utf8proc.c +0 -0
- data/{src → dependencies/utf8proc}/utf8proc.h +0 -0
- data/{src → dependencies/utf8proc}/utf8proc_data.h +0 -0
- data/ext/gosu/extconf.rb +56 -22
- data/{Gosu → include/Gosu}/Audio.hpp +6 -8
- data/{Gosu → include/Gosu}/AutoLink.hpp +0 -0
- data/include/Gosu/Bitmap.hpp +100 -0
- data/{Gosu → include/Gosu}/Buttons.hpp +94 -35
- data/{Gosu → include/Gosu}/Channel.h +0 -0
- data/{Gosu → include/Gosu}/Color.h +0 -0
- data/{Gosu → include/Gosu}/Color.hpp +0 -0
- data/{Gosu → include/Gosu}/Directories.hpp +0 -0
- data/{Gosu → include/Gosu}/Font.h +0 -0
- data/{Gosu → include/Gosu}/Font.hpp +0 -0
- data/{Gosu → include/Gosu}/Fwd.hpp +0 -0
- data/{Gosu → include/Gosu}/Gosu.h +3 -0
- data/{Gosu → include/Gosu}/Gosu.hpp +0 -0
- data/{Gosu → include/Gosu}/Graphics.hpp +0 -0
- data/{Gosu → include/Gosu}/GraphicsBase.hpp +0 -0
- data/{Gosu → include/Gosu}/IO.hpp +0 -0
- data/{Gosu → include/Gosu}/Image.h +0 -0
- data/{Gosu → include/Gosu}/Image.hpp +7 -6
- data/{Gosu → include/Gosu}/ImageData.hpp +0 -0
- data/{Gosu → include/Gosu}/Input.hpp +30 -15
- data/{Gosu → include/Gosu}/Inspection.hpp +0 -0
- data/{Gosu → include/Gosu}/Math.hpp +0 -0
- data/{Gosu → include/Gosu}/Platform.hpp +0 -0
- data/{Gosu → include/Gosu}/Sample.h +0 -0
- data/{Gosu → include/Gosu}/Song.h +0 -0
- data/{Gosu → include/Gosu}/Text.hpp +0 -0
- data/{Gosu → include/Gosu}/TextInput.h +0 -0
- data/{Gosu → include/Gosu}/TextInput.hpp +0 -0
- data/{Gosu → include/Gosu}/Timing.hpp +0 -0
- data/{Gosu → include/Gosu}/Utility.hpp +1 -1
- data/{Gosu → include/Gosu}/Version.hpp +0 -0
- data/{Gosu → include/Gosu}/Window.h +2 -0
- data/{Gosu → include/Gosu}/Window.hpp +21 -13
- data/lib/OpenAL32.dll +0 -0
- data/lib/SDL2.dll +0 -0
- data/lib/gosu.rb +0 -3
- data/lib/gosu/patches.rb +0 -9
- data/lib/gosu/swig_patches.rb +3 -2
- data/lib/libmpg123.dll +0 -0
- data/lib/libsndfile.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/lib64/SDL2.dll +0 -0
- data/lib64/libmpg123.dll +0 -0
- data/lib64/libsndfile.dll +0 -0
- data/rdoc/gosu.rb +95 -20
- data/src/Audio.cpp +50 -224
- data/src/AudioFile.hpp +17 -37
- data/src/AudioFileAudioToolbox.cpp +237 -0
- data/src/AudioFileSDLSound.cpp +147 -0
- data/src/AudioImpl.cpp +3 -12
- data/src/AudioImpl.hpp +3 -1
- data/src/Bitmap.cpp +85 -83
- data/src/BitmapIO.cpp +52 -58
- data/src/Constants.cpp +80 -33
- data/src/Font.cpp +3 -1
- data/src/GosuWrapper.cpp +19 -0
- data/src/Graphics.cpp +7 -4
- data/src/Image.cpp +13 -16
- data/src/Input.cpp +408 -159
- data/src/LargeImageData.cpp +1 -1
- data/src/MarkupParser.cpp +2 -1
- data/src/RubyGosu.cxx +349 -83
- data/src/RubyGosu.h +4 -2
- data/src/TexChunk.cpp +1 -1
- data/src/TextBuilder.cpp +3 -1
- data/src/Texture.cpp +1 -1
- data/src/TrueTypeFont.cpp +1 -1
- data/src/Utility.cpp +11 -7
- data/src/Window.cpp +30 -39
- data/src/WindowWrapper.cpp +28 -0
- metadata +207 -52
- data/Gosu/Bitmap.hpp +0 -113
- data/src/AudioToolboxFile.hpp +0 -210
- data/src/OggFile.hpp +0 -92
- data/src/SndFile.hpp +0 -174
- data/src/WinMain.cpp +0 -64
@@ -0,0 +1,90 @@
|
|
1
|
+
/*
|
2
|
+
* This source code is public domain.
|
3
|
+
*
|
4
|
+
* Authors: Kenton Varda <temporal@gauge3d.org> (C interface wrapper)
|
5
|
+
*/
|
6
|
+
|
7
|
+
#ifndef MODPLUG_H__INCLUDED
|
8
|
+
#define MODPLUG_H__INCLUDED
|
9
|
+
|
10
|
+
#ifdef __cplusplus
|
11
|
+
extern "C" {
|
12
|
+
#endif
|
13
|
+
|
14
|
+
#define MODPLUG_EXPORT
|
15
|
+
|
16
|
+
struct _ModPlugFile;
|
17
|
+
typedef struct _ModPlugFile ModPlugFile;
|
18
|
+
|
19
|
+
enum _ModPlug_Flags
|
20
|
+
{
|
21
|
+
MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */
|
22
|
+
MODPLUG_ENABLE_NOISE_REDUCTION = 1 << 1, /* Enable noise reduction */
|
23
|
+
MODPLUG_ENABLE_REVERB = 1 << 2, /* Enable reverb */
|
24
|
+
MODPLUG_ENABLE_MEGABASS = 1 << 3, /* Enable megabass */
|
25
|
+
MODPLUG_ENABLE_SURROUND = 1 << 4 /* Enable surround sound. */
|
26
|
+
};
|
27
|
+
|
28
|
+
enum _ModPlug_ResamplingMode
|
29
|
+
{
|
30
|
+
MODPLUG_RESAMPLE_NEAREST = 0, /* No interpolation (very fast, extremely bad sound quality) */
|
31
|
+
MODPLUG_RESAMPLE_LINEAR = 1, /* Linear interpolation (fast, good quality) */
|
32
|
+
MODPLUG_RESAMPLE_SPLINE = 2, /* Cubic spline interpolation (high quality) */
|
33
|
+
MODPLUG_RESAMPLE_FIR = 3 /* 8-tap fir filter (extremely high quality) */
|
34
|
+
};
|
35
|
+
|
36
|
+
typedef struct _ModPlug_Settings
|
37
|
+
{
|
38
|
+
int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */
|
39
|
+
|
40
|
+
/* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then
|
41
|
+
* down-mixes to the settings you choose. */
|
42
|
+
int mChannels; /* Number of channels - 1 for mono or 2 for stereo */
|
43
|
+
int mBits; /* Bits per sample - 8, 16, or 32 */
|
44
|
+
int mFrequency; /* Sampling rate - 11025, 22050, or 44100 */
|
45
|
+
int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */
|
46
|
+
|
47
|
+
int mStereoSeparation; /* Stereo separation, 1 - 256 */
|
48
|
+
int mMaxMixChannels; /* Maximum number of mixing channels (polyphony), 32 - 256 */
|
49
|
+
|
50
|
+
int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */
|
51
|
+
int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */
|
52
|
+
int mBassAmount; /* XBass level 0(quiet)-100(loud) */
|
53
|
+
int mBassRange; /* XBass cutoff in Hz 10-100 */
|
54
|
+
int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */
|
55
|
+
int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */
|
56
|
+
int mLoopCount; /* Number of times to loop. Zero prevents looping.
|
57
|
+
-1 loops forever. */
|
58
|
+
} ModPlug_Settings;
|
59
|
+
|
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
|
+
#ifdef __cplusplus
|
87
|
+
} /* extern "C" */
|
88
|
+
#endif
|
89
|
+
|
90
|
+
#endif
|
@@ -0,0 +1,301 @@
|
|
1
|
+
/*
|
2
|
+
* This source code is public domain.
|
3
|
+
*
|
4
|
+
* Authors: Olivier Lapicque <olivierl@jps.net>
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "libmodplug.h"
|
8
|
+
|
9
|
+
static UINT GetMaskFromSize(UINT len)
|
10
|
+
//-----------------------------------
|
11
|
+
{
|
12
|
+
UINT n = 2;
|
13
|
+
while (n <= len) n <<= 1;
|
14
|
+
return ((n >> 1) - 1);
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
void CSoundFile_InitializeDSP(CSoundFile *_this, BOOL bReset)
|
19
|
+
//-----------------------------------------
|
20
|
+
{
|
21
|
+
if (!_this->m_nReverbDelay) _this->m_nReverbDelay = 100;
|
22
|
+
if (!_this->m_nXBassRange) _this->m_nXBassRange = XBASS_DELAY;
|
23
|
+
if (!_this->m_nProLogicDelay) _this->m_nProLogicDelay = 20;
|
24
|
+
if (_this->m_nXBassDepth > 8) _this->m_nXBassDepth = 8;
|
25
|
+
if (_this->m_nXBassDepth < 2) _this->m_nXBassDepth = 2;
|
26
|
+
if (bReset)
|
27
|
+
{
|
28
|
+
// Noise Reduction
|
29
|
+
_this->nLeftNR = _this->nRightNR = 0;
|
30
|
+
}
|
31
|
+
// Pro-Logic Surround
|
32
|
+
_this->nSurroundPos = _this->nSurroundSize = 0;
|
33
|
+
_this->nDolbyLoFltPos = _this->nDolbyLoFltSum = _this->nDolbyLoDlyPos = 0;
|
34
|
+
_this->nDolbyHiFltPos = _this->nDolbyHiFltSum = 0;
|
35
|
+
if (_this->gdwSoundSetup & SNDMIX_SURROUND)
|
36
|
+
{
|
37
|
+
SDL_memset(_this->DolbyLoFilterBuffer, 0, sizeof(_this->DolbyLoFilterBuffer));
|
38
|
+
SDL_memset(_this->DolbyHiFilterBuffer, 0, sizeof(_this->DolbyHiFilterBuffer));
|
39
|
+
SDL_memset(_this->DolbyLoFilterDelay, 0, sizeof(_this->DolbyLoFilterDelay));
|
40
|
+
SDL_memset(_this->SurroundBuffer, 0, sizeof(_this->SurroundBuffer));
|
41
|
+
_this->nSurroundSize = (_this->gdwMixingFreq * _this->m_nProLogicDelay) / 1000;
|
42
|
+
if (_this->nSurroundSize > SURROUNDBUFFERSIZE) _this->nSurroundSize = SURROUNDBUFFERSIZE;
|
43
|
+
if (_this->m_nProLogicDepth < 8) _this->nDolbyDepth = (32 >> _this->m_nProLogicDepth) + 32;
|
44
|
+
else _this->nDolbyDepth = (_this->m_nProLogicDepth < 16) ? (8 + (_this->m_nProLogicDepth - 8) * 7) : 64;
|
45
|
+
_this->nDolbyDepth >>= 2;
|
46
|
+
}
|
47
|
+
// Reverb Setup
|
48
|
+
#ifndef MODPLUG_NO_REVERB
|
49
|
+
if (_this->gdwSoundSetup & SNDMIX_REVERB)
|
50
|
+
{
|
51
|
+
UINT nrs = (_this->gdwMixingFreq * _this->m_nReverbDelay) / 1000;
|
52
|
+
UINT nfa = _this->m_nReverbDepth+1;
|
53
|
+
if (nrs > REVERBBUFFERSIZE) nrs = REVERBBUFFERSIZE;
|
54
|
+
if ((bReset) || (nrs != (UINT)_this->nReverbSize) || (nfa != (UINT)_this->nFilterAttn))
|
55
|
+
{
|
56
|
+
_this->nFilterAttn = nfa;
|
57
|
+
_this->nReverbSize = nrs;
|
58
|
+
_this->nReverbBufferPos = _this->nReverbBufferPos2 = _this->nReverbBufferPos3 = _this->nReverbBufferPos4 = 0;
|
59
|
+
_this->nReverbLoFltSum = _this->nReverbLoFltPos = _this->nReverbLoDlyPos = 0;
|
60
|
+
_this->gRvbLPSum = _this->gRvbLPPos = 0;
|
61
|
+
_this->nReverbSize2 = (_this->nReverbSize * 13) / 17;
|
62
|
+
if (_this->nReverbSize2 > REVERBBUFFERSIZE2) _this->nReverbSize2 = REVERBBUFFERSIZE2;
|
63
|
+
_this->nReverbSize3 = (_this->nReverbSize * 7) / 13;
|
64
|
+
if (_this->nReverbSize3 > REVERBBUFFERSIZE3) _this->nReverbSize3 = REVERBBUFFERSIZE3;
|
65
|
+
_this->nReverbSize4 = (_this->nReverbSize * 7) / 19;
|
66
|
+
if (_this->nReverbSize4 > REVERBBUFFERSIZE4) _this->nReverbSize4 = REVERBBUFFERSIZE4;
|
67
|
+
SDL_memset(_this->ReverbLoFilterBuffer, 0, sizeof(_this->ReverbLoFilterBuffer));
|
68
|
+
SDL_memset(_this->ReverbLoFilterDelay, 0, sizeof(_this->ReverbLoFilterDelay));
|
69
|
+
SDL_memset(_this->ReverbBuffer, 0, sizeof(_this->ReverbBuffer));
|
70
|
+
SDL_memset(_this->ReverbBuffer2, 0, sizeof(_this->ReverbBuffer2));
|
71
|
+
SDL_memset(_this->ReverbBuffer3, 0, sizeof(_this->ReverbBuffer3));
|
72
|
+
SDL_memset(_this->ReverbBuffer4, 0, sizeof(_this->ReverbBuffer4));
|
73
|
+
SDL_memset(_this->gRvbLowPass, 0, sizeof(_this->gRvbLowPass));
|
74
|
+
}
|
75
|
+
} else _this->nReverbSize = 0;
|
76
|
+
#endif
|
77
|
+
BOOL bResetBass = FALSE;
|
78
|
+
// Bass Expansion Reset
|
79
|
+
if (_this->gdwSoundSetup & SNDMIX_MEGABASS)
|
80
|
+
{
|
81
|
+
UINT nXBassSamples = (_this->gdwMixingFreq * _this->m_nXBassRange) / 10000;
|
82
|
+
if (nXBassSamples > XBASSBUFFERSIZE) nXBassSamples = XBASSBUFFERSIZE;
|
83
|
+
UINT mask = GetMaskFromSize(nXBassSamples);
|
84
|
+
if ((bReset) || (mask != (UINT)_this->nXBassMask))
|
85
|
+
{
|
86
|
+
_this->nXBassMask = mask;
|
87
|
+
bResetBass = TRUE;
|
88
|
+
}
|
89
|
+
} else
|
90
|
+
{
|
91
|
+
_this->nXBassMask = 0;
|
92
|
+
bResetBass = TRUE;
|
93
|
+
}
|
94
|
+
if (bResetBass)
|
95
|
+
{
|
96
|
+
_this->nXBassSum = _this->nXBassBufferPos = _this->nXBassDlyPos = 0;
|
97
|
+
SDL_memset(_this->XBassBuffer, 0, sizeof(_this->XBassBuffer));
|
98
|
+
SDL_memset(_this->XBassDelay, 0, sizeof(_this->XBassDelay));
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
void CSoundFile_ProcessStereoDSP(CSoundFile *_this, int count)
|
104
|
+
//------------------------------------------
|
105
|
+
{
|
106
|
+
#ifndef MODPLUG_NO_REVERB
|
107
|
+
// Reverb
|
108
|
+
if (_this->gdwSoundSetup & SNDMIX_REVERB)
|
109
|
+
{
|
110
|
+
int *pr = _this->MixSoundBuffer, *pin = _this->MixReverbBuffer, rvbcount = count;
|
111
|
+
do
|
112
|
+
{
|
113
|
+
int echo = _this->ReverbBuffer[_this->nReverbBufferPos] + _this->ReverbBuffer2[_this->nReverbBufferPos2]
|
114
|
+
+ _this->ReverbBuffer3[_this->nReverbBufferPos3] + _this->ReverbBuffer4[_this->nReverbBufferPos4]; // echo = reverb signal
|
115
|
+
// Delay line and remove Low Frequencies // v = original signal
|
116
|
+
int echodly = _this->ReverbLoFilterDelay[_this->nReverbLoDlyPos]; // echodly = delayed signal
|
117
|
+
_this->ReverbLoFilterDelay[_this->nReverbLoDlyPos] = echo >> 1;
|
118
|
+
_this->nReverbLoDlyPos++;
|
119
|
+
_this->nReverbLoDlyPos &= 0x1F;
|
120
|
+
int n = _this->nReverbLoFltPos;
|
121
|
+
_this->nReverbLoFltSum -= _this->ReverbLoFilterBuffer[n];
|
122
|
+
int tmp = echo / 128;
|
123
|
+
_this->ReverbLoFilterBuffer[n] = tmp;
|
124
|
+
_this->nReverbLoFltSum += tmp;
|
125
|
+
echodly -= _this->nReverbLoFltSum;
|
126
|
+
_this->nReverbLoFltPos = (n + 1) & 0x3F;
|
127
|
+
// Reverb
|
128
|
+
int v = (pin[0]+pin[1]) >> _this->nFilterAttn;
|
129
|
+
pr[0] += pin[0] + echodly;
|
130
|
+
pr[1] += pin[1] + echodly;
|
131
|
+
v += echodly >> 2;
|
132
|
+
_this->ReverbBuffer3[_this->nReverbBufferPos3] = v;
|
133
|
+
_this->ReverbBuffer4[_this->nReverbBufferPos4] = v;
|
134
|
+
v += echodly >> 4;
|
135
|
+
v >>= 1;
|
136
|
+
_this->gRvbLPSum -= _this->gRvbLowPass[_this->gRvbLPPos];
|
137
|
+
_this->gRvbLPSum += v;
|
138
|
+
_this->gRvbLowPass[_this->gRvbLPPos] = v;
|
139
|
+
_this->gRvbLPPos++;
|
140
|
+
_this->gRvbLPPos &= 7;
|
141
|
+
const int vlp = _this->gRvbLPSum >> 2;
|
142
|
+
_this->ReverbBuffer[_this->nReverbBufferPos] = vlp;
|
143
|
+
_this->ReverbBuffer2[_this->nReverbBufferPos2] = vlp;
|
144
|
+
if (++_this->nReverbBufferPos >= _this->nReverbSize) _this->nReverbBufferPos = 0;
|
145
|
+
if (++_this->nReverbBufferPos2 >= _this->nReverbSize2) _this->nReverbBufferPos2 = 0;
|
146
|
+
if (++_this->nReverbBufferPos3 >= _this->nReverbSize3) _this->nReverbBufferPos3 = 0;
|
147
|
+
if (++_this->nReverbBufferPos4 >= _this->nReverbSize4) _this->nReverbBufferPos4 = 0;
|
148
|
+
pr += 2;
|
149
|
+
pin += 2;
|
150
|
+
} while (--rvbcount);
|
151
|
+
}
|
152
|
+
#endif
|
153
|
+
// Dolby Pro-Logic Surround
|
154
|
+
if (_this->gdwSoundSetup & SNDMIX_SURROUND)
|
155
|
+
{
|
156
|
+
int *pr = _this->MixSoundBuffer, n = _this->nDolbyLoFltPos;
|
157
|
+
for (int r=count; r; r--)
|
158
|
+
{
|
159
|
+
int v = (pr[0]+pr[1]+DOLBYATTNROUNDUP) >> (nDolbyHiFltAttn+1);
|
160
|
+
v *= (int)_this->nDolbyDepth;
|
161
|
+
// Low-Pass Filter
|
162
|
+
_this->nDolbyHiFltSum -= _this->DolbyHiFilterBuffer[_this->nDolbyHiFltPos];
|
163
|
+
_this->DolbyHiFilterBuffer[_this->nDolbyHiFltPos] = v;
|
164
|
+
_this->nDolbyHiFltSum += v;
|
165
|
+
v = _this->nDolbyHiFltSum;
|
166
|
+
_this->nDolbyHiFltPos++;
|
167
|
+
_this->nDolbyHiFltPos &= nDolbyHiFltMask;
|
168
|
+
// Surround
|
169
|
+
int secho = _this->SurroundBuffer[_this->nSurroundPos];
|
170
|
+
_this->SurroundBuffer[_this->nSurroundPos] = v;
|
171
|
+
// Delay line and remove low frequencies
|
172
|
+
v = _this->DolbyLoFilterDelay[_this->nDolbyLoDlyPos]; // v = delayed signal
|
173
|
+
_this->DolbyLoFilterDelay[_this->nDolbyLoDlyPos] = secho; // secho = signal
|
174
|
+
_this->nDolbyLoDlyPos++;
|
175
|
+
_this->nDolbyLoDlyPos &= 0x1F;
|
176
|
+
_this->nDolbyLoFltSum -= _this->DolbyLoFilterBuffer[n];
|
177
|
+
int tmp = secho / 64;
|
178
|
+
_this->DolbyLoFilterBuffer[n] = tmp;
|
179
|
+
_this->nDolbyLoFltSum += tmp;
|
180
|
+
v -= _this->nDolbyLoFltSum;
|
181
|
+
n++;
|
182
|
+
n &= 0x3F;
|
183
|
+
// Add echo
|
184
|
+
pr[0] += v;
|
185
|
+
pr[1] -= v;
|
186
|
+
if (++_this->nSurroundPos >= _this->nSurroundSize) _this->nSurroundPos = 0;
|
187
|
+
pr += 2;
|
188
|
+
}
|
189
|
+
_this->nDolbyLoFltPos = n;
|
190
|
+
}
|
191
|
+
// Bass Expansion
|
192
|
+
if (_this->gdwSoundSetup & SNDMIX_MEGABASS)
|
193
|
+
{
|
194
|
+
int *px = _this->MixSoundBuffer;
|
195
|
+
int xba = _this->m_nXBassDepth+1, xbamask = (1 << xba) - 1;
|
196
|
+
int n = _this->nXBassBufferPos;
|
197
|
+
for (int x=count; x; x--)
|
198
|
+
{
|
199
|
+
_this->nXBassSum -= _this->XBassBuffer[n];
|
200
|
+
int tmp0 = px[0] + px[1];
|
201
|
+
int tmp = (tmp0 + ((tmp0 >> 31) & xbamask)) >> xba;
|
202
|
+
_this->XBassBuffer[n] = tmp;
|
203
|
+
_this->nXBassSum += tmp;
|
204
|
+
int v = _this->XBassDelay[_this->nXBassDlyPos];
|
205
|
+
_this->XBassDelay[_this->nXBassDlyPos] = px[0];
|
206
|
+
px[0] = v + _this->nXBassSum;
|
207
|
+
v = _this->XBassDelay[_this->nXBassDlyPos+1];
|
208
|
+
_this->XBassDelay[_this->nXBassDlyPos+1] = px[1];
|
209
|
+
px[1] = v + _this->nXBassSum;
|
210
|
+
_this->nXBassDlyPos = (_this->nXBassDlyPos + 2) & _this->nXBassMask;
|
211
|
+
px += 2;
|
212
|
+
n++;
|
213
|
+
n &= _this->nXBassMask;
|
214
|
+
}
|
215
|
+
_this->nXBassBufferPos = n;
|
216
|
+
}
|
217
|
+
// Noise Reduction
|
218
|
+
if (_this->gdwSoundSetup & SNDMIX_NOISEREDUCTION)
|
219
|
+
{
|
220
|
+
int n1 = _this->nLeftNR, n2 = _this->nRightNR;
|
221
|
+
int *pnr = _this->MixSoundBuffer;
|
222
|
+
for (int nr=count; nr; nr--)
|
223
|
+
{
|
224
|
+
int vnr = pnr[0] >> 1;
|
225
|
+
pnr[0] = vnr + n1;
|
226
|
+
n1 = vnr;
|
227
|
+
vnr = pnr[1] >> 1;
|
228
|
+
pnr[1] = vnr + n2;
|
229
|
+
n2 = vnr;
|
230
|
+
pnr += 2;
|
231
|
+
}
|
232
|
+
_this->nLeftNR = n1;
|
233
|
+
_this->nRightNR = n2;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
/////////////////////////////////////////////////////////////////
|
239
|
+
// Clean DSP Effects interface
|
240
|
+
|
241
|
+
// [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms]
|
242
|
+
BOOL CSoundFile_SetReverbParameters(CSoundFile *_this, UINT nDepth, UINT nDelay)
|
243
|
+
//------------------------------------------------------------
|
244
|
+
{
|
245
|
+
if (nDepth > 100) nDepth = 100;
|
246
|
+
UINT gain = nDepth / 20;
|
247
|
+
if (gain > 4) gain = 4;
|
248
|
+
_this->m_nReverbDepth = 4 - gain;
|
249
|
+
if (nDelay < 40) nDelay = 40;
|
250
|
+
if (nDelay > 250) nDelay = 250;
|
251
|
+
_this->m_nReverbDelay = nDelay;
|
252
|
+
return TRUE;
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
// [XBass level 0(quiet)-100(loud)], [cutoff in Hz 20-100]
|
257
|
+
BOOL CSoundFile_SetXBassParameters(CSoundFile *_this, UINT nDepth, UINT nRange)
|
258
|
+
//-----------------------------------------------------------
|
259
|
+
{
|
260
|
+
if (nDepth > 100) nDepth = 100;
|
261
|
+
UINT gain = nDepth / 20;
|
262
|
+
if (gain > 4) gain = 4;
|
263
|
+
_this->m_nXBassDepth = 8 - gain; // filter attenuation 1/256 .. 1/16
|
264
|
+
UINT range = nRange / 5;
|
265
|
+
if (range > 5) range -= 5; else range = 0;
|
266
|
+
if (nRange > 16) nRange = 16;
|
267
|
+
_this->m_nXBassRange = 21 - range; // filter average on 0.5-1.6ms
|
268
|
+
return TRUE;
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
// [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-50ms]
|
273
|
+
BOOL CSoundFile_SetSurroundParameters(CSoundFile *_this, UINT nDepth, UINT nDelay)
|
274
|
+
//--------------------------------------------------------------
|
275
|
+
{
|
276
|
+
UINT gain = (nDepth * 16) / 100;
|
277
|
+
if (gain > 16) gain = 16;
|
278
|
+
if (gain < 1) gain = 1;
|
279
|
+
_this->m_nProLogicDepth = gain;
|
280
|
+
if (nDelay < 4) nDelay = 4;
|
281
|
+
if (nDelay > 50) nDelay = 50;
|
282
|
+
_this->m_nProLogicDelay = nDelay;
|
283
|
+
return TRUE;
|
284
|
+
}
|
285
|
+
|
286
|
+
BOOL CSoundFile_SetWaveConfigEx(CSoundFile *_this, BOOL bSurround,BOOL bNoOverSampling,BOOL bReverb,BOOL hqido,BOOL bMegaBass,BOOL bNR,BOOL bEQ)
|
287
|
+
//----------------------------------------------------------------------------------------------------------------------------
|
288
|
+
{
|
289
|
+
DWORD d = _this->gdwSoundSetup & ~(SNDMIX_SURROUND | SNDMIX_NORESAMPLING | SNDMIX_REVERB | SNDMIX_HQRESAMPLER | SNDMIX_MEGABASS | SNDMIX_NOISEREDUCTION | SNDMIX_EQ);
|
290
|
+
if (bSurround) d |= SNDMIX_SURROUND;
|
291
|
+
if (bNoOverSampling) d |= SNDMIX_NORESAMPLING;
|
292
|
+
if (bReverb) d |= SNDMIX_REVERB;
|
293
|
+
if (hqido) d |= SNDMIX_HQRESAMPLER;
|
294
|
+
if (bMegaBass) d |= SNDMIX_MEGABASS;
|
295
|
+
if (bNR) d |= SNDMIX_NOISEREDUCTION;
|
296
|
+
if (bEQ) d |= SNDMIX_EQ;
|
297
|
+
_this->gdwSoundSetup = d;
|
298
|
+
CSoundFile_InitPlayer(_this, FALSE);
|
299
|
+
return TRUE;
|
300
|
+
}
|
301
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* This source code is public domain.
|
3
|
+
*
|
4
|
+
* Authors: Olivier Lapicque <olivierl@jps.net>
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "libmodplug.h"
|
8
|
+
|
9
|
+
// AWE32: cutoff = reg[0-255] * 31.25 + 100 -> [100Hz-8060Hz]
|
10
|
+
// EMU10K1 docs: cutoff = reg[0-127]*62+100
|
11
|
+
#define FILTER_PRECISION 8192
|
12
|
+
|
13
|
+
#ifndef NO_FILTER
|
14
|
+
|
15
|
+
DWORD CSoundFile_CutOffToFrequency(CSoundFile *_this, UINT nCutOff, int flt_modifier)
|
16
|
+
//-----------------------------------------------------------------------
|
17
|
+
{
|
18
|
+
float Fc;
|
19
|
+
|
20
|
+
if (_this->m_dwSongFlags & SONG_EXFILTERRANGE)
|
21
|
+
Fc = 110.0f * SDL_pow(2.0f, 0.25f + ((float)(nCutOff*(flt_modifier+256)))/(21.0f*512.0f));
|
22
|
+
else
|
23
|
+
Fc = 110.0f * SDL_pow(2.0f, 0.25f + ((float)(nCutOff*(flt_modifier+256)))/(24.0f*512.0f));
|
24
|
+
LONG freq = (LONG)Fc;
|
25
|
+
if (freq < 120) return 120;
|
26
|
+
if (freq > 10000) return 10000;
|
27
|
+
if (freq*2 > (LONG)_this->gdwMixingFreq) freq = _this->gdwMixingFreq>>1;
|
28
|
+
return (DWORD)freq;
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
// Simple 2-poles resonant filter
|
33
|
+
void CSoundFile_SetupChannelFilter(CSoundFile *_this, MODCHANNEL *pChn, BOOL bReset, int flt_modifier)
|
34
|
+
//----------------------------------------------------------------------------------------
|
35
|
+
{
|
36
|
+
float fc = (float)CSoundFile_CutOffToFrequency(_this, pChn->nCutOff, flt_modifier);
|
37
|
+
float fs = (float)_this->gdwMixingFreq;
|
38
|
+
float fg, fb0, fb1;
|
39
|
+
|
40
|
+
fc *= (float)(2.0*3.14159265358/fs);
|
41
|
+
float dmpfac = SDL_pow(10.0f, -((24.0f / 128.0f)*(float)pChn->nResonance) / 20.0f);
|
42
|
+
float d = (1.0f-2.0f*dmpfac)* fc;
|
43
|
+
if (d>2.0) d = 2.0;
|
44
|
+
d = (2.0f*dmpfac - d)/fc;
|
45
|
+
float e = SDL_pow(1.0f/fc,2.0f);
|
46
|
+
|
47
|
+
fg=1/(1+d+e);
|
48
|
+
fb0=(d+e+e)/(1+d+e);
|
49
|
+
fb1=-e/(1+d+e);
|
50
|
+
|
51
|
+
pChn->nFilter_A0 = (int)(fg * FILTER_PRECISION);
|
52
|
+
pChn->nFilter_B0 = (int)(fb0 * FILTER_PRECISION);
|
53
|
+
pChn->nFilter_B1 = (int)(fb1 * FILTER_PRECISION);
|
54
|
+
|
55
|
+
if (bReset)
|
56
|
+
{
|
57
|
+
pChn->nFilter_Y1 = pChn->nFilter_Y2 = 0;
|
58
|
+
pChn->nFilter_Y3 = pChn->nFilter_Y4 = 0;
|
59
|
+
}
|
60
|
+
pChn->dwFlags |= CHN_FILTER;
|
61
|
+
}
|
62
|
+
|
63
|
+
#endif // NO_FILTER
|