[Scummvm-git-logs] scummvm master -> ffef677eb46712ab57d07b680a0d31a8874829e3

dreammaster dreammaster at scummvm.org
Sun Feb 7 16:13:26 UTC 2021


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
369659fb72 AGS: Rename GFX_XWINDOWS to GFX_SCUMMVM
a5615ef644 AGS: Remove unused OpenGL code
ffef677eb4 AGS: Remove unused DUMB library


Commit: 369659fb72bf9a8d44f60e9de61aee37bddb15f5
    https://github.com/scummvm/scummvm/commit/369659fb72bf9a8d44f60e9de61aee37bddb15f5
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-07T08:13:21-08:00

Commit Message:
AGS: Rename GFX_XWINDOWS to GFX_SCUMMVM

Changed paths:
    engines/ags/engine/gfx/ali3dscummvm.cpp
    engines/ags/engine/platform/linux/acpllnx.cpp
    engines/ags/lib/allegro/system.h
    engines/ags/lib/opengl/opengl.h


diff --git a/engines/ags/engine/gfx/ali3dscummvm.cpp b/engines/ags/engine/gfx/ali3dscummvm.cpp
index 27cd4a7099..d64c5e9ebd 100644
--- a/engines/ags/engine/gfx/ali3dscummvm.cpp
+++ b/engines/ags/engine/gfx/ali3dscummvm.cpp
@@ -36,7 +36,6 @@
 #include "ags/engine/platform/base/agsplatformdriver.h"
 #include "ags/engine/ac/timer.h"
 #include "ags/lib/allegro/color.h"
-#include "ags/lib/opengl/opengl.h"
 #include "ags/lib/std/algorithm.h"
 #include "ags/ags.h"
 
@@ -154,24 +153,9 @@ PGfxFilter ALScummVMGraphicsDriver::GetGraphicsFilter() const {
 }
 
 int ALScummVMGraphicsDriver::GetAllegroGfxDriverID(bool windowed) {
-#if AGS_PLATFORM_OS_WINDOWS
-	if (windowed)
-		return GFX_DIRECTX_WIN;
-	return GFX_DIRECTX;
-#elif AGS_PLATFORM_OS_LINUX && (!defined (ALLEGRO_MAGIC_DRV))
-	if (windowed)
-		return GFX_XWINDOWS;
-	return GFX_XWINDOWS_FULLSCREEN;
-#elif AGS_PLATFORM_OS_MACOS
-	if (windowed) {
-		return GFX_COCOAGL_WINDOW;
-	}
-	return GFX_COCOAGL_FULLSCREEN;
-#else
 	if (windowed)
-		return GFX_AUTODETECT_WINDOWED;
-	return GFX_AUTODETECT_FULLSCREEN;
-#endif
+		return GFX_SCUMMVM;
+	return GFX_SCUMMVM_FULLSCREEN;
 }
 
 void ALScummVMGraphicsDriver::SetGraphicsFilter(PALScummVMFilter filter) {
diff --git a/engines/ags/engine/platform/linux/acpllnx.cpp b/engines/ags/engine/platform/linux/acpllnx.cpp
index a6964c009b..f9a0706525 100644
--- a/engines/ags/engine/platform/linux/acpllnx.cpp
+++ b/engines/ags/engine/platform/linux/acpllnx.cpp
@@ -33,7 +33,6 @@
 //include <pwd.h>
 //include <sys/stat.h>
 #include "ags/lib/allegro.h"
-#include "ags/lib/opengl/opengl.h"
 #include "ags/engine/ac/runtime_defines.h"
 #include "ags/engine/gfx/gfxdefines.h"
 #include "ags/engine/platform/base/agsplatformdriver.h"
@@ -210,7 +209,7 @@ void AGSLinux::UnlockMouse() {
 
 void AGSLinux::GetSystemDisplayModes(std::vector<Engine::DisplayMode> &dms) {
 	dms.clear();
-	GFX_MODE_LIST *gmlist = get_gfx_mode_list(GFX_XWINDOWS_FULLSCREEN);
+	GFX_MODE_LIST *gmlist = get_gfx_mode_list(GFX_SCUMMVM_FULLSCREEN);
 	for (int i = 0; i < gmlist->num_modes; ++i) {
 		const GFX_MODE &m = gmlist->mode[i];
 		dms.push_back(Engine::DisplayMode(Engine::GraphicResolution(m.width, m.height, m.bpp)));
diff --git a/engines/ags/lib/allegro/system.h b/engines/ags/lib/allegro/system.h
index 295f4af48c..bea3b36752 100644
--- a/engines/ags/lib/allegro/system.h
+++ b/engines/ags/lib/allegro/system.h
@@ -38,6 +38,9 @@ namespace AGS3 {
 #define SYSTEM_SCUMMVM     AL_ID('S','C','V','M')
 #define SYSTEM_NONE        AL_ID('N','O','N','E')
 
+#define GFX_SCUMMVM             AL_ID('S', 'C', 'V', 'M')
+#define GFX_SCUMMVM_FULLSCREEN  AL_ID('S', 'C', 'V', 'M')
+
 #define SWITCH_NONE           0
 #define SWITCH_PAUSE          1
 #define SWITCH_AMNESIA        2
diff --git a/engines/ags/lib/opengl/opengl.h b/engines/ags/lib/opengl/opengl.h
index 92fb19034f..cee3f68dc3 100644
--- a/engines/ags/lib/opengl/opengl.h
+++ b/engines/ags/lib/opengl/opengl.h
@@ -31,8 +31,6 @@ namespace AGS3 {
 #define GL_TRUE   1
 #define GL_FALSE  2
 
-#define GFX_XWINDOWS MKTAG('S', 'C', 'V', 'M')
-#define GFX_XWINDOWS_FULLSCREEN MKTAG('S', 'C', 'V', 'M')
 #define GL_FLOAT 1
 
 // glEnable/glDisable


Commit: a5615ef64449007fceb8ffebf33843a23769376b
    https://github.com/scummvm/scummvm/commit/a5615ef64449007fceb8ffebf33843a23769376b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-07T08:13:21-08:00

Commit Message:
AGS: Remove unused OpenGL code

Changed paths:
  R engines/ags/engine/gfx/gfxfilter_aaogl.cpp
  R engines/ags/engine/gfx/gfxfilter_aaogl.h
  R engines/ags/engine/gfx/gfxfilter_ogl.cpp
  R engines/ags/engine/gfx/gfxfilter_ogl.h
  R engines/ags/engine/gfx/ogl_headers.h
  R engines/ags/lib/opengl/opengl.cpp
  R engines/ags/lib/opengl/opengl.h
    engines/ags/engine/gfx/gfxdriverfactory.cpp
    engines/ags/module.mk


diff --git a/engines/ags/engine/gfx/gfxdriverfactory.cpp b/engines/ags/engine/gfx/gfxdriverfactory.cpp
index e08ab1ddfe..47c01e4654 100644
--- a/engines/ags/engine/gfx/gfxdriverfactory.cpp
+++ b/engines/ags/engine/gfx/gfxdriverfactory.cpp
@@ -25,7 +25,6 @@
 #include "ags/shared/core/platform.h"
 
 #define AGS_HAS_DIRECT3D (AGS_PLATFORM_OS_WINDOWS)
-#define AGS_HAS_OPENGL (AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_ANDROID || AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_LINUX)
 
 #include "ags/engine/gfx/ali3dscummvm.h"
 #include "ags/engine/gfx/gfxfilter_allegro.h"
diff --git a/engines/ags/engine/gfx/gfxfilter_aaogl.cpp b/engines/ags/engine/gfx/gfxfilter_aaogl.cpp
deleted file mode 100644
index f809d93310..0000000000
--- a/engines/ags/engine/gfx/gfxfilter_aaogl.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/shared/core/platform.h"
-
-#if AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_ANDROID || AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_LINUX
-
-#include "ags/engine/gfx/gfxfilter_aaogl.h"
-#include "ags/engine/gfx/ogl_headers.h"
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-namespace OGL {
-
-const GfxFilterInfo AAOGLGfxFilter::FilterInfo = GfxFilterInfo("Linear", "Linear interpolation");
-
-bool AAOGLGfxFilter::UseLinearFiltering() const {
-	return true;
-}
-
-void AAOGLGfxFilter::SetFilteringForStandardSprite() {
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-}
-
-const GfxFilterInfo &AAOGLGfxFilter::GetInfo() const {
-	return FilterInfo;
-}
-
-} // namespace OGL
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif // only on Windows, Android and iOS
diff --git a/engines/ags/engine/gfx/gfxfilter_aaogl.h b/engines/ags/engine/gfx/gfxfilter_aaogl.h
deleted file mode 100644
index 071cfc7b91..0000000000
--- a/engines/ags/engine/gfx/gfxfilter_aaogl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-//=============================================================================
-//
-// Anti-aliased OGL filter
-//
-//=============================================================================
-
-#ifndef AGS_ENGINE_GFX_AAOGLGFXFILTER_H
-#define AGS_ENGINE_GFX_AAOGLGFXFILTER_H
-
-#include "ags/engine/gfx/gfxfilter_ogl.h"
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-namespace OGL {
-
-class AAOGLGfxFilter : public OGLGfxFilter {
-public:
-	const GfxFilterInfo &GetInfo() const override;
-
-	bool UseLinearFiltering() const override;
-	void SetFilteringForStandardSprite() override;
-
-	static const GfxFilterInfo FilterInfo;
-};
-
-} // namespace OGL
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/gfx/gfxfilter_ogl.cpp b/engines/ags/engine/gfx/gfxfilter_ogl.cpp
deleted file mode 100644
index 44edd0db5f..0000000000
--- a/engines/ags/engine/gfx/gfxfilter_ogl.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/shared/core/platform.h"
-
-#if AGS_PLATFORM_OS_WINDOWS || AGS_PLATFORM_OS_ANDROID || AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_LINUX
-
-#include "ags/engine/gfx/gfxfilter_ogl.h"
-#include "ags/engine/gfx/ogl_headers.h"
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-namespace OGL {
-
-const GfxFilterInfo OGLGfxFilter::FilterInfo = GfxFilterInfo("StdScale", "Nearest-neighbour");
-
-bool OGLGfxFilter::UseLinearFiltering() const {
-	return false;
-}
-
-void OGLGfxFilter::SetFilteringForStandardSprite() {
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-}
-
-const GfxFilterInfo &OGLGfxFilter::GetInfo() const {
-	return FilterInfo;
-}
-
-} // namespace OGL
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif // only on Windows, Android and iOS
diff --git a/engines/ags/engine/gfx/gfxfilter_ogl.h b/engines/ags/engine/gfx/gfxfilter_ogl.h
deleted file mode 100644
index a6d5b9bbdb..0000000000
--- a/engines/ags/engine/gfx/gfxfilter_ogl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-//=============================================================================
-//
-// Dummy OpenGL filter; does nothing useful at the moment
-//
-//=============================================================================
-
-#ifndef AGS_ENGINE_GFX_OGLGFXFILTER_H
-#define AGS_ENGINE_GFX_OGLGFXFILTER_H
-
-#include "ags/engine/gfx/gfxfilter_scaling.h"
-
-namespace AGS3 {
-namespace AGS {
-namespace Engine {
-namespace OGL {
-
-class OGLGfxFilter : public ScalingGfxFilter {
-public:
-	const GfxFilterInfo &GetInfo() const override;
-
-	virtual bool UseLinearFiltering() const;
-	virtual void SetFilteringForStandardSprite();
-
-	static const GfxFilterInfo FilterInfo;
-};
-
-} // namespace D3D
-} // namespace Engine
-} // namespace AGS
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/engine/gfx/ogl_headers.h b/engines/ags/engine/gfx/ogl_headers.h
deleted file mode 100644
index b3591766c3..0000000000
--- a/engines/ags/engine/gfx/ogl_headers.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-//=============================================================================
-//
-// OpenGL includes and definitions for various platforms
-//
-//=============================================================================
-
-#include "ags/shared/core/platform.h"
-
-#if AGS_PLATFORM_SCUMMVM
-#include "ags/lib/opengl/opengl.h"
-#elif AGS_PLATFORM_OS_WINDOWS
-#include "ags/lib/allegro.h"
-//include <winalleg.h>
-//include <allegro/platform/aintwin.h>
-
-#include "ags/shared/glad/glad.h"
-#include "ags/shared/glad/glad_wgl.h"
-
-#elif AGS_PLATFORM_OS_LINUX
-#include "ags/lib/allegro.h"
-//include <xalleg.h>
-//include <X11/Xatom.h>
-
-//include "glad/glad.h"
-//include "glad/glad_glx.h"
-
-#elif AGS_PLATFORM_OS_ANDROID
-
-//include <GLES/gl.h>
-//include <GLES2/gl2.h>
-
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES
-#endif
-
-// TODO: we probably should not use GLExt since we use GLES2
-//include <GLES/glext.h>
-
-#define HDC void*
-#define HGLRC void*
-#define HWND void*
-#define HINSTANCE void*
-
-#elif AGS_PLATFORM_OS_IOS
-
-//include <OpenGLES/ES1/gl.h>
-//include <OpenGLES/ES2/gl.h>
-
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES
-#endif
-
-//include <OpenGLES/ES1/glext.h>
-
-#define HDC void*
-#define HGLRC void*
-#define HWND void*
-#define HINSTANCE void*
-
-#else
-
-#error "opengl: unsupported platform"
-
-#endif
-
-#ifndef GLAPI
-#define GLAD_GL_VERSION_2_0 (0)
-#endif
diff --git a/engines/ags/lib/opengl/opengl.cpp b/engines/ags/lib/opengl/opengl.cpp
deleted file mode 100644
index d2d098d17c..0000000000
--- a/engines/ags/lib/opengl/opengl.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/lib/opengl/opengl.h"
-#include "common/array.h"
-#include "graphics/managed_surface.h"
-#include "common/system.h"
-
-namespace AGS3 {
-
-Common::Array<Graphics::ManagedSurface> texturesArray;
-uint32 currentColor, clearColor;
-
-const GLubyte *glGetString(GLenum name) {
-	switch (name) {
-	case GL_VERSION:
-		return (const GLubyte *)"ScummVM";
-	case GL_EXTENSIONS:
-		return (const GLubyte *)"ScummVM Extensions";
-	default:
-		return nullptr;
-	}
-}
-
-void glTexParameteri(GLenum target, GLenum pname, GLint param) {
-	// No implementation
-}
-
-void glDeleteTextures(GLsizei n, const GLuint *textures) {
-	for (; n > 0; --n, ++textures) {
-		texturesArray[*textures].clear();
-	}
-}
-
-GLint glGetUniformLocation(GLuint program, const GLchar *name) {
-	error("TODO: glGetUniformLocation");
-}
-
-void glShadeModel(GLenum mode) {
-}
-
-void glGetProgramiv(GLuint program, GLenum pname, GLint *params) {
-	assert(pname == GL_LINK_STATUS);
-	*params = GL_TRUE;
-}
-
-void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-	Graphics::PixelFormat format = g_system->getScreenFormat();
-	currentColor = format.RGBToColor((byte)(red * 255), (byte)(green * 255), (byte)(blue * 255));
-}
-
-void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-	Graphics::PixelFormat format = g_system->getScreenFormat();
-	clearColor = format.RGBToColor((byte)(red * 255), (byte)(green * 255), (byte)(blue * 255));
-}
-
-void glClear(GLbitfield mask) {
-}
-
-void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
-	warning("TODO: glDrawArrays");
-}
-
-void glReadBuffer(GLenum mode) {
-	warning("TODO: glReadBuffer");
-}
-
-void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data) {
-	warning("TODO: glReadPixels");
-}
-
-void glGetIntegerv(GLenum pname, GLint *data) {
-	switch (pname) {
-	case GL_MAX_TEXTURE_SIZE:
-		*data = 512;
-		break;
-	default:
-		*data = 0;
-		break;
-	}
-}
-
-void glGetFloatv(GLenum pname, GLfloat *params) {
-	// TODO: glGetFloatv
-	*params = 0.0;
-}
-
-void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
-	GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) {
-	warning("TODO: glTexSubImage2D");
-}
-
-void glTexImage2D(GLenum target, GLint level, GLint internalformat,
-	GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data) {
-	warning("TODO: glTexImage2D");
-}
-
-void glGenTextures(GLsizei n, GLuint *textures) {
-	warning("TODO: glGenTextures");
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/opengl/opengl.h b/engines/ags/lib/opengl/opengl.h
deleted file mode 100644
index cee3f68dc3..0000000000
--- a/engines/ags/lib/opengl/opengl.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef AGS_LIB_OPENGL_OPENGL_H
-#define AGS_LIB_OPENGL_OPENGL_H
-
-#include "common/scummsys.h"
-#include "common/endian.h"
-
-namespace AGS3 {
-
-#define GL_TRUE   1
-#define GL_FALSE  2
-
-#define GL_FLOAT 1
-
-// glEnable/glDisable
-#define GL_BLEND 1
-#define GL_SCISSOR_TEST 2
-#define GL_CULL_FACE 3
-#define GL_DEPTH_TEST 4
-#define GL_LIGHTING 5
-#define GL_TEXTURE_2D         0x0DE1
-#define GL_NEAREST            0x2600
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-
-// glBlendFunc
-#define GL_SRC_ALPHA 1
-#define GL_ONE_MINUS_SRC_ALPHA 2
-
-// glShadeModel
-#define GL_FLAT 1
-
-// glGetString
-#define GL_VERSION 1
-#define GL_EXTENSIONS 2
-
-// glGetProgramiv
-#define GL_LINK_STATUS 1
-
-// glClear
-#define GL_COLOR_BUFFER_BIT 1
-
-// glMatrixMode
-#define GL_PROJECTION 1
-#define GL_MODELVIEW 2
-
-// glEnableClientState/glDisableClientState
-#define GL_COLOR_ARRAY 1
-#define GL_NORMAL_ARRAY 2
-#define GL_VERTEX_ARRAY 3
-#define GL_TEXTURE_COORD_ARRAY 4
-
-// glTexParameteri
-#define GL_LINEAR 1
-#define GL_CLAMP 2
-#define GL_TEXTURE_WRAP_T 3
-#define GL_TEXTURE_WRAP_S 4
-
-// glBindFramebufferEXT
-#define GL_FRAMEBUFFER_EXT 1
-
-// glReadBuffer
-#define GL_FRONT 1
-
-// glReadPixels
-#define GL_RGBA 1
-#define GL_UNSIGNED_BYTE 2
-
-// glDrawArrays
-#define GL_TRIANGLE_STRIP 1
-
-// glGetIntegerv/glGetFloatv
-#define GL_MAX_TEXTURE_SIZE 1
-#define GL_MODELVIEW_MATRIX 2
-
-
-typedef char GLchar;
-typedef byte GLubyte;
-typedef uint GLenum;
-typedef int GLint;
-typedef uint32 GLuint;
-typedef uint GLbitfield;
-typedef float GLfloat;
-typedef double GLdouble;
-typedef size_t GLsizei;
-
-struct GLXContextStruct {
-};
-typedef GLXContextStruct *GLXContext;
-
-inline bool gladLoadGL() { return true; }
-inline void glFinish() {}
-
-inline int glCreateProgram() { return 1; }
-inline void glDeleteProgram(int prog) {}
-inline void glEnable(GLenum cap) {}
-inline void glDisable(GLenum cap) {}
-inline void glBlendFunc(GLenum sfactor, GLenum dfactor) {}
-inline void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {}
-inline void glMatrixMode(GLenum mode) {}
-inline void glLoadIdentity() {}
-inline void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
-	GLdouble nearVal, GLdouble farVal) {}
-inline void glEnableClientState(GLenum arr) {}
-inline void glDisableClientState(GLenum arr) {}
-inline void glUseProgram(GLuint program) {}
-inline void glUniform1f(GLint location, GLfloat v0) {}
-inline void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {}
-inline void glUniform1i(GLint location, GLint v0) {}
-inline void glTranslatef(GLfloat x, GLfloat y, GLfloat z) {}
-inline void glMultMatrixf(const GLfloat *m) {}
-inline void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {}
-inline void glScalef(GLfloat x, GLfloat y, GLfloat z) {}
-inline void glBindTexture(GLenum target, GLuint texture) {}
-inline void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {}
-inline void glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {}
-inline void glBindFramebufferEXT(GLenum v1, uint v2) {}
-inline void glDeleteFramebuffersEXT(int v1, uint *v2) {}
-inline void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {}
-
-extern const GLubyte *glGetString(GLenum name);
-extern void glTexParameteri(GLenum target, GLenum pname, GLint param);
-extern void glDeleteTextures(GLsizei n, const GLuint *textures);
-extern GLint glGetUniformLocation(GLuint program, const GLchar *name);
-extern void glShadeModel(GLenum mode);
-extern void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
-
-extern void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-extern void glClear(GLbitfield mask);
-extern void glDrawArrays(GLenum mode, GLint first, GLsizei count);
-extern void glReadBuffer(GLenum mode);
-extern void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data);
-extern void glGetIntegerv(GLenum pname, GLint *data);
-extern void glGetFloatv(GLenum  pname, GLfloat *params);
-extern void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
-	GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-extern void glTexImage2D(GLenum target, GLint level, GLint internalformat,
-	GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data);
-extern void glGenTextures(GLsizei n, GLuint *textures);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index fbb424d45b..6fa5f8089f 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -36,7 +36,6 @@ MODULE_OBJS = \
 	lib/dumb-0.9.2/it/itrender.o \
 	lib/dumb-0.9.2/it/itunload.o \
 	lib/hq2x/hq2x3x.o \
-	lib/opengl/opengl.o \
 	lib/std/std.o \
 	lib/system/datetime.o \
 	shared/ac/dynobj/scriptaudioclip.o \
@@ -252,11 +251,9 @@ MODULE_OBJS = \
 	engine/gfx/gfxdriverbase.o \
 	engine/gfx/gfxdriverfactory.o \
 	engine/gfx/gfxfilter_aad3d.o \
-	engine/gfx/gfxfilter_aaogl.o \
 	engine/gfx/gfxfilter_allegro.o \
 	engine/gfx/gfxfilter_d3d.o \
 	engine/gfx/gfxfilter_hqx.o \
-	engine/gfx/gfxfilter_ogl.o \
 	engine/gfx/gfxfilter_scaling.o \
 	engine/gui/animatingguibutton.o \
 	engine/gui/cscidialog.o \


Commit: ffef677eb46712ab57d07b680a0d31a8874829e3
    https://github.com/scummvm/scummvm/commit/ffef677eb46712ab57d07b680a0d31a8874829e3
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-02-07T08:13:21-08:00

Commit Message:
AGS: Remove unused DUMB library

Changed paths:
  R engines/ags/lib/audio/aldumb.cpp
  R engines/ags/lib/audio/aldumb.h
  R engines/ags/lib/dumb-0.9.2/dumb.cpp
  R engines/ags/lib/dumb-0.9.2/dumb.h
  R engines/ags/lib/dumb-0.9.2/dumbfile.cpp
  R engines/ags/lib/dumb-0.9.2/helpers/clickrem.cpp
  R engines/ags/lib/dumb-0.9.2/helpers/memfile.c
  R engines/ags/lib/dumb-0.9.2/helpers/resample.c
  R engines/ags/lib/dumb-0.9.2/helpers/sampbuf.c
  R engines/ags/lib/dumb-0.9.2/helpers/silence.c
  R engines/ags/lib/dumb-0.9.2/helpers/stdfile.c
  R engines/ags/lib/dumb-0.9.2/it.h
  R engines/ags/lib/dumb-0.9.2/it/it.h
  R engines/ags/lib/dumb-0.9.2/it/itmisc.cpp
  R engines/ags/lib/dumb-0.9.2/it/itrender.cpp
  R engines/ags/lib/dumb-0.9.2/it/itunload.cpp
  R engines/ags/lib/dumb-0.9.2/readxm.cpp
    engines/ags/engine/ac/asset_helper.h
    engines/ags/engine/ac/file.cpp
    engines/ags/module.mk


diff --git a/engines/ags/engine/ac/asset_helper.h b/engines/ags/engine/ac/asset_helper.h
index 4ce099cc9b..8616507be4 100644
--- a/engines/ags/engine/ac/asset_helper.h
+++ b/engines/ags/engine/ac/asset_helper.h
@@ -53,7 +53,6 @@ Stream *find_open_asset(const String &filename);
 
 extern "C" {
 	struct PACKFILE; // Allegro 4's own stream type
-	struct DUMBFILE; // DUMB stream type
 }
 
 // AssetPath combines asset library and item names
@@ -78,8 +77,6 @@ struct AGS_PACKFILE_OBJ {
 // This function is supposed to be used only when you have to create Allegro
 // object, passing PACKFILE stream to constructor.
 PACKFILE *PackfileFromAsset(const AssetPath &path, size_t &asset_size);
-// Creates DUMBFILE stream from AGS asset. Used for creating DUMB objects
-DUMBFILE *DUMBfileFromAsset(const AssetPath &path, size_t &asset_size);
 bool DoesAssetExistInLib(const AssetPath &assetname);
 
 } // namespace AGS3
diff --git a/engines/ags/engine/ac/file.cpp b/engines/ags/engine/ac/file.cpp
index 47f392fb6b..a63329e06c 100644
--- a/engines/ags/engine/ac/file.cpp
+++ b/engines/ags/engine/ac/file.cpp
@@ -20,7 +20,6 @@
  *
  */
 
-#include "ags/lib/audio/aldumb.h"
 #include "ags/engine/ac/asset_helper.h"
 #include "ags/shared/ac/audiocliptype.h"
 #include "ags/engine/ac/file.h"
@@ -462,13 +461,6 @@ PACKFILE *PackfileFromAsset(const AssetPath &path, size_t &asset_size) {
 	return nullptr;
 }
 
-DUMBFILE *DUMBfileFromAsset(const AssetPath &path, size_t &asset_size) {
-	PACKFILE *pf = PackfileFromAsset(path, asset_size);
-	if (pf)
-		return dumbfile_open_packfile(pf);
-	return nullptr;
-}
-
 bool DoesAssetExistInLib(const AssetPath &assetname) {
 	bool needsetback = false;
 	// Change to the different library, if required
diff --git a/engines/ags/lib/audio/aldumb.cpp b/engines/ags/lib/audio/aldumb.cpp
deleted file mode 100644
index b1eeba1b14..0000000000
--- a/engines/ags/lib/audio/aldumb.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/lib/audio/aldumb.h"
-
-namespace AGS3 {
-
-void dumb_register_packfiles() {
-}
-
-DUMBFILE *dumbfile_open_packfile(PACKFILE *p) {
-	warning("TODO: dumbfile_open_packfile");
-	return nullptr;
-}
-
-DUMBFILE *dumbfile_from_packfile(PACKFILE *p) {
-	warning("TODO: dumbfile_from_packfile");
-	return nullptr;
-}
-
-void dumb_register_dat_duh(long type) {
-	warning("TODO: dumb_register_dat_duh");
-}
-
-void dumb_register_dat_it(long type) {
-	warning("TODO: dumb_register_dat_it");
-}
-
-void dumb_register_dat_xm(long type) {
-	warning("TODO: dumb_register_dat_xm");
-}
-
-void dumb_register_dat_s3m(long type) {
-	warning("TODO: dumb_register_dat_s3m");
-}
-
-void dumb_register_dat_mod(long type) {
-	warning("TODO: dumb_register_dat_mod");
-}
-
-void dumb_register_dat_it_quick(long type) {
-	warning("TODO: dumb_register_dat_it_quick");
-}
-
-void dumb_register_dat_xm_quick(long type) {
-	warning("TODO: dumb_register_dat_xm_quick");
-}
-
-void dumb_register_dat_s3m_quick(long type) {
-	warning("TODO: dumb_register_dat_s3m_quick");
-}
-
-void dumb_register_dat_mod_quick(long type) {
-	warning("TODO: dumb_register_dat_mod_quick");
-}
-
-/* DUH Playing Functions */
-
-AL_DUH_PLAYER *al_start_duh(DUH *duh, int n_channels, long pos, float volume, long bufsize, int freq) {
-	warning("TODO: al_start_duh");
-	return nullptr;
-}
-
-void al_stop_duh(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_stop_duh");
-}
-
-void al_pause_duh(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_pause_duh");
-}
-
-void al_resume_duh(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_resume_duh");
-}
-
-void al_duh_set_priority(AL_DUH_PLAYER *dp, int priority) {
-	warning("TODO: al_duh_set_priority");
-}
-
-void al_duh_set_volume(AL_DUH_PLAYER *dp, float volume) {
-	warning("TODO: al_duh_set_volume");
-}
-
-float al_duh_get_volume(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_duh_get_volume");
-	return 0;
-}
-
-int al_poll_duh(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_poll_duh");
-	return 0;
-}
-
-long al_duh_get_position(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_duh_get_position");
-	return 0;
-}
-
-AL_DUH_PLAYER *al_duh_encapsulate_sigrenderer(DUH_SIGRENDERER *sigrenderer, float volume, long bufsize, int freq) {
-	warning("TODO: al_duh_encapsulate_sigrenderer");
-	return nullptr;
-}
-
-DUH_SIGRENDERER *al_duh_get_sigrenderer(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_duh_get_sigrenderer");
-	return nullptr;
-}
-
-DUH_SIGRENDERER *al_duh_decompose_to_sigrenderer(AL_DUH_PLAYER *dp) {
-	warning("TODO: al_duh_decompose_to_sigrenderer");
-	return nullptr;
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/audio/aldumb.h b/engines/ags/lib/audio/aldumb.h
deleted file mode 100644
index 32270f78e0..0000000000
--- a/engines/ags/lib/audio/aldumb.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * aldumb.h - The user header file for DUMB with      / / \  \
- *            Allegro.                               | <  /   \_
- *                                                   |  \/ /\   /
- * Include this file if you wish to use DUMB          \_  /  > /
- * with Allegro. It will include dumb.h for you,        | \ / /
- * and provide extra functionality such as audio        |  ' /
- * stream and datafile integration.                      \__/
- */
-
-#ifndef AGS_LIB_ALDUMB_H
-#define AGS_LIB_ALDUMB_H
-
-#include "ags/lib/allegro.h"
-#include "ags/lib/dumb-0.9.2/dumb.h"
-
-namespace AGS3 {
-
-/* Packfile Support */
-
-void dumb_register_packfiles(void);
-
-DUMBFILE *dumbfile_open_packfile(PACKFILE *p);
-DUMBFILE *dumbfile_from_packfile(PACKFILE *p);
-
-
-/* Datafile Registration Functions */
-
-#define DUMB_DAT_DUH DAT_ID('D','U','H',' ')
-#define DUMB_DAT_IT  DAT_ID('I','T',' ',' ')
-#define DUMB_DAT_XM  DAT_ID('X','M',' ',' ')
-#define DUMB_DAT_S3M DAT_ID('S','3','M',' ')
-#define DUMB_DAT_MOD DAT_ID('M','O','D',' ')
-
-void dumb_register_dat_duh(long type);
-void dumb_register_dat_it(long type);
-void dumb_register_dat_xm(long type);
-void dumb_register_dat_s3m(long type);
-void dumb_register_dat_mod(long type);
-void dumb_register_dat_it_quick(long type);
-void dumb_register_dat_xm_quick(long type);
-void dumb_register_dat_s3m_quick(long type);
-void dumb_register_dat_mod_quick(long type);
-
-
-/* DUH Playing Functions */
-
-typedef struct AL_DUH_PLAYER AL_DUH_PLAYER;
-
-AL_DUH_PLAYER *al_start_duh(DUH *duh, int n_channels, long pos, float volume, long bufsize, int freq);
-void al_stop_duh(AL_DUH_PLAYER *dp);
-void al_pause_duh(AL_DUH_PLAYER *dp);
-void al_resume_duh(AL_DUH_PLAYER *dp);
-void al_duh_set_priority(AL_DUH_PLAYER *dp, int priority);
-void al_duh_set_volume(AL_DUH_PLAYER *dp, float volume);
-float al_duh_get_volume(AL_DUH_PLAYER *dp);
-int al_poll_duh(AL_DUH_PLAYER *dp);
-long al_duh_get_position(AL_DUH_PLAYER *dp);
-
-AL_DUH_PLAYER *al_duh_encapsulate_sigrenderer(DUH_SIGRENDERER *sigrenderer, float volume, long bufsize, int freq);
-DUH_SIGRENDERER *al_duh_get_sigrenderer(AL_DUH_PLAYER *dp);
-
-/* IMPORTANT: This function will return NULL if the music has ended. */
-DUH_SIGRENDERER *al_duh_decompose_to_sigrenderer(AL_DUH_PLAYER *dp);
-
-#ifdef DUMB_DECLARE_DEPRECATED
-
-	AL_DUH_PLAYER *al_duh_encapsulate_renderer(DUH_SIGRENDERER *dr, float volume, long bufsize, int freq) DUMB_DEPRECATED;
-	DUH_SIGRENDERER *al_duh_get_renderer(AL_DUH_PLAYER *dp) DUMB_DEPRECATED;
-	DUH_SIGRENDERER *al_duh_decompose_to_renderer(AL_DUH_PLAYER *dp) DUMB_DEPRECATED;
-	/* Replace 'renderer' with 'sigrenderer' in each case where you called one of
-	 * these functions.
-	 */
-
-#endif
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/dumb-0.9.2/dumb.cpp b/engines/ags/lib/dumb-0.9.2/dumb.cpp
deleted file mode 100644
index 215fb76828..0000000000
--- a/engines/ags/lib/dumb-0.9.2/dumb.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-#include "common/textconsole.h"
-
-namespace AGS3 {
-
-void dumb_exit() {
-	// No implementation
-}
-
-DUH *dumb_load_it(const char *filename) {
-	warning("TODO: dumb_load_it");
-	return nullptr;
-}
-
-DUH *dumb_load_xm(const char *filename) {
-	warning("TODO: dumb_load_xm");
-	return nullptr;
-}
-
-DUH *dumb_load_s3m(const char *filename) {
-	warning("TODO: dumb_load_s3m");
-	return nullptr;
-}
-
-DUH *dumb_load_mod(const char *filename) {
-	warning("TODO: dumb_load_mod");
-	return nullptr;
-}
-
-DUH *dumb_read_it(DUMBFILE *f) {
-	warning("TODO: dumb_read_it");
-	return nullptr;
-}
-DUH *dumb_read_xm(DUMBFILE *f) {
-	warning("TODO: dumb_read_xm");
-	return nullptr;
-}
-
-DUH *dumb_read_s3m(DUMBFILE *f) {
-	warning("TODO: dumb_read_s3m");
-	return nullptr;
-}
-
-DUH *dumb_read_mod(DUMBFILE *f) {
-	warning("TODO: dumb_read_mod");
-	return nullptr;
-}
-
-int dumb_it_sd_get_n_orders(DUMB_IT_SIGDATA *sd) {
-	warning("TODO: dumb_it_sd_get_n_orders");
-	return 0;
-}
-
-int dumb_it_sd_get_initial_global_volume(DUMB_IT_SIGDATA *sd) {
-	warning("TODO: dumb_it_sd_get_initial_global_volume");
-	return 0;
-}
-
-void dumb_it_sd_set_initial_global_volume(DUMB_IT_SIGDATA *sd, int gv) {
-	warning("TODO: dumb_it_sd_set_initial_global_volume");
-}
-
-int dumb_it_sd_get_mixing_volume(DUMB_IT_SIGDATA *sd) {
-	warning("TODO: dumb_it_sd_get_mixing_volume");
-	return 0;
-}
-
-void dumb_it_sd_set_mixing_volume(DUMB_IT_SIGDATA *sd, int mv) {
-	warning("TODO: dumb_it_sd_set_mixing_volume");
-}
-
-int dumb_it_sd_get_initial_speed(DUMB_IT_SIGDATA *sd) {
-	warning("TODO: dumb_it_sd_get_initial_speed");
-	return 0;
-}
-
-void dumb_it_sd_set_initial_speed(DUMB_IT_SIGDATA *sd, int speed) {
-	warning("TODO: dumb_it_sd_set_initial_speed");
-}
-
-int dumb_it_sd_get_initial_tempo(DUMB_IT_SIGDATA *sd) {
-	warning("TODO: dumb_it_sd_get_initial_tempo");
-	return 0;
-}
-
-void dumb_it_sd_set_initial_tempo(DUMB_IT_SIGDATA *sd, int tempo) {
-	warning("TODO: dumb_it_sd_set_initial_tempo");
-}
-
-int dumb_it_sd_get_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel) {
-	warning("TODO: dumb_it_sd_get_initial_channel_volume");
-	return 0;
-}
-
-void dumb_it_sd_set_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel, int volume) {
-	warning("TODO: dumb_it_sd_set_initial_channel_volume");
-}
-
-int dumb_it_sr_get_current_order(DUMB_IT_SIGRENDERER *sr) {
-	warning("TODO: dumb_it_sr_get_current_order");
-	return 0;
-}
-
-int dumb_it_sr_get_current_row(DUMB_IT_SIGRENDERER *sr) {
-	warning("TODO: dumb_it_sr_get_current_row");
-	return 0;
-}
-
-int dumb_it_sr_get_global_volume(DUMB_IT_SIGRENDERER *sr) {
-	warning("TODO: dumb_it_sr_get_global_volume");
-	return 0;
-}
-
-void dumb_it_sr_set_global_volume(DUMB_IT_SIGRENDERER *sr, int gv) {
-	warning("TODO: dumb_it_sr_set_global_volume");
-}
-
-int dumb_it_sr_get_tempo(DUMB_IT_SIGRENDERER *sr) {
-	warning("TODO: dumb_it_sr_get_tempo");
-	return 0;
-}
-
-void dumb_it_sr_set_tempo(DUMB_IT_SIGRENDERER *sr, int tempo) {
-	warning("TODO: dumb_it_sr_set_tempo");
-}
-
-int dumb_it_sr_get_speed(DUMB_IT_SIGRENDERER *sr) {
-	warning("TODO: dumb_it_sr_get_speed");
-	return 0;
-}
-
-void dumb_it_sr_set_speed(DUMB_IT_SIGRENDERER *sr, int speed) {
-	warning("TODO: dumb_it_sr_set_speed");
-}
-
-void unload_duh(DUH *duh) {
-	warning("TODO: unload_duh");
-}
-
-DUH *load_duh(const char *filename) {
-	warning("TODO: load_duh");
-	return nullptr;
-}
-
-DUH *read_duh(DUMBFILE *f) {
-	warning("TODO: load_duh");
-	return nullptr;
-}
-
-long duh_get_length(DUH *duh) {
-	warning("TODO: duh_get_length");
-	return 0;
-}
-
-void duh_end_sigrenderer(DUH_SIGRENDERER *sigrenderer) {
-	warning("TODO: duh_end_sigrenderer");
-}
-
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/dumb.h b/engines/ags/lib/dumb-0.9.2/dumb.h
deleted file mode 100644
index 2099c27b48..0000000000
--- a/engines/ags/lib/dumb-0.9.2/dumb.h
+++ /dev/null
@@ -1,581 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * dumb.h - The user header file for DUMB.            / / \  \
- *                                                   | <  /   \_
- * Include this file in any of your files in         |  \/ /\   /
- * which you wish to use the DUMB functions           \_  /  > /
- * and variables.                                       | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#ifndef AGS_LIB_DUMB_DUMBFILE_H
-#define AGS_LIB_DUMB_DUMBFILE_H
-
-#include "common/stream.h"
-
-namespace AGS3 {
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define DUMB_MAJOR_VERSION    0
-#define DUMB_MINOR_VERSION    9
-#define DUMB_REVISION_VERSION 2
-
-#define DUMB_VERSION (DUMB_MAJOR_VERSION*10000 + DUMB_MINOR_VERSION*100 + DUMB_REVISION_VERSION)
-
-#define DUMB_VERSION_STR "0.9.2"
-
-#define DUMB_NAME "DUMB v" DUMB_VERSION_STR
-
-#define DUMB_YEAR  2003
-#define DUMB_MONTH 4
-#define DUMB_DAY   2
-
-#define DUMB_YEAR_STR2  "03"
-#define DUMB_YEAR_STR4  "2003"
-#define DUMB_MONTH_STR1 "4"
-#define DUMB_DAY_STR1   "2"
-
-#if DUMB_MONTH < 10
-#define DUMB_MONTH_STR2 "0" DUMB_MONTH_STR1
-#else
-#define DUMB_MONTH_STR2 DUMB_MONTH_STR1
-#endif
-
-#if DUMB_DAY < 10
-#define DUMB_DAY_STR2 "0" DUMB_DAY_STR1
-#else
-#define DUMB_DAY_STR2 DUMB_DAY_STR1
-#endif
-
-
-	/* WARNING: The month and day were inadvertently swapped in the v0.8 release.
-	 *          Please do not compare this constant against any date in 2002. In
-	 *          any case, DUMB_VERSION is probably more useful for this purpose.
-	 */
-#define DUMB_DATE (DUMB_YEAR*10000 + DUMB_MONTH*100 + DUMB_DAY)
-
-#define DUMB_DATE_STR DUMB_DAY_STR1 "." DUMB_MONTH_STR1 "." DUMB_YEAR_STR4
-
-
-#undef MIN
-#undef MAX
-#undef MID
-
-#define MIN(x,y)   (((x) < (y)) ? (x) : (y))
-#define MAX(x,y)   (((x) > (y)) ? (x) : (y))
-#define MID(x,y,z) MAX((x), MIN((y), (z)))
-
-#undef ABS
-#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
-
-
-#ifdef DEBUGMODE
-
-#ifndef ASSERT
-#include <assert.h>
-#define ASSERT(n) assert(n)
-#endif
-#ifndef TRACE
-	 // it would be nice if this did actually trace ...
-#define TRACE 1 ? (void)0 : (void)printf
-#endif
-
-#else
-
-#ifndef ASSERT
-#define ASSERT(n)
-#endif
-#ifndef TRACE
-#define TRACE 1 ? (void)0 : (void)printf
-#endif
-
-#endif
-
-
-#define DUMB_ID(a,b,c,d) (((unsigned int)(a) << 24) | \
-                          ((unsigned int)(b) << 16) | \
-                          ((unsigned int)(c) <<  8) | \
-                          ((unsigned int)(d)      ))
-
-
-
-#ifndef LONG_LONG
-#ifdef __GNUC__
-#define LONG_LONG long long
-#elif defined _MSC_VER
-#define LONG_LONG __int64
-#else
-#error 64-bit integer type unknown
-#endif
-#endif
-
-#if __GNUC__ * 100 + __GNUC_MINOR__ >= 301 /* GCC 3.1+ */
-#ifndef DUMB_DECLARE_DEPRECATED
-#define DUMB_DECLARE_DEPRECATED
-#endif
-#define DUMB_DEPRECATED __attribute__((__deprecated__))
-#else
-#define DUMB_DEPRECATED
-#endif
-
-
-	 /* Basic Sample Type. Normal range is -0x800000 to 0x7FFFFF. */
-
-	typedef int sample_t;
-
-
-	/* Library Clean-up Management */
-
-	int dumb_atexit(void (*proc)(void));
-
-	void dumb_exit(void);
-
-
-	/* File Input Functions */
-
-	typedef struct DUMBFILE_SYSTEM {
-		void *(*open)(const char *filename);
-		int (*skip)(void *f, long n);
-		int (*getc)(void *f);
-		long (*getnc)(char *ptr, long n, void *f);
-		void (*close)(void *f);
-	}
-	DUMBFILE_SYSTEM;
-
-	typedef struct DUMBFILE DUMBFILE;
-
-	void register_dumbfile_system(DUMBFILE_SYSTEM *dfs);
-
-	DUMBFILE *dumbfile_open(const char *filename);
-	DUMBFILE *dumbfile_open_ex(void *file, DUMBFILE_SYSTEM *dfs);
-
-	long dumbfile_pos(DUMBFILE *f);
-	int dumbfile_skip(DUMBFILE *f, long n);
-
-	int dumbfile_getc(DUMBFILE *f);
-
-	int dumbfile_igetw(DUMBFILE *f);
-	int dumbfile_mgetw(DUMBFILE *f);
-
-	long dumbfile_igetl(DUMBFILE *f);
-	long dumbfile_mgetl(DUMBFILE *f);
-
-	unsigned long dumbfile_cgetul(DUMBFILE *f);
-	signed long dumbfile_cgetsl(DUMBFILE *f);
-
-	long dumbfile_getnc(char *ptr, long n, DUMBFILE *f);
-
-	int dumbfile_error(DUMBFILE *f);
-	int dumbfile_close(DUMBFILE *f);
-
-
-	/* stdio File Input Module */
-
-	void dumb_register_stdfiles(void);
-
-	DUMBFILE *dumbfile_open_stdfile(Common::ReadStream *p);
-
-
-	/* Memory File Input Module */
-
-	DUMBFILE *dumbfile_open_memory(const char *data, long size);
-
-
-	/* DUH Management */
-
-	typedef struct DUH DUH;
-
-#define DUH_SIGNATURE DUMB_ID('D','U','H','!')
-
-	void unload_duh(DUH *duh);
-
-	DUH *load_duh(const char *filename);
-	DUH *read_duh(DUMBFILE *f);
-
-	long duh_get_length(DUH *duh);
-
-
-	/* Signal Rendering Functions */
-
-	typedef struct DUH_SIGRENDERER DUH_SIGRENDERER;
-
-	DUH_SIGRENDERER *duh_start_sigrenderer(DUH *duh, int sig, int n_channels, long pos);
-
-#ifdef DUMB_DECLARE_DEPRECATED
-	typedef void (*DUH_SIGRENDERER_CALLBACK)(void *data, sample_t **samples, int n_channels, long length);
-	/* This is deprecated, but is not marked as such because GCC tends to
-	 * complain spuriously when the typedef is used later. See comments below.
-	 */
-
-	void duh_sigrenderer_set_callback(
-		DUH_SIGRENDERER *sigrenderer,
-		DUH_SIGRENDERER_CALLBACK callback, void *data
-	) DUMB_DEPRECATED;
-	/* The 'callback' argument's type has changed for const-correctness. See the
-	 * DUH_SIGRENDERER_CALLBACK definition just above. Also note that the samples
-	 * in the buffer are now 256 times as large; the normal range is -0x800000 to
-	 * 0x7FFFFF. The function has been renamed partly because its functionality
-	 * has changed slightly and partly so that its name is more meaningful. The
-	 * new one is duh_sigrenderer_set_analyser_callback(), and the typedef for
-	 * the function pointer has also changed, from DUH_SIGRENDERER_CALLBACK to
-	 * DUH_SIGRENDERER_ANALYSER_CALLBACK. (If you wanted to use this callback to
-	 * apply a DSP effect, don't worry; there is a better way of doing this. It
-	 * is undocumented, so contact me and I shall try to help. Contact details
-	 * are in readme.txt.)
-	 */
-#endif
-
-	typedef void (*DUH_SIGRENDERER_ANALYSER_CALLBACK)(void *data, const sample_t *const *samples, int n_channels, long length);
-
-	void duh_sigrenderer_set_analyser_callback(
-		DUH_SIGRENDERER *sigrenderer,
-		DUH_SIGRENDERER_ANALYSER_CALLBACK callback, void *data
-	);
-
-	int duh_sigrenderer_get_n_channels(DUH_SIGRENDERER *sigrenderer);
-	long duh_sigrenderer_get_position(DUH_SIGRENDERER *sigrenderer);
-
-	void duh_sigrenderer_set_sigparam(DUH_SIGRENDERER *sigrenderer, unsigned char id, long value);
-
-	long duh_sigrenderer_get_samples(
-		DUH_SIGRENDERER *sigrenderer,
-		float volume, float delta,
-		long size, sample_t **samples
-	);
-
-	void duh_sigrenderer_get_current_sample(DUH_SIGRENDERER *sigrenderer, float volume, sample_t *samples);
-
-	void duh_end_sigrenderer(DUH_SIGRENDERER *sigrenderer);
-
-
-	/* DUH Rendering Functions */
-
-	long duh_render(
-		DUH_SIGRENDERER *sigrenderer,
-		int bits, int unsign,
-		float volume, float delta,
-		long size, void *sptr
-	);
-
-#ifdef DUMB_DECLARE_DEPRECATED
-
-	long duh_render_signal(
-		DUH_SIGRENDERER *sigrenderer,
-		float volume, float delta,
-		long size, sample_t **samples
-	) DUMB_DEPRECATED;
-	/* Please use duh_sigrenderer_get_samples(). Arguments and functionality are
-	 * identical.
-	 */
-
-	typedef DUH_SIGRENDERER DUH_RENDERER DUMB_DEPRECATED;
-	/* Please use DUH_SIGRENDERER instead of DUH_RENDERER. */
-
-	DUH_SIGRENDERER *duh_start_renderer(DUH *duh, int n_channels, long pos) DUMB_DEPRECATED;
-	/* Please use duh_start_sigrenderer() instead. Pass 0 for 'sig'. */
-
-	int duh_renderer_get_n_channels(DUH_SIGRENDERER *dr) DUMB_DEPRECATED;
-	long duh_renderer_get_position(DUH_SIGRENDERER *dr) DUMB_DEPRECATED;
-	/* Please use the duh_sigrenderer_*() equivalents of these two functions. */
-
-	void duh_end_renderer(DUH_SIGRENDERER *dr) DUMB_DEPRECATED;
-	/* Please use duh_end_sigrenderer() instead. */
-
-	DUH_SIGRENDERER *duh_renderer_encapsulate_sigrenderer(DUH_SIGRENDERER *sigrenderer) DUMB_DEPRECATED;
-	DUH_SIGRENDERER *duh_renderer_get_sigrenderer(DUH_SIGRENDERER *dr) DUMB_DEPRECATED;
-	DUH_SIGRENDERER *duh_renderer_decompose_to_sigrenderer(DUH_SIGRENDERER *dr) DUMB_DEPRECATED;
-	/* These functions have become no-ops that just return the parameter.
-	 * So, for instance, replace
-	 *   duh_renderer_encapsulate_sigrenderer(my_sigrenderer)
-	 * with
-	 *   my_sigrenderer
-	 */
-
-#endif
-
-
-	 /* Impulse Tracker Support */
-
-	extern int dumb_it_max_to_mix;
-
-	typedef struct DUMB_IT_SIGDATA DUMB_IT_SIGDATA;
-	typedef struct DUMB_IT_SIGRENDERER DUMB_IT_SIGRENDERER;
-
-	DUMB_IT_SIGDATA *duh_get_it_sigdata(DUH *duh);
-	DUH_SIGRENDERER *duh_encapsulate_it_sigrenderer(DUMB_IT_SIGRENDERER *it_sigrenderer, int n_channels, long pos);
-	DUMB_IT_SIGRENDERER *duh_get_it_sigrenderer(DUH_SIGRENDERER *sigrenderer);
-
-	DUH_SIGRENDERER *dumb_it_start_at_order(DUH *duh, int n_channels, int startorder);
-
-	void dumb_it_set_loop_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
-	void dumb_it_set_xm_speed_zero_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data);
-	void dumb_it_set_midi_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data, int channel, unsigned char byte), void *data);
-
-	int dumb_it_callback_terminate(void *data);
-	int dumb_it_callback_midi_block(void *data, int channel, unsigned char byte);
-
-	DUH *dumb_load_it(const char *filename);
-	DUH *dumb_load_xm(const char *filename);
-	DUH *dumb_load_s3m(const char *filename);
-	DUH *dumb_load_mod(const char *filename);
-
-	DUH *dumb_read_it(DUMBFILE *f);
-	DUH *dumb_read_xm(DUMBFILE *f);
-	DUH *dumb_read_s3m(DUMBFILE *f);
-	DUH *dumb_read_mod(DUMBFILE *f);
-
-	int dumb_it_sd_get_n_orders(DUMB_IT_SIGDATA *sd);
-
-	int dumb_it_sd_get_initial_global_volume(DUMB_IT_SIGDATA *sd);
-	void dumb_it_sd_set_initial_global_volume(DUMB_IT_SIGDATA *sd, int gv);
-
-	int dumb_it_sd_get_mixing_volume(DUMB_IT_SIGDATA *sd);
-	void dumb_it_sd_set_mixing_volume(DUMB_IT_SIGDATA *sd, int mv);
-
-	int dumb_it_sd_get_initial_speed(DUMB_IT_SIGDATA *sd);
-	void dumb_it_sd_set_initial_speed(DUMB_IT_SIGDATA *sd, int speed);
-
-	int dumb_it_sd_get_initial_tempo(DUMB_IT_SIGDATA *sd);
-	void dumb_it_sd_set_initial_tempo(DUMB_IT_SIGDATA *sd, int tempo);
-
-	int dumb_it_sd_get_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel);
-	void dumb_it_sd_set_initial_channel_volume(DUMB_IT_SIGDATA *sd, int channel, int volume);
-
-	int dumb_it_sr_get_current_order(DUMB_IT_SIGRENDERER *sr);
-	int dumb_it_sr_get_current_row(DUMB_IT_SIGRENDERER *sr);
-
-	int dumb_it_sr_get_global_volume(DUMB_IT_SIGRENDERER *sr);
-	void dumb_it_sr_set_global_volume(DUMB_IT_SIGRENDERER *sr, int gv);
-
-	int dumb_it_sr_get_tempo(DUMB_IT_SIGRENDERER *sr);
-	void dumb_it_sr_set_tempo(DUMB_IT_SIGRENDERER *sr, int tempo);
-
-	int dumb_it_sr_get_speed(DUMB_IT_SIGRENDERER *sr);
-	void dumb_it_sr_set_speed(DUMB_IT_SIGRENDERER *sr, int speed);
-
-#define DUMB_IT_N_CHANNELS 64
-#define DUMB_IT_N_NNA_CHANNELS 192
-#define DUMB_IT_TOTAL_CHANNELS (DUMB_IT_N_CHANNELS + DUMB_IT_N_NNA_CHANNELS)
-
-	/* Channels passed to any of these functions are 0-based */
-	int dumb_it_sr_get_channel_volume(DUMB_IT_SIGRENDERER *sr, int channel);
-	void dumb_it_sr_set_channel_volume(DUMB_IT_SIGRENDERER *sr, int channel, int volume);
-
-	typedef struct DUMB_IT_CHANNEL_STATE DUMB_IT_CHANNEL_STATE;
-
-	struct DUMB_IT_CHANNEL_STATE {
-		int channel; /* 0-based; meaningful for NNA channels */
-		int sample; /* 1-based; 0 if nothing playing, then other fields undef */
-		int freq; /* in Hz */
-		float volume; /* 1.0 maximum; affected by ALL factors, inc. mixing vol */
-		unsigned char pan; /* 0-64, 100 for surround */
-		signed char subpan; /* use (pan + subpan/256.0f) or ((pan<<8)+subpan) */
-		unsigned char filter_cutoff;    /* 0-127    cutoff=127 AND resonance=0 */
-		unsigned char filter_subcutoff; /* 0-255      -> no filters (subcutoff */
-		unsigned char filter_resonance; /* 0-127        always 0 in this case) */
-		/* subcutoff only changes from zero if filter envelopes are in use. The
-		 * calculation (filter_cutoff + filter_subcutoff/256.0f) gives a more
-		 * accurate filter cutoff measurement as a float. It would often be more
-		 * useful to use a scaled int such as ((cutoff<<8) + subcutoff).
-		 */
-	};
-
-	/* Values of 64 or more will access NNA channels here. */
-	void dumb_it_sr_get_channel_state(DUMB_IT_SIGRENDERER *sr, int channel, DUMB_IT_CHANNEL_STATE *state);
-
-
-	/* Signal Design Helper Values */
-
-	/* Use pow(DUMB_SEMITONE_BASE, n) to get the 'delta' value to transpose up by
-	 * n semitones. To transpose down, use negative n.
-	 */
-#define DUMB_SEMITONE_BASE 1.059463094359295309843105314939748495817
-
-	 /* Use pow(DUMB_QUARTERTONE_BASE, n) to get the 'delta' value to transpose up
-	  * by n quartertones. To transpose down, use negative n.
-	  */
-#define DUMB_QUARTERTONE_BASE 1.029302236643492074463779317738953977823
-
-	  /* Use pow(DUMB_PITCH_BASE, n) to get the 'delta' value to transpose up by n
-	   * units. In this case, 256 units represent one semitone; 3072 units
-	   * represent one octave. These units are used by the sequence signal (SEQU).
-	   */
-#define DUMB_PITCH_BASE 1.000225659305069791926712241547647863626
-
-
-	   /* Signal Design Function Types */
-
-	typedef void sigdata_t;
-	typedef void sigrenderer_t;
-
-	typedef sigdata_t *(*DUH_LOAD_SIGDATA)(DUH *duh, DUMBFILE *file);
-
-	typedef sigrenderer_t *(*DUH_START_SIGRENDERER)(
-		DUH *duh,
-		sigdata_t *sigdata,
-		int n_channels,
-		long pos
-		);
-
-	typedef void (*DUH_SIGRENDERER_SET_SIGPARAM)(
-		sigrenderer_t *sigrenderer,
-		unsigned char id, long value
-		);
-
-	typedef long (*DUH_SIGRENDERER_GET_SAMPLES)(
-		sigrenderer_t *sigrenderer,
-		float volume, float delta,
-		long size, sample_t **samples
-		);
-
-	typedef void (*DUH_SIGRENDERER_GET_CURRENT_SAMPLE)(
-		sigrenderer_t *sigrenderer,
-		float volume,
-		sample_t *samples
-		);
-
-	typedef void (*DUH_END_SIGRENDERER)(sigrenderer_t *sigrenderer);
-
-	typedef void (*DUH_UNLOAD_SIGDATA)(sigdata_t *sigdata);
-
-
-	/* Signal Design Function Registration */
-
-	typedef struct DUH_SIGTYPE_DESC {
-		long type;
-		DUH_LOAD_SIGDATA                   load_sigdata;
-		DUH_START_SIGRENDERER              start_sigrenderer;
-		DUH_SIGRENDERER_SET_SIGPARAM       sigrenderer_set_sigparam;
-		DUH_SIGRENDERER_GET_SAMPLES        sigrenderer_get_samples;
-		DUH_SIGRENDERER_GET_CURRENT_SAMPLE sigrenderer_get_current_sample;
-		DUH_END_SIGRENDERER                end_sigrenderer;
-		DUH_UNLOAD_SIGDATA                 unload_sigdata;
-	}
-	DUH_SIGTYPE_DESC;
-
-	void dumb_register_sigtype(DUH_SIGTYPE_DESC *desc);
-
-
-	// Decide where to put these functions; new heading?
-
-	sigdata_t *duh_get_raw_sigdata(DUH *duh, int sig, long type);
-
-	DUH_SIGRENDERER *duh_encapsulate_raw_sigrenderer(sigrenderer_t *vsigrenderer, DUH_SIGTYPE_DESC *desc, int n_channels, long pos);
-	sigrenderer_t *duh_get_raw_sigrenderer(DUH_SIGRENDERER *sigrenderer, long type);
-
-
-	/* Sample Buffer Allocation Helpers */
-
-	sample_t **create_sample_buffer(int n_channels, long length);
-	void destroy_sample_buffer(sample_t **samples);
-
-
-	/* Silencing Helper */
-
-	void dumb_silence(sample_t *samples, long length);
-
-
-	/* Click Removal Helpers */
-
-	typedef struct DUMB_CLICK_REMOVER DUMB_CLICK_REMOVER;
-
-	DUMB_CLICK_REMOVER *dumb_create_click_remover(void);
-	void dumb_record_click(DUMB_CLICK_REMOVER *cr, long pos, sample_t step);
-	void dumb_remove_clicks(DUMB_CLICK_REMOVER *cr, sample_t *samples, long length, float halflife);
-	sample_t dumb_click_remover_get_offset(DUMB_CLICK_REMOVER *cr);
-	void dumb_destroy_click_remover(DUMB_CLICK_REMOVER *cr);
-
-	DUMB_CLICK_REMOVER **dumb_create_click_remover_array(int n);
-	void dumb_record_click_array(int n, DUMB_CLICK_REMOVER **cr, long pos, sample_t *step);
-	void dumb_record_click_negative_array(int n, DUMB_CLICK_REMOVER **cr, long pos, sample_t *step);
-	void dumb_remove_clicks_array(int n, DUMB_CLICK_REMOVER **cr, sample_t **samples, long length, float halflife);
-	void dumb_click_remover_get_offset_array(int n, DUMB_CLICK_REMOVER **cr, sample_t *offset);
-	void dumb_destroy_click_remover_array(int n, DUMB_CLICK_REMOVER **cr);
-
-
-	/* Resampling Helpers */
-
-#define DUMB_RQ_ALIASING 0
-#define DUMB_RQ_LINEAR   1
-#define DUMB_RQ_CUBIC    2
-#define DUMB_RQ_N_LEVELS 3
-	extern int dumb_resampling_quality;
-
-	typedef struct DUMB_RESAMPLER DUMB_RESAMPLER;
-
-	typedef void (*DUMB_RESAMPLE_PICKUP)(DUMB_RESAMPLER *resampler, void *data);
-
-	struct DUMB_RESAMPLER {
-		sample_t *src;
-		long pos;
-		int subpos;
-		long start, end;
-		int dir;
-		DUMB_RESAMPLE_PICKUP pickup;
-		void *pickup_data;
-		int min_quality;
-		int max_quality;
-		/* Everything below this point is internal: do not use. */
-		sample_t x[3];
-		int overshot;
-	};
-
-	void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, long pos, long start, long end);
-	DUMB_RESAMPLER *dumb_start_resampler(sample_t *src, long pos, long start, long end);
-	long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta);
-	sample_t dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, float volume);
-	void dumb_end_resampler(DUMB_RESAMPLER *resampler);
-
-
-	/* DUH Construction */
-
-	DUH *make_duh(
-		long length,
-		int n_signals,
-		DUH_SIGTYPE_DESC *desc[],
-		sigdata_t *sigdata[]
-	);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/dumb-0.9.2/dumbfile.cpp b/engines/ags/lib/dumb-0.9.2/dumbfile.cpp
deleted file mode 100644
index 496d26935d..0000000000
--- a/engines/ags/lib/dumb-0.9.2/dumbfile.cpp
+++ /dev/null
@@ -1,409 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * dumbfile.c - Hookable, strictly sequential         / / \  \
- *              file input functions.                | <  /   \_
- *                                                   |  \/ /\   /
- * By entheh.                                         \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-//include <stdlib.h>
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-
-namespace AGS3 {
-
-static DUMBFILE_SYSTEM *the_dfs = NULL;
-
-
-
-void register_dumbfile_system(DUMBFILE_SYSTEM *dfs) {
-	ASSERT(dfs);
-	ASSERT(dfs->open);
-	ASSERT(dfs->getc);
-	ASSERT(dfs->close);
-	the_dfs = dfs;
-}
-
-
-
-struct DUMBFILE {
-	DUMBFILE_SYSTEM *dfs;
-	void *file;
-	long pos;
-};
-
-
-
-DUMBFILE *dumbfile_open(const char *filename) {
-	DUMBFILE *f;
-
-	ASSERT(the_dfs);
-
-	f = (DUMBFILE *)malloc(sizeof(DUMBFILE));
-
-	if (!f)
-		return NULL;
-
-	f->dfs = the_dfs;
-
-	f->file = (*the_dfs->open)(filename);
-
-	if (!f->file) {
-		free(f);
-		return NULL;
-	}
-
-	f->pos = 0;
-
-	return f;
-}
-
-
-
-DUMBFILE *dumbfile_open_ex(void *file, DUMBFILE_SYSTEM *dfs) {
-	DUMBFILE *f;
-
-	ASSERT(dfs);
-	ASSERT(dfs->getc);
-	ASSERT(file);
-
-	f = (DUMBFILE *)malloc(sizeof(DUMBFILE));
-
-	if (!f) {
-		if (dfs->close)
-			(*dfs->close)(file);
-		return NULL;
-	}
-
-	f->dfs = dfs;
-	f->file = file;
-
-	f->pos = 0;
-
-	return f;
-}
-
-
-
-long dumbfile_pos(DUMBFILE *f) {
-	ASSERT(f);
-
-	return f->pos;
-}
-
-
-
-int dumbfile_skip(DUMBFILE *f, long n) {
-	int rv;
-
-	ASSERT(f);
-	ASSERT(n >= 0);
-
-	if (f->pos < 0)
-		return -1;
-
-	f->pos += n;
-
-	if (f->dfs->skip) {
-		rv = (*f->dfs->skip)(f->file, n);
-		if (rv) {
-			f->pos = -1;
-			return rv;
-		}
-	} else {
-		while (n) {
-			rv = (*f->dfs->getc)(f->file);
-			if (rv < 0) {
-				f->pos = -1;
-				return rv;
-			}
-			n--;
-		}
-	}
-
-	return 0;
-}
-
-
-
-int dumbfile_getc(DUMBFILE *f) {
-	int rv;
-
-	ASSERT(f);
-
-	if (f->pos < 0)
-		return -1;
-
-	rv = (*f->dfs->getc)(f->file);
-
-	if (rv < 0) {
-		f->pos = -1;
-		return rv;
-	}
-
-	f->pos++;
-
-	return rv;
-}
-
-
-
-int dumbfile_igetw(DUMBFILE *f) {
-	int l, h;
-
-	ASSERT(f);
-
-	if (f->pos < 0)
-		return -1;
-
-	l = (*f->dfs->getc)(f->file);
-	if (l < 0) {
-		f->pos = -1;
-		return l;
-	}
-
-	h = (*f->dfs->getc)(f->file);
-	if (h < 0) {
-		f->pos = -1;
-		return h;
-	}
-
-	f->pos += 2;
-
-	return l | (h << 8);
-}
-
-
-
-int dumbfile_mgetw(DUMBFILE *f) {
-	int l, h;
-
-	ASSERT(f);
-
-	if (f->pos < 0)
-		return -1;
-
-	h = (*f->dfs->getc)(f->file);
-	if (h < 0) {
-		f->pos = -1;
-		return h;
-	}
-
-	l = (*f->dfs->getc)(f->file);
-	if (l < 0) {
-		f->pos = -1;
-		return l;
-	}
-
-	f->pos += 2;
-
-	return l | (h << 8);
-}
-
-
-
-long dumbfile_igetl(DUMBFILE *f) {
-	unsigned long rv, b;
-
-	ASSERT(f);
-
-	if (f->pos < 0)
-		return -1;
-
-	rv = (*f->dfs->getc)(f->file);
-	if ((signed long)rv < 0) {
-		f->pos = -1;
-		return rv;
-	}
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b << 8;
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b << 16;
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b << 24;
-
-	f->pos += 4;
-
-	return rv;
-}
-
-
-
-long dumbfile_mgetl(DUMBFILE *f) {
-	unsigned long rv, b;
-
-	ASSERT(f);
-
-	if (f->pos < 0)
-		return -1;
-
-	rv = (*f->dfs->getc)(f->file);
-	if ((signed long)rv < 0) {
-		f->pos = -1;
-		return rv;
-	}
-	rv <<= 24;
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b << 16;
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b << 8;
-
-	b = (*f->dfs->getc)(f->file);
-	if ((signed long)b < 0) {
-		f->pos = -1;
-		return b;
-	}
-	rv |= b;
-
-	f->pos += 4;
-
-	return rv;
-}
-
-
-
-unsigned long dumbfile_cgetul(DUMBFILE *f) {
-	unsigned long rv = 0;
-	int v;
-
-	do {
-		v = dumbfile_getc(f);
-
-		if (v < 0)
-			return v;
-
-		rv <<= 7;
-		rv |= v & 0x7F;
-	} while (v & 0x80);
-
-	return rv;
-}
-
-
-
-signed long dumbfile_cgetsl(DUMBFILE *f) {
-	unsigned long rv = dumbfile_cgetul(f);
-
-	if (f->pos < 0)
-		return rv;
-
-	return (rv >> 1) | (rv << 31);
-}
-
-
-
-long dumbfile_getnc(char *ptr, long n, DUMBFILE *f) {
-	long rv;
-
-	ASSERT(f);
-	ASSERT(n >= 0);
-
-	if (f->pos < 0)
-		return -1;
-
-	if (f->dfs->getnc) {
-		rv = (*f->dfs->getnc)(ptr, n, f->file);
-		if (rv < n) {
-			f->pos = -1;
-			return MAX(rv, 0);
-		}
-	} else {
-		for (rv = 0; rv < n; rv++) {
-			int c = (*f->dfs->getc)(f->file);
-			if (c < 0) {
-				f->pos = -1;
-				return rv;
-			}
-			*ptr++ = c;
-		}
-	}
-
-	f->pos += rv;
-
-	return rv;
-}
-
-
-
-int dumbfile_error(DUMBFILE *f) {
-	ASSERT(f);
-
-	return f->pos < 0;
-}
-
-
-
-int dumbfile_close(DUMBFILE *f) {
-	int rv;
-
-	ASSERT(f);
-
-	rv = f->pos < 0;
-
-	if (f->dfs->close)
-		(*f->dfs->close)(f->file);
-
-	free(f);
-
-	return rv;
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/clickrem.cpp b/engines/ags/lib/dumb-0.9.2/helpers/clickrem.cpp
deleted file mode 100644
index 11bb8814f8..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/clickrem.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * clickrem.c - Click removal helpers.                / / \  \
- *                                                   | <  /   \_
- * By entheh.                                        |  \/ /\   /
- *                                                    \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-
-namespace AGS3 {
-
-typedef struct DUMB_CLICK DUMB_CLICK;
-
-
-struct DUMB_CLICK_REMOVER {
-	DUMB_CLICK *click;
-	int n_clicks;
-
-	int offset;
-};
-
-
-struct DUMB_CLICK {
-	DUMB_CLICK *next;
-	long pos;
-	sample_t step;
-};
-
-
-
-DUMB_CLICK_REMOVER *dumb_create_click_remover(void) {
-	DUMB_CLICK_REMOVER *cr = (DUMB_CLICK_REMOVER *)malloc(sizeof(*cr));
-	if (!cr) return NULL;
-
-	cr->click = NULL;
-	cr->n_clicks = 0;
-
-	cr->offset = 0;
-
-	return cr;
-}
-
-
-
-void dumb_record_click(DUMB_CLICK_REMOVER *cr, long pos, sample_t step) {
-	DUMB_CLICK *click;
-
-	ASSERT(pos >= 0);
-
-	if (!cr || !step) return;
-
-	if (pos == 0) {
-		cr->offset -= step;
-		return;
-	}
-
-	click = (DUMB_CLICK *)malloc(sizeof(*click));
-	if (!click) return;
-
-	click->pos = pos;
-	click->step = step;
-
-	click->next = cr->click;
-	cr->click = click;
-	cr->n_clicks++;
-}
-
-
-
-static DUMB_CLICK *dumb_click_mergesort(DUMB_CLICK *click, int n_clicks) {
-	int i;
-	DUMB_CLICK *c1, *c2, **cp;
-
-	if (n_clicks <= 1) return click;
-
-	/* Split the list into two */
-	c1 = click;
-	cp = &c1;
-	for (i = 0; i < n_clicks; i += 2) cp = &(*cp)->next;
-	c2 = *cp;
-	*cp = NULL;
-
-	/* Sort the sublists */
-	c1 = dumb_click_mergesort(c1, (n_clicks + 1) >> 1);
-	c2 = dumb_click_mergesort(c2, n_clicks >> 1);
-
-	/* Merge them */
-	cp = &click;
-	while (c1 && c2) {
-		if (c1->pos > c2->pos) {
-			*cp = c2;
-			c2 = c2->next;
-		} else {
-			*cp = c1;
-			c1 = c1->next;
-		}
-		cp = &(*cp)->next;
-	}
-	if (c2)
-		*cp = c2;
-	else
-		*cp = c1;
-
-	return click;
-}
-
-
-
-void dumb_remove_clicks(DUMB_CLICK_REMOVER *cr, sample_t *samples, long length, float halflife) {
-	DUMB_CLICK *click;
-	long pos = 0;
-	int offset;
-	int factor;
-
-	if (!cr) return;
-
-	factor = (int)floor(pow(0.5, 1.0 / halflife) * (1U << 31));
-
-	click = dumb_click_mergesort(cr->click, cr->n_clicks);
-	cr->click = NULL;
-	cr->n_clicks = 0;
-
-	while (click) {
-		DUMB_CLICK *next = click->next;
-		ASSERT(click->pos <= length);
-		offset = cr->offset;
-		if (offset < 0) {
-			offset = -offset;
-			while (pos < click->pos) {
-				samples[pos++] -= offset;
-				offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
-			}
-			offset = -offset;
-		} else {
-			while (pos < click->pos) {
-				samples[pos++] += offset;
-				offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
-			}
-		}
-		cr->offset = offset - click->step;
-		free(click);
-		click = next;
-	}
-
-	offset = cr->offset;
-	if (offset < 0) {
-		offset = -offset;
-		while (pos < length) {
-			samples[pos++] -= offset;
-			offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
-		}
-		offset = -offset;
-	} else {
-		while (pos < length) {
-			samples[pos++] += offset;
-			offset = (int)((LONG_LONG)(offset << 1) * factor >> 32);
-		}
-	}
-	cr->offset = offset;
-}
-
-
-
-sample_t dumb_click_remover_get_offset(DUMB_CLICK_REMOVER *cr) {
-	return cr ? cr->offset : 0;
-}
-
-
-
-void dumb_destroy_click_remover(DUMB_CLICK_REMOVER *cr) {
-	if (cr) {
-		DUMB_CLICK *click = cr->click;
-		while (click) {
-			DUMB_CLICK *next = click->next;
-			free(click);
-			click = next;
-		}
-		free(cr);
-	}
-}
-
-
-
-DUMB_CLICK_REMOVER **dumb_create_click_remover_array(int n) {
-	int i;
-	DUMB_CLICK_REMOVER **cr;
-	if (n <= 0) return NULL;
-	cr = (DUMB_CLICK_REMOVER **)malloc(n * sizeof(*cr));
-	if (!cr) return NULL;
-	for (i = 0; i < n; i++) cr[i] = dumb_create_click_remover();
-	return cr;
-}
-
-
-
-void dumb_record_click_array(int n, DUMB_CLICK_REMOVER **cr, long pos, sample_t *step) {
-	if (cr) {
-		int i;
-		for (i = 0; i < n; i++)
-			dumb_record_click(cr[i], pos, step[i]);
-	}
-}
-
-
-
-void dumb_record_click_negative_array(int n, DUMB_CLICK_REMOVER **cr, long pos, sample_t *step) {
-	if (cr) {
-		int i;
-		for (i = 0; i < n; i++)
-			dumb_record_click(cr[i], pos, -step[i]);
-	}
-}
-
-
-
-void dumb_remove_clicks_array(int n, DUMB_CLICK_REMOVER **cr, sample_t **samples, long length, float halflife) {
-	if (cr) {
-		int i;
-		for (i = 0; i < n; i++)
-			dumb_remove_clicks(cr[i], samples[i], length, halflife);
-	}
-}
-
-
-
-void dumb_click_remover_get_offset_array(int n, DUMB_CLICK_REMOVER **cr, sample_t *offset) {
-	if (cr) {
-		int i;
-		for (i = 0; i < n; i++)
-			if (cr[i]) offset[i] += cr[i]->offset;
-	}
-}
-
-
-
-void dumb_destroy_click_remover_array(int n, DUMB_CLICK_REMOVER **cr) {
-	if (cr) {
-		int i;
-		for (i = 0; i < n; i++) dumb_destroy_click_remover(cr[i]);
-		free(cr);
-	}
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/memfile.c b/engines/ags/lib/dumb-0.9.2/helpers/memfile.c
deleted file mode 100644
index b65ab5f78d..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/memfile.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * memfile.c - Module for reading data from           / / \  \
- *             memory using a DUMBFILE.              | <  /   \_
- *                                                   |  \/ /\   /
- * By entheh.                                         \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "dumb.h"
-
-
-
-typedef struct MEMFILE MEMFILE;
-
-struct MEMFILE
-{
-	const char *ptr;
-	long left;
-};
-
-
-
-static int dumb_memfile_skip(void *f, long n)
-{
-	MEMFILE *m = f;
-	if (n > m->left) return -1;
-	m->ptr += n;
-	m->left -= n;
-	return 0;
-}
-
-
-
-static int dumb_memfile_getc(void *f)
-{
-	MEMFILE *m = f;
-	if (m->left <= 0) return -1;
-	m->left--;
-	return *(const unsigned char *)m->ptr++;
-}
-
-
-
-static long dumb_memfile_getnc(char *ptr, long n, void *f)
-{
-	MEMFILE *m = f;
-	if (n > m->left) n = m->left;
-	memcpy(ptr, m->ptr, n);
-	m->ptr += n;
-	m->left -= n;
-	return n;
-}
-
-
-
-static void dumb_memfile_close(void *f)
-{
-	free(f);
-}
-
-
-
-static DUMBFILE_SYSTEM memfile_dfs = {
-	NULL,
-	&dumb_memfile_skip,
-	&dumb_memfile_getc,
-	&dumb_memfile_getnc,
-	&dumb_memfile_close
-};
-
-
-
-DUMBFILE *dumbfile_open_memory(const char *data, long size)
-{
-	MEMFILE *m = malloc(sizeof(*m));
-	if (!m) return NULL;
-
-	m->ptr = data;
-	m->left = size;
-
-	return dumbfile_open_ex(m, &memfile_dfs);
-}
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/resample.c b/engines/ags/lib/dumb-0.9.2/helpers/resample.c
deleted file mode 100644
index d8b238fc71..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/resample.c
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * resample.c - Resampling helper.                    / / \  \
- *                                                   | <  /   \_
- * By Bob and entheh.                                |  \/ /\   /
- *                                                    \_  /  > /
- * In order to find a good trade-off between            | \ / /
- * speed and accuracy in this code, some tests          |  ' /
- * were carried out regarding the behaviour of           \__/
- * long long ints with gcc. The following code
- * was tested:
- *
- * int a, b, c;
- * c = ((long long)a * b) >> 16;
- *
- * DJGPP GCC Version 3.0.3 generated the following assembly language code for
- * the multiplication and scaling, leaving the 32-bit result in EAX.
- *
- * movl  -8(%ebp), %eax    ; read one int into EAX
- * imull -4(%ebp)          ; multiply by the other; result goes in EDX:EAX
- * shrdl $16, %edx, %eax   ; shift EAX right 16, shifting bits in from EDX
- *
- * Note that a 32*32->64 multiplication is performed, allowing for high
- * accuracy. On the Pentium 2 and above, shrdl takes two cycles (generally),
- * so it is a minor concern when four multiplications are being performed
- * (the cubic resampler). On the Pentium MMX and earlier, it takes four or
- * more cycles, so this method is unsuitable for use in the low-quality
- * resamplers.
- *
- * Since "long long" is a gcc-specific extension, we use LONG_LONG instead,
- * defined in dumb.h. We may investigate later what code MSVC generates, but
- * if it seems too slow then we suggest you use a good compiler.
- *
- * FIXME: these comments are somewhat out of date now.
- */
-
-#include <math.h>
-#include "dumb.h"
-
-
-
-/* Compile with -DHEAVYDEBUG if you want to make sure the pick-up function is
- * called when it should be. There will be a considerable performance hit,
- * since at least one condition has to be tested for every sample generated.
- */
-#ifdef HEAVYDEBUG
-#define HEAVYASSERT(cond) ASSERT(cond)
-#else
-#define HEAVYASSERT(cond)
-#endif
-
-
-
-//#define MULSC(a, b) ((int)((LONG_LONG)(a) * (b) >> 16))
-//#define MULSC(a, b) ((a) * ((b) >> 2) >> 14)
-#define MULSC(a, b) ((int)((LONG_LONG)((a) << 4) * ((b) << 12) >> 32))
-
-
-
-/* A global variable for controlling resampling quality wherever a local
- * specification doesn't override it. The following values are valid:
- *
- *  0 - DUMB_RQ_ALIASING - fastest
- *  1 - DUMB_RQ_LINEAR
- *  2 - DUMB_RQ_CUBIC    - nicest
- *
- * Values outside the range 0-2 will behave the same as the nearest
- * value within the range.
- */
-int dumb_resampling_quality = 2;
-
-
-
-void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, long pos, long start, long end)
-{
-	resampler->src = src;
-	resampler->pos = pos;
-	resampler->subpos = 0;
-	resampler->start = start;
-	resampler->end = end;
-	resampler->dir = 1;
-	resampler->pickup = NULL;
-	resampler->pickup_data = NULL;
-	resampler->min_quality = 0;
-	resampler->max_quality = DUMB_RQ_N_LEVELS - 1;
-	resampler->x[2] = resampler->x[1] = resampler->x[0] = 0;
-	resampler->overshot = -1;
-}
-
-
-
-DUMB_RESAMPLER *dumb_start_resampler(sample_t *src, long pos, long start, long end)
-{
-	DUMB_RESAMPLER *resampler = malloc(sizeof(*resampler));
-	if (!resampler) return NULL;
-	dumb_reset_resampler(resampler, src, pos, start, end);
-	return resampler;
-}
-
-
-
-/* For convenience, returns nonzero on stop. */
-static int process_pickup(DUMB_RESAMPLER *resampler)
-{
-	if (resampler->overshot < 0) {
-		resampler->overshot = 0;
-		dumb_resample(resampler, NULL, 2, 0, 1.0f);
-		resampler->x[0] = resampler->x[1];
-	}
-
-	for (;;) {
-		if (resampler->dir < 0) {
-			if (resampler->overshot >= 3 && resampler->pos+3 >= resampler->start) resampler->x[0] = resampler->src[resampler->pos+3];
-			if (resampler->overshot >= 2 && resampler->pos+2 >= resampler->start) resampler->x[1] = resampler->src[resampler->pos+2];
-			if (resampler->overshot >= 1 && resampler->pos+1 >= resampler->start) resampler->x[2] = resampler->src[resampler->pos+1];
-			resampler->overshot = resampler->start - resampler->pos - 1;
-		} else {
-			if (resampler->overshot >= 3 && resampler->pos-3 < resampler->end) resampler->x[0] = resampler->src[resampler->pos-3];
-			if (resampler->overshot >= 2 && resampler->pos-2 < resampler->end) resampler->x[1] = resampler->src[resampler->pos-2];
-			if (resampler->overshot >= 1 && resampler->pos-1 < resampler->end) resampler->x[2] = resampler->src[resampler->pos-1];
-			resampler->overshot = resampler->pos - resampler->end;
-		}
-
-		if (resampler->overshot < 0) {
-			resampler->overshot = 0;
-			return 0;
-		}
-
-		if (!resampler->pickup) {
-			resampler->dir = 0;
-			return 1;
-		}
-		(*resampler->pickup)(resampler, resampler->pickup_data);
-		if (resampler->dir == 0) return 1;
-		ASSERT(resampler->dir == -1 || resampler->dir == 1);
-	}
-}
-
-
-
-/* Executes the content 'iterator' times.
- * Clobbers the 'iterator' variable.
- * The loop is unrolled by four.
- */
-#define LOOP4(iterator, CONTENT) \
-{ \
-	if ((iterator) & 2) { \
-		CONTENT; \
-		CONTENT; \
-	} \
-	if ((iterator) & 1) { \
-		CONTENT; \
-	} \
-	(iterator) >>= 2; \
-	while (iterator) { \
-		CONTENT; \
-		CONTENT; \
-		CONTENT; \
-		CONTENT; \
-		(iterator)--; \
-	} \
-}
-
-
-
-long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta)
-{
-	int dt;
-	int vol;
-	long done;
-	long todo;
-	int quality;
-
-	if (!resampler || resampler->dir == 0) return 0;
-	ASSERT(resampler->dir == -1 || resampler->dir == 1);
-
-	done = 0;
-	dt = (int)(delta * 65536.0 + 0.5);
-	vol = (int)floor(volume * 65536.0 + 0.5);
-
-	if (vol == 0) dst = NULL;
-
-	quality = dumb_resampling_quality;
-	if (quality > resampler->max_quality) quality = resampler->max_quality;
-	else if (quality < resampler->min_quality) quality = resampler->min_quality;
-
-	while (done < dst_size) {
-		if (process_pickup(resampler)) return done;
-
-		if ((resampler->dir ^ dt) < 0)
-			dt = -dt;
-
-		if (resampler->dir < 0)
-			todo = (long)((((LONG_LONG)(resampler->pos - resampler->start) << 16) + resampler->subpos - dt) / -dt);
-		else
-			todo = (long)((((LONG_LONG)(resampler->end - resampler->pos) << 16) - resampler->subpos - 1 + dt) / dt);
-
-		if (todo < 0)
-			todo = 0;
-		else if (todo > dst_size - done)
-			todo = dst_size - done;
-
-		done += todo;
-
-		{
-			sample_t *src = resampler->src;
-			long pos = resampler->pos;
-			int subpos = resampler->subpos;
-			long diff = pos;
-			long overshot;
-			if (resampler->dir < 0) {
-				if (!dst) {
-					/* Silence or simulation */
-					LONG_LONG new_subpos = subpos + dt * todo;
-					pos += (long)(new_subpos >> 16);
-					subpos = (long)new_subpos & 65535;
-				} else if (quality <= DUMB_RQ_ALIASING) {
-					/* Aliasing, backwards */
-					sample_t xbuf[2];
-					sample_t *x = &xbuf[0];
-					sample_t *xstart;
-					xbuf[0] = resampler->x[1];
-					xbuf[1] = resampler->x[2];
-					while (todo && x < &xbuf[2]) {
-						HEAVYASSERT(pos >= resampler->start);
-						*dst++ += MULSC(x[0], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x -= subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = xstart = &src[pos];
-					LOOP4(todo,
-						*dst++ += MULSC(x[2], vol);
-						subpos += dt;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-					pos += x - xstart;
-				} else if (quality <= DUMB_RQ_LINEAR) {
-					/* Linear interpolation, backwards */
-					sample_t xbuf[3];
-					sample_t *x = &xbuf[1];
-					xbuf[0] = resampler->x[1];
-					xbuf[1] = resampler->x[2];
-					xbuf[2] = src[pos];
-					while (todo && x < &xbuf[3]) {
-						HEAVYASSERT(pos >= resampler->start);
-						*dst++ += MULSC(x[0] + MULSC(x[-1] - x[0], subpos), vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x -= subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = &src[pos];
-					LOOP4(todo,
-						HEAVYASSERT(pos >= resampler->start);
-						*dst++ += MULSC(x[1] + MULSC(x[2] - x[1], subpos), vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-				} else {
-					/* Cubic interpolation, backwards */
-					sample_t xbuf[6];
-					sample_t *x = &xbuf[3];
-					sample_t *lastx = NULL;
-					int a = 0, b = 0, c = 0;
-					xbuf[0] = resampler->x[0];
-					xbuf[1] = resampler->x[1];
-					xbuf[2] = resampler->x[2];
-					xbuf[3] = src[pos];
-					if (pos-1 >= resampler->start) xbuf[4] = src[pos-1];
-					if (pos-2 >= resampler->start) xbuf[5] = src[pos-2];
-					while (todo && x < &xbuf[6]) {
-						HEAVYASSERT(pos >= resampler->start);
-						if (lastx != x) {
-							lastx = x;
-							a = (((x[-1] - x[-2]) << 1) + (x[-1] - x[-2]) + (x[-3] - x[0])) >> 1;
-							b = (x[-2] << 1) + x[0] - ((5 * x[-1] + x[-3]) >> 1);
-							c = (x[-2] - x[0]) >> 1;
-						}
-						*dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-1], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x -= subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = &src[pos];
-					lastx = NULL;
-					LOOP4(todo,
-						HEAVYASSERT(pos >= resampler->start);
-						if (lastx != x) {
-							lastx = x;
-							a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 1;
-							b = (x[2] << 1) + x[0] - ((5 * x[1] + x[3]) >> 1);
-							c = (x[2] - x[0]) >> 1;
-						}
-						*dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[1], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-				}
-				diff = diff - pos;
-				overshot = resampler->start - pos - 1;
-				if (diff >= 3) {
-					resampler->x[0] = overshot >= 3 ? 0 : src[pos+3];
-					resampler->x[1] = overshot >= 2 ? 0 : src[pos+2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos+1];
-				} else if (diff >= 2) {
-					resampler->x[0] = resampler->x[2];
-					resampler->x[1] = overshot >= 2 ? 0 : src[pos+2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos+1];
-				} else if (diff >= 1) {
-					resampler->x[0] = resampler->x[1];
-					resampler->x[1] = resampler->x[2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos+1];
-				}
-			} else {
-				if (!dst) {
-					/* Silence or simulation */
-					LONG_LONG new_subpos = subpos + dt * todo;
-					pos += (long)(new_subpos >> 16);
-					subpos = (long)new_subpos & 65535;
-				} else if (dumb_resampling_quality <= DUMB_RQ_ALIASING) {
-					/* Aliasing, forwards */
-					sample_t xbuf[2];
-					sample_t *x = &xbuf[0];
-					sample_t *xstart;
-					xbuf[0] = resampler->x[1];
-					xbuf[1] = resampler->x[2];
-					while (todo && x < &xbuf[2]) {
-						HEAVYASSERT(pos < resampler->end);
-						*dst++ += MULSC(x[0], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = xstart = &src[pos];
-					LOOP4(todo,
-						*dst++ += MULSC(x[-2], vol);
-						subpos += dt;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-					pos += x - xstart;
-				} else if (dumb_resampling_quality <= DUMB_RQ_LINEAR) {
-					/* Linear interpolation, forwards */
-					sample_t xbuf[3];
-					sample_t *x = &xbuf[1];
-					xbuf[0] = resampler->x[1];
-					xbuf[1] = resampler->x[2];
-					xbuf[2] = src[pos];
-					while (todo && x < &xbuf[3]) {
-						HEAVYASSERT(pos < resampler->end);
-						*dst++ += MULSC(x[-1] + MULSC(x[0] - x[-1], subpos), vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = &src[pos];
-					LOOP4(todo,
-						HEAVYASSERT(pos < resampler->end);
-						*dst++ += MULSC(x[-2] + MULSC(x[-1] - x[-2], subpos), vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-				} else {
-					/* Cubic interpolation, forwards */
-					sample_t xbuf[6];
-					sample_t *x = &xbuf[3];
-					sample_t *lastx = NULL;
-					int a = 0, b = 0, c = 0;
-					xbuf[0] = resampler->x[0];
-					xbuf[1] = resampler->x[1];
-					xbuf[2] = resampler->x[2];
-					xbuf[3] = src[pos];
-					if (pos+1 < resampler->end) xbuf[4] = src[pos+1];
-					if (pos+2 < resampler->end) xbuf[5] = src[pos+2];
-					while (todo && x < &xbuf[6]) {
-						HEAVYASSERT(pos < resampler->end);
-						if (lastx != x) {
-							lastx = x;
-							a = (((x[-2] - x[-1]) << 1) + (x[-2] - x[-1]) + (x[0] - x[-3])) >> 1;
-							b = (x[-1] << 1) + x[-3] - ((5 * x[-2] + x[0]) >> 1);
-							c = (x[-1] - x[-3]) >> 1;
-						}
-						*dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-						todo--;
-					}
-					x = &src[pos];
-					lastx = NULL;
-					LOOP4(todo,
-						HEAVYASSERT(pos < resampler->end);
-						if (lastx != x) {
-							lastx = x;
-							a = (((x[-2] - x[-1]) << 1) + (x[-2] - x[-1]) + (x[0] - x[-3])) >> 1;
-							b = (x[-1] << 1) + x[-3] - ((5 * x[-2] + x[0]) >> 1);
-							c = (x[-1] - x[-3]) >> 1;
-						}
-						*dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2], vol);
-						subpos += dt;
-						pos += subpos >> 16;
-						x += subpos >> 16;
-						subpos &= 65535;
-					);
-				}
-				diff = pos - diff;
-				overshot = pos - resampler->end;
-				if (diff >= 3) {
-					resampler->x[0] = overshot >= 3 ? 0 : src[pos-3];
-					resampler->x[1] = overshot >= 2 ? 0 : src[pos-2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos-1];
-				} else if (diff >= 2) {
-					resampler->x[0] = resampler->x[2];
-					resampler->x[1] = overshot >= 2 ? 0 : src[pos-2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos-1];
-				} else if (diff >= 1) {
-					resampler->x[0] = resampler->x[1];
-					resampler->x[1] = resampler->x[2];
-					resampler->x[2] = overshot >= 1 ? 0 : src[pos-1];
-				}
-			}
-			resampler->pos = pos;
-			resampler->subpos = subpos;
-		}
-	}
-
-	return done;
-}
-
-
-
-sample_t dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, float volume)
-{
-	int vol;
-	sample_t *src;
-	long pos;
-	int subpos;
-	int quality;
-
-	if (!resampler || resampler->dir == 0) return 0;
-	ASSERT(resampler->dir == -1 || resampler->dir == 1);
-
-	if (process_pickup(resampler)) return 0;
-
-	vol = (int)floor(volume * 65536.0 + 0.5);
-	if (vol == 0) return 0;
-
-	quality = dumb_resampling_quality;
-	if (quality > resampler->max_quality) quality = resampler->max_quality;
-	else if (quality < resampler->min_quality) quality = resampler->min_quality;
-
-	src = resampler->src;
-	pos = resampler->pos;
-	subpos = resampler->subpos;
-
-	if (resampler->dir < 0) {
-		HEAVYASSERT(pos >= resampler->start);
-		if (dumb_resampling_quality <= 0) {
-			/* Aliasing, backwards */
-			return MULSC(src[pos], vol);
-		} else if (quality <= DUMB_RQ_LINEAR) {
-			/* Linear interpolation, backwards */
-			return MULSC(resampler->x[2] + MULSC(resampler->x[1] - resampler->x[2], subpos), vol);
-		} else {
-			/* Cubic interpolation, backwards */
-			sample_t *x = resampler->x;
-			int a, b, c;
-			a = (((x[2] - x[1]) << 1) + (x[2] - x[1]) + (x[0] - src[pos])) >> 1;
-			b = (x[1] << 1) + src[pos] - ((5 * x[2] + x[0]) >> 1);
-			c = (x[1] - src[pos]) >> 1;
-			return MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[2], vol);
-		}
-	} else {
-		HEAVYASSERT(pos < resampler->end);
-		if (dumb_resampling_quality <= 0) {
-			/* Aliasing */
-			return MULSC(src[pos], vol);
-		} else if (dumb_resampling_quality <= DUMB_RQ_LINEAR) {
-			/* Linear interpolation, forwards */
-			return MULSC(resampler->x[1] + MULSC(resampler->x[2] - resampler->x[1], subpos), vol);
-		} else {
-			/* Cubic interpolation, forwards */
-			sample_t *x = resampler->x;
-			int a, b, c;
-			a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (src[pos] - x[0])) >> 1;
-			b = (x[2] << 1) + x[0] - ((5 * x[1] + src[pos]) >> 1);
-			c = (x[2] - x[0]) >> 1;
-			return MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[1], vol);
-		}
-	}
-}
-
-
-
-void dumb_end_resampler(DUMB_RESAMPLER *resampler)
-{
-	if (resampler)
-		free(resampler);
-}
-
-
-
-#if 0
-/* The following macro is used to overcome the fact that most C
- * compilers (including gcc and MSVC) can't correctly multiply signed
- * integers outside the range -32768 to 32767. i86 assembler versions
- * don't need to use this method, since the processor does in fact
- * have instructions to multiply large numbers correctly - which
- * means using assembly language could make a significant difference
- * to the speed.
- *
- * The basic method is as follows. We halve the subposition (how far
- * we are between samples), so it never exceeds 32767. We also halve
- * the delta, which is the amount to be added to the subposition each
- * time. Then we unroll the loop twofold, so that we can add the lost
- * one every other time if necessary (since the halving may have
- * resulted in rounding down).
- *
- * This method doesn't incur any cumulative inaccuracies. There is a
- * very slight loss of quality, which I challenge anyone to notice -
- * but the position will advance at *exactly* the same rate as it
- * would if we didn't use this method. This also means the pitch is
- * exactly the same, which may even make a difference to trained
- * musicians when resampling down a lot :)
- *
- * Each time this macro is invoked, DO_RESAMPLE(inc) must be defined
- * to calculate the samples by the appropriate equation (linear,
- * cubic, etc.). See the individual cases for examples of how this is
- * done.
- */
-#define MAKE_RESAMPLER()							\
-{													\
-	if (dt & 1) {									\
-		long todo2;									\
-													\
-		dt >>= 1;									\
-													\
-		if (src_subpos & 1) {						\
-			src_subpos >>= 1;						\
-			DO_RESAMPLE(1);							\
-			todo--;									\
-		} else										\
-			src_subpos >>= 1;						\
-													\
-		todo2 = todo >> 1;							\
-													\
-		while (todo2) {								\
-			DO_RESAMPLE(0);							\
-			DO_RESAMPLE(1);							\
-			todo2--;								\
-		}											\
-													\
-		if (todo & 1) {								\
-			DO_RESAMPLE(0);							\
-			src_subpos = (src_subpos << 1) | 1;		\
-		} else										\
-			src_subpos <<= 1;						\
-													\
-		todo = 0;									\
-		dt = (dt << 1) | 1;							\
-	} else {										\
-		long subposbit = src_subpos & 1;			\
-		dt >>= 1;									\
-		src_subpos >>= 1;							\
-													\
-		if (todo & 1) {								\
-			DO_RESAMPLE(0);							\
-		}											\
-													\
-		todo >>= 1;									\
-													\
-		while (todo) {								\
-			DO_RESAMPLE(0);							\
-			DO_RESAMPLE(0);							\
-			todo--;									\
-		}											\
-													\
-		src_subpos = (src_subpos << 1) | subposbit; \
-		dt <<= 1;									\
-	}												\
-}
-
-
-
-sample_t dumb_resample_get_current_sample(
-	sample_t *src, long *_src_pos, int *_src_subpos,
-	long src_start, long src_end,
-	float volume, int *_dir,
-	DUMB_RESAMPLE_PICKUP pickup, void *pickup_data
-)
-{
-	long src_pos = *_src_pos;
-	int src_subpos = *_src_subpos;
-	int dir = _dir ? *_dir : 1;
-
-	sample_t value = 0;
-
-	if (dir == 0)
-		return 0;
-
-	ASSERT(dir == 1 || dir == -1);
-
-	if (dir < 0 ? (src_pos < src_start) : (src_pos >= src_end)) {
-
-		/* If there's no pick-up function, we stop. */
-		if (!pickup) {
-			dir = 0;
-			goto end;
-		}
-
-		/* Process the pick-up. It may need invoking more than once. */
-		do {
-			dir = (*pickup)(src, &src_pos, &src_subpos, &src_start, &src_end, dir, pickup_data);
-
-			if (dir == 0)
-				goto end;
-
-			ASSERT(dir == 1 || dir == -1);
-		} while (dir < 0 ? (src_pos < src_start) : (src_pos >= src_end));
-	}
-
-	HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end));
-
-	if (dumb_resampling_quality == 0) {
-		/* Aliasing (coarse) */
-		int volume_fact = (int)(volume * 16384.0);
-		value = (src[src_pos] * volume_fact) >> 14;
-	} else if (dumb_resampling_quality <= 2) {
-		/* Linear interpolation */
-		int volume_fact = (int)(volume * 16384.0);
-		int subpos = src_subpos >> 1;
-		value = ((src[src_pos] + ((((src[src_pos + 1] - src[src_pos]) >> 1) * subpos) >> 14)) * volume_fact) >> 14;
-	} else if (dumb_resampling_quality == 3) {
-		/* Quadratic interpolation */
-		int volume_fact = (int)(volume * 16384.0);
-		int a, b;
-		sample_t *x;
-		int subpos = src_subpos >> 1;
-		x = &src[src_pos];
-		a = ((x[0] + x[2]) >> 1) - x[1];
-		b = ((x[2] - x[0]) >> 1) - (a << 1);
-		value = (((((((a * subpos) >> 15) + b) * subpos) >> 15) + x[0]) * volume_fact) >> 14;
-	} else {
-		/* Cubic interpolation */
-		int volume_fact = (int)(volume * 16384.0);
-		int a, b, c;
-		sample_t *x;
-		int subpos = src_subpos >> 1;
-		x = &src[src_pos];
-		a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 1;
-		b = (x[2] << 1) + x[0] - ((5 * x[1] + x[3]) >> 1);
-		c = (x[2] - x[0]) >> 1;
-		value = (((int)(((LONG_LONG)((int)(((LONG_LONG)((int)(((LONG_LONG)a * subpos) >> 15) + b) * subpos) >> 15) + c) * subpos) >> 15) + x[1]) * volume_fact) >> 14;
-	}
-
-	end:
-
-	*_src_pos = src_pos;
-	*_src_subpos = src_subpos;
-	if (_dir) *_dir = dir;
-
-	return value;
-}
-
-
-
-long dumb_resample(
-	sample_t *src, long *_src_pos, int *_src_subpos,
-	long src_start, long src_end,
-	sample_t *dst, long dst_size,
-	float volume, float delta, int *_dir,
-	DUMB_RESAMPLE_PICKUP pickup, void *pickup_data
-)
-{
-	int dt = (int)(delta * 65536.0 + 0.5);
-	long s = 0; /* Current position in the destination buffer */
-
-	long src_pos = *_src_pos;
-	int src_subpos = *_src_subpos;
-	int dir = _dir ? *_dir : 1;
-
-	int linear_average;
-
-	if (dir == 0)
-		return 0;
-
-	ASSERT(dir == 1 || dir == -1);
-
-	linear_average = dst && dumb_resampling_quality >= 2 && dt > 65536;
-
-	if (dir < 0) dt = -dt;
-
-	if (linear_average)
-		volume /= delta;
-
-	while (s < dst_size) {
-
-		long todo;
-
-		/* Process pick-ups first, just in case. */
-
-		if (linear_average) {
-
-			/* For linear average, the pick-up point could split a sum into
-			 * two parts. We handle this by putting the pick-up code inside
-			 * the summing loop. Note that this code is only executed when we
-			 * know that a pick-up is necessary somewhere during this sum
-			 * (although it is always executed once for the first sample).
-			 * We use a separate loop further down when we know we won't have
-			 * to do a pick-up, so the condition does not need testing inside
-			 * the loop.
-			 */
-
-			float sum;
-			long i;
-			int advance;
-			int x[3];
-
-			advance = src_subpos + dt;
-
-			/* Make these negative. Then they stay within the necessary
-			 * range for integer multiplication, -32768 to 32767 ;)
-			 */
-			x[0] = ~(src_subpos >> 1); /* = -1 - (src_subpos >> 1) */
-			x[2] = x[0] ^ 0x7FFF; /* = -32768 + (src_subpos >> 1) */
-
-			sum = (float)(-((src[src_pos] * (x+1)[dir]) >> 15));
-
-			i = src_pos + (advance >> 16);
-			src_pos += dir;
-			src_subpos = (dir >> 1) & 65535; /* changes 1,-1 to 0,65535 */
-
-			advance &= 65535;
-
-			/* i is the index of the first sample NOT to sum fully,
-			 * regardless of the direction of resampling.
-			 */
-
-			while (dir < 0 ? (i < src_start) : (i >= src_end)) {
-				if (dir < 0) {
-					while (src_pos >= src_start)
-						sum += src[src_pos--];
-				} else {
-					while (src_pos < src_end)
-						sum += src[src_pos++];
-				}
-
-				i -= src_pos;
-				/* i is now the number of samples left to sum fully, except
-				 * it's negative if we're going backwards.
-				 */
-
-				if (!pickup) {
-					dir = 0;
-					goto endsum;
-				}
-
-				dir = (*pickup)(src, &src_pos, &src_subpos, &src_start, &src_end, dir, pickup_data);
-
-				if (dir == 0)
-					goto endsum;
-
-				ASSERT(dir == 1 || dir == -1);
-
-				if ((dir ^ dt) < 0) {
-					dt = -dt;
-					advance ^= 65535;
-					i = -i;
-				}
-
-				i += src_pos;
-				/* There, i is back to normal. */
-			}
-
-			for (; src_pos != i; src_pos += dir)
-				sum += src[src_pos];
-
-			src_subpos = advance;
-
-			x[2] = src_subpos >> 1;
-			x[0] = x[2] ^ 0x7FFF; /* = 32767 - (src_subpos >> 1) */
-
-			sum += (src[src_pos] * (x+1)[dir]) >> 15;
-
-			endsum:
-
-			sum *= volume;
-			dst[s] += (int)sum;
-
-			s++;
-
-			if (dir == 0)
-				break;
-
-		} else if (dir < 0 ? (src_pos < src_start) : (src_pos >= src_end)) {
-
-			/* If there's no pick-up function, we stop. */
-			if (!pickup) {
-				dir = 0;
-				break;
-			}
-
-			/* Process the pick-up. It may need invoking more than once. */
-			do {
-				dir = (*pickup)(src, &src_pos, &src_subpos, &src_start, &src_end, dir, pickup_data);
-
-				if (dir == 0)
-					goto end;
-
-				ASSERT(dir == 1 || dir == -1);
-			} while (dir < 0 ? (src_pos < src_start) : (src_pos >= src_end));
-
-			/* Update sign of dt to match that of dir. */
-			if ((dir ^ dt) < 0)
-				dt = -dt;
-		}
-
-		/* Work out how many contiguous samples we can now render. */
-		if (dir < 0)
-			todo = (long)((((LONG_LONG)(src_pos - src_start) << 16) + src_subpos) / -dt);
-		else
-			todo = (long)((((LONG_LONG)(src_end - src_pos) << 16) - src_subpos - 1) / dt);
-
-		/* The above equations work out how many complete dt-sized
-		 * intervals there are between the current position and the loop
-		 * point (provided there is a little fractional extra). The linear
-		 * average function needs complete intervals - but the other
-		 * resamplers only read a sample from the beginning of each interval,
-		 * so they can process one extra sample in their main loops (so we
-		 * increment todo in a moment).
-		 *
-		 * The linear average function makes up the extra sample using the
-		 * specialised pick-up code above.
-		 *
-		 * Note that our above pick-up process should have absolutely ensured
-		 * that the result of this function will be nonnegative.
-		 */
-
-		ASSERT(todo >= 0);
-
-		if (!linear_average)
-			todo++;
-
-		/* Of course we don't want to overrun the output buffer! */
-		if (todo > dst_size - s)
-			todo = dst_size - s;
-
-		if (!dst) {
-
-			LONG_LONG t = src_subpos + (LONG_LONG)dt * todo;
-			src_pos += (long)(t >> 16);
-			src_subpos = (int)t & 0xFFFFl;
-
-			s += todo;
-
-		} else if (linear_average) {
-
-			float sum;
-			long i;
-			int advance;
-			int x[3];
-
-			while (todo) {
-
-				advance = src_subpos + dt;
-
-				/* Make these negative. Then they stay within the necessary
-				 * range for integer multiplication, -32768 to 32767 ;)
-				 */
-				x[0] = ~(src_subpos >> 1); /* = -1 - (src_subpos >> 1) */
-				x[2] = x[0] ^ 0x7FFF; /* = -32768 + (src_subpos >> 1) */
-
-				sum = (float)(-((src[src_pos] * (x+1)[dir]) >> 15));
-
-				i = src_pos + (advance >> 16);
-				src_pos += dir;
-				src_subpos = (dir >> 1) & 65535; /* changes 1,-1 to 0,65535 */
-
-				advance &= 65535;
-
-				/* i is the index of the first sample NOT to sum fully,
-				 * regardless of the direction of resampling.
-				 */
-
-				HEAVYASSERT(dir < 0 ? (i >= src_start) : (i < src_end));
-
-				for (; src_pos != i; src_pos += dir)
-					sum += src[src_pos];
-
-				src_subpos = advance;
-
-				x[2] = src_subpos >> 1;
-				x[0] = x[2] ^ 0x7FFF; /* = 32767 - (src_subpos >> 1) */
-
-				sum += (src[src_pos] * (x+1)[dir]) >> 15;
-
-				sum *= volume;
-				dst[s] += (int)sum;
-
-				s++;
-				todo--;
-			}
-
-		} else if (dumb_resampling_quality == 0 || (dumb_resampling_quality == 1 && delta >= 1.0)) {
-
-			/* Aliasing (coarse) */
-			int volume_fact = (int)(volume * 16384.0);
-
-			do {
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end));
-				dst[s] += ((src[src_pos] * volume_fact) >> 14);
-				src_subpos += dt;
-				src_pos += src_subpos >> 16;
-				src_subpos &= 0xFFFFl;
-				s++;
-			} while (--todo);
-
-		} else if (dumb_resampling_quality <= 2) {
-
-			/* Linear interpolation */
-			int volume_fact = (int)(volume * 16384.0);
-
-			#define DO_RESAMPLE(inc)		 \
-			{								 \
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end)); \
-											 \
-				dst[s] += (((src[src_pos] + ((((src[src_pos + 1] - src[src_pos]) >> 1) * src_subpos) >> 14)) * volume_fact) >> 14); \
-											 \
-				src_subpos += dt + inc;		 \
-				src_pos += src_subpos >> 15; \
-				src_subpos &= 0x7FFFl;		 \
-				s++;						 \
-			}
-
-			MAKE_RESAMPLER();
-
-			#undef DO_RESAMPLE
-
-		} else if (dumb_resampling_quality == 3) {
-
-			/* Quadratic interpolation */
-
-			int volume_fact = (int)(volume * 16384.0);
-			int a = 0, b = 0;
-			sample_t *x = NULL;
-			int last_src_pos = -1;
-
-			/* AIM: no integer multiplicands must transcend the range -32768 to 32767.
-			 * This limitation is imposed by most compilers, including gcc and MSVC.
-			 *
-			 * a = 0.5 * (s0 + s2) - s1
-			 * b = -1.5 * s0 + 2 * s1 - 0.5 * s2
-			 * c = s0
-			 *
-			 * s = (a * t + b) * t + c
-			 *
-			 * In fixed-point:
-			 *
-			 * a = ((s0 + s2) >> 1) - s1
-			 * b = ((-3 * s0 - s2) >> 1) + (s1 << 1)
-			 *
-			 * s = (((((a * t) >> 16) + b) * t) >> 16) + s0
-			 *
-			 * With t halved (since t can reach 65535):
-			 *
-			 * s = (((((a * t) >> 15) + b) * t) >> 15) + s0
-			 *
-			 * a currently reaches 65536
-			 * b currently reaches 131072
-			 *
-			 * So we must use aon2
-			 *
-			 * s = (((((aon2 * t) >> 14) + b) * t) >> 15) + s0
-			 *
-			 * ((aon2 * t) >> 14) + b is 5 times too big
-			 * so we must divide by 8
-			 *
-			 * s = (((((aon2 * t) >> 17) + bon8) * t) >> 12) + s0
-			 *
-			 * aon2 = ((s0 + s2) >> 2) - (s1 >> 1)
-			 * bon8 = ((-3 * s0 - s2) >> 4) + (s1 >> 2)
-			 * or:
-			 * bon8 = ((s2 - s0) >> 4) - (aon2 >> 1)
-			 */
-
-			/* Unh4x0r3d version:
-			#define DO_RESAMPLE(inc)						\
-			{												\
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end)); \
-															\
-				if (src_pos != last_src_pos) {				\
-					last_src_pos = src_pos;					\
-					x = &src[src_pos];						\
-					a = ((x[0] + x[2]) >> 2) - (x[1] >> 1); \
-					b = ((x[2] - x[0]) >> 4) - (a >> 1);	\
-				}											\
-															\
-				dst[s] += ((((((((a * src_subpos) >> 17) + b) * src_subpos) >> 12) + x[0]) * volume_fact) >> 14); \
-															\
-				src_subpos += dt + inc;						\
-				src_pos += src_subpos >> 15;				\
-				src_subpos &= 0x7FFFl;						\
-				s++;										\
-			}
-			*/
-
-			/* H4x0r3d version: */
-			#define DO_RESAMPLE(inc)						\
-			{												\
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end)); \
-															\
-				if (src_pos != last_src_pos) {				\
-					last_src_pos = src_pos;					\
-					x = &src[src_pos];						\
-					a = ((x[0] + x[2]) >> 1) - x[1];		\
-					b = ((x[2] - x[0]) >> 1) - (a << 1);	\
-				}											\
-															\
-				dst[s] += ((((((((a * src_subpos) >> 15) + b) * src_subpos) >> 15) + x[0]) * volume_fact) >> 14); \
-															\
-				src_subpos += dt + inc;						\
-				src_pos += src_subpos >> 15;				\
-				src_subpos &= 0x7FFFl;						\
-				s++;										\
-			}
-
-			MAKE_RESAMPLER();
-
-			#undef DO_RESAMPLE
-
-		} else {
-
-			/* Cubic interpolation */
-
-			int volume_fact = (int)(volume * 16384.0);
-			int a = 0, b = 0, c = 0;
-			sample_t *x = NULL;
-			int last_src_pos = -1;
-
-			/* AIM: never multiply integers outside the range -32768 to 32767.
-			 *
-			 * a = 1.5f * (x[1] - x[2]) + (x[3] - x[0]) * 0.5f;
-			 * b = 2.0f * x[2] + x[0] - 2.5f * x[1] - x[3] * 0.5f;
-			 * c = (x[2] - x[0]) * 0.5f;
-			 *
-			 * s = ((a * t + b) * t + c) * t + x[1];
-			 *
-			 * Fixed-point version:
-			 *
-			 * a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 1;
-			 * b = (x[2] << 1) + x[0] - ((5 * x[1] + x[3]) >> 1);
-			 * c = (x[2] - x[0]) >> 1;
-			 *
-			 * s = ((((((((a * t) >> 15) + b) * t) >> 15) + c) * t) >> 15) + x[1];
-			 *   (with t already halved, maximum 32767)
-			 *
-			 * a is in (((1+1)*2)+(1+1)+(1+1))/2 = 8 times the required range
-			 * b is in (1*2)+1+((5*1+1)/2) = 6 times
-			 * c is in the required range
-			 *
-			 * We must use aon8
-			 *
-			 * s = ((((((((aon8 * t) >> 12) + b) * t) >> 15) + c) * t) >> 15) + x[1];
-			 *
-			 * But ((aon8 * t) >> 12) is in 2^(15+15-12) = 2^18 = 8 times
-			 * b is in 6 times
-			 * so we divide both ((aon8 * t) >> 12) and b by 16
-			 *
-			 * s = ((((((((aon8 * t) >> 16) + bon16) * t) >> 11) + c) * t) >> 15) + x[1];
-			 *
-			 * ((... + bon16) * t) >> 11 is 16 times too big
-			 * c is in the correct range
-			 * we must divide both by 32
-			 *
-			 * s = ((((((((aon8 * t) >> 16) + bon16) * t) >> 16) + con32) * t) >> 10) + x[1];
-			 *
-			 * aon8  = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 4;
-			 * bon16 = ((x[2] << 2) + (x[0] << 1) - (5 * x[1] + x[3])) >> 5;
-			 * con32 = (x[2] - x[0]) >> 6;
-			 *
-			 * A lot of accuracy is lost here. It is quite likely that some
-			 * of the above would cancel anyway, so the scaling down wouldn't
-			 * have to be so severe. However, I'm not in the mood to work it
-			 * out now :P
-			 *
-			 * It may also be worth investigating whether doing this stuff
-			 * in floats would be faster.
-			 */
-
-			/* Unh4x0r3d version:
-			#define DO_RESAMPLE(inc)		   \
-			{								   \
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end)); \
-											   \
-				if (src_pos != last_src_pos) { \
-					last_src_pos = src_pos;	   \
-					x = &src[src_pos];		   \
-					a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 4; \
-					b = ((x[2] << 2) + (x[0] << 1) - (5 * x[1] + x[3])) >> 5; \
-					c = (x[2] - x[0]) >> 6;	   \
-				}							   \
-											   \
-				dst[s] += ((((((((((a * src_subpos) >> 16) + b) * src_subpos) >> 16) + c) * src_subpos) >> 10) + x[1]) * volume_fact) >> 14; \
-											   \
-				src_subpos += dt + inc;		   \
-				src_pos += src_subpos >> 15;   \
-				src_subpos &= 0x7FFFl;		   \
-				s++;						   \
-			}
-			*/
-
-			/* H4x0r3d version: */
-			#define DO_RESAMPLE(inc)		   \
-			{								   \
-				HEAVYASSERT(dir < 0 ? (src_pos >= src_start) : (src_pos < src_end)); \
-											   \
-				if (src_pos != last_src_pos) { \
-					last_src_pos = src_pos;	   \
-					x = &src[src_pos];		   \
-					a = (((x[1] - x[2]) << 1) + (x[1] - x[2]) + (x[3] - x[0])) >> 1; \
-					b = (x[2] << 1) + x[0] - ((5 * x[1] + x[3]) >> 1); \
-					c = (x[2] - x[0]) >> 1;	   \
-				}							   \
-											   \
-				dst[s] += (((int)(((LONG_LONG)((int)(((LONG_LONG)((int)(((LONG_LONG)a * src_subpos) >> 15) + b) * src_subpos) >> 15) + c) * src_subpos) >> 15) + x[1]) * volume_fact) >> 14; \
-											   \
-				src_subpos += dt + inc;		   \
-				src_pos += src_subpos >> 15;   \
-				src_subpos &= 0x7FFFl;		   \
-				s++;						   \
-			}
-
-			MAKE_RESAMPLER();
-
-			#undef DO_RESAMPLE
-
-		}
-
-	}
-
-	end:
-
-	ASSERT(s <= dst_size);
-
-	*_src_pos = src_pos;
-	*_src_subpos = src_subpos;
-	if (_dir) *_dir = dir;
-
-	return s;
-}
-#endif
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/sampbuf.c b/engines/ags/lib/dumb-0.9.2/helpers/sampbuf.c
deleted file mode 100644
index 75510c729a..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/sampbuf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * sampbuf.c - Helper for allocating sample           / / \  \
- *             buffers.                              | <  /   \_
- *                                                   |  \/ /\   /
- * By entheh.                                         \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include <stdlib.h>
-#include "dumb.h"
-
-
-
-sample_t **create_sample_buffer(int n_channels, long length)
-{
-	int i;
-	sample_t **samples = malloc(n_channels * sizeof(*samples));
-	if (!samples) return NULL;
-	samples[0] = malloc(n_channels * length * sizeof(*samples[0]));
-	if (!samples[0]) {
-		free(samples);
-		return NULL;
-	}
-	for (i = 1; i < n_channels; i++) samples[i] = samples[i-1] + length;
-	return samples;
-}
-
-
-
-void destroy_sample_buffer(sample_t **samples)
-{
-	if (samples) {
-		free(samples[0]);
-		free(samples);
-	}
-}
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/silence.c b/engines/ags/lib/dumb-0.9.2/helpers/silence.c
deleted file mode 100644
index 4d5fdcf4da..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/silence.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * silence.c - Silencing helper.                      / / \  \
- *                                                   | <  /   \_
- * By entheh.                                        |  \/ /\   /
- *                                                    \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include <string.h>
-#include "dumb.h"
-
-
-
-void dumb_silence(sample_t *samples, long length)
-{
-	memset(samples, 0, length * sizeof(*samples));
-}
-
diff --git a/engines/ags/lib/dumb-0.9.2/helpers/stdfile.c b/engines/ags/lib/dumb-0.9.2/helpers/stdfile.c
deleted file mode 100644
index 2f02539a92..0000000000
--- a/engines/ags/lib/dumb-0.9.2/helpers/stdfile.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * stdfile.c - stdio file input module.               / / \  \
- *                                                   | <  /   \_
- * By entheh.                                        |  \/ /\   /
- *                                                    \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include <stdio.h>
-
-#include "dumb.h"
-
-
-
-static void *dumb_stdfile_open(const char *filename)
-{
-	return fopen(filename, "rb");
-}
-
-
-
-static int dumb_stdfile_skip(void *f, long n)
-{
-	return fseek(f, n, SEEK_CUR);
-}
-
-
-
-static int dumb_stdfile_getc(void *f)
-{
-	return fgetc(f);
-}
-
-
-
-static long dumb_stdfile_getnc(char *ptr, long n, void *f)
-{
-	return fread(ptr, 1, n, f);
-}
-
-
-
-static void dumb_stdfile_close(void *f)
-{
-	fclose(f);
-}
-
-
-
-static DUMBFILE_SYSTEM stdfile_dfs = {
-	&dumb_stdfile_open,
-	&dumb_stdfile_skip,
-	&dumb_stdfile_getc,
-	&dumb_stdfile_getnc,
-	&dumb_stdfile_close
-};
-
-
-
-void dumb_register_stdfiles(void)
-{
-	register_dumbfile_system(&stdfile_dfs);
-}
-
-
-
-static DUMBFILE_SYSTEM stdfile_dfs_leave_open = {
-	NULL,
-	&dumb_stdfile_skip,
-	&dumb_stdfile_getc,
-	&dumb_stdfile_getnc,
-	NULL
-};
-
-
-
-DUMBFILE *dumbfile_open_stdfile(FILE *p)
-{
-	DUMBFILE *d = dumbfile_open_ex(p, &stdfile_dfs_leave_open);
-
-	return d;
-}
diff --git a/engines/ags/lib/dumb-0.9.2/it.h b/engines/ags/lib/dumb-0.9.2/it.h
deleted file mode 100644
index 40678b9502..0000000000
--- a/engines/ags/lib/dumb-0.9.2/it.h
+++ /dev/null
@@ -1,716 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * internal/it.h - Internal stuff for IT playback     / / \  \
- *                 and MOD/XM/S3M conversion.        | <  /   \_
- *                                                   |  \/ /\   /
- *                                                    \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#ifndef INTERNAL_IT_H
-#define INTERNAL_IT_H
-
-#include "common/scummsys.h"
-
-namespace AGS3 {
-
-/** TO DO: THINK ABOUT THE FOLLOWING:
-
-sigdata->flags & IT_COMPATIBLE_GXX
-
-				Bit 5: On = Link Effect G's memory with Effect E/F. Also
-							Gxx with an instrument present will cause the
-							envelopes to be retriggered. If you change a
-							sample on a row with Gxx, it'll adjust the
-							frequency of the current note according to:
-
-							  NewFrequency = OldFrequency * NewC5 / OldC5;
-*/
-
-
-
-/* These #defines are TEMPORARY. They are used to write alternative code to
- * handle ambiguities in the format specification. The correct code in each
- * case will be determined most likely by experimentation.
- */
-#define STEREO_SAMPLES_COUNT_AS_TWO
-#define INVALID_ORDERS_END_SONG
-#define INVALID_NOTES_CAUSE_NOTE_CUT
-#define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP
-#define VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
-
-
-
-#define SIGTYPE_IT DUMB_ID('I', 'T', ' ', ' ')
-
-#define IT_SIGNATURE            DUMB_ID('I', 'M', 'P', 'M')
-#define IT_INSTRUMENT_SIGNATURE DUMB_ID('I', 'M', 'P', 'I')
-#define IT_SAMPLE_SIGNATURE     DUMB_ID('I', 'M', 'P', 'S')
-
-
-
- /* 1 minute per 4 rows, each row 6 ticks; this is divided by the tempo to get
-  * the interval between ticks.
-  */
-#define TICK_TIME_DIVIDEND ((65536 * 60) / (4 * 6))
-
-
-
-  /* I'm not going to try to explain this, because I didn't derive it very
-   * formally ;)
-   */
-   /* #define AMIGA_DIVISOR ((float)(4.0 * 14317056.0)) */
-   /* I believe the following one to be more accurate. */
-#define AMIGA_DIVISOR ((float)(8.0 * 7159090.5))
-
-
-
-typedef struct IT_MIDI IT_MIDI;
-typedef struct IT_FILTER_STATE IT_FILTER_STATE;
-typedef struct IT_ENVELOPE IT_ENVELOPE;
-typedef struct IT_INSTRUMENT IT_INSTRUMENT;
-typedef struct IT_SAMPLE IT_SAMPLE;
-typedef struct IT_ENTRY IT_ENTRY;
-typedef struct IT_PATTERN IT_PATTERN;
-typedef struct IT_PLAYING_ENVELOPE IT_PLAYING_ENVELOPE;
-typedef struct IT_PLAYING IT_PLAYING;
-typedef struct IT_CHANNEL IT_CHANNEL;
-typedef struct IT_CHECKPOINT IT_CHECKPOINT;
-typedef struct IT_CALLBACKS IT_CALLBACKS;
-
-
-
-struct IT_MIDI {
-	unsigned char SFmacro[16][16]; // read these from 0x120
-	unsigned char SFmacrolen[16];
-	unsigned short SFmacroz[16]; /* Bitfield; bit 0 set = z in first position */
-	unsigned char Zmacro[128][16]; // read these from 0x320
-	unsigned char Zmacrolen[128];
-};
-
-
-
-struct IT_FILTER_STATE {
-	float currsample, prevsample;
-};
-
-
-
-#define IT_ENVELOPE_ON                1
-#define IT_ENVELOPE_LOOP_ON           2
-#define IT_ENVELOPE_SUSTAIN_LOOP      4
-#define IT_ENVELOPE_PITCH_IS_FILTER 128
-
-struct IT_ENVELOPE {
-	unsigned char flags;
-	unsigned char n_nodes;
-	unsigned char loop_start;
-	unsigned char loop_end;
-	unsigned char sus_loop_start;
-	unsigned char sus_loop_end;
-	signed char node_y[25];
-	unsigned short node_t[25];
-};
-
-
-
-#define NNA_NOTE_CUT      0
-#define NNA_NOTE_CONTINUE 1
-#define NNA_NOTE_OFF      2
-#define NNA_NOTE_FADE     3
-
-#define DCT_OFF        0
-#define DCT_NOTE       1
-#define DCT_SAMPLE     2
-#define DCT_INSTRUMENT 3
-
-#define DCA_NOTE_CUT  0
-#define DCA_NOTE_OFF  1
-#define DCA_NOTE_FADE 2
-
-struct IT_INSTRUMENT {
-	int fadeout;
-
-	IT_ENVELOPE volume_envelope;
-	IT_ENVELOPE pan_envelope;
-	IT_ENVELOPE pitch_envelope;
-
-	unsigned char new_note_action;
-	unsigned char dup_check_type;
-	unsigned char dup_check_action;
-	unsigned char pp_separation;
-	unsigned char pp_centre;
-	unsigned char global_volume;
-	unsigned char default_pan;
-	unsigned char random_volume;
-	unsigned char random_pan;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned char map_note[120];
-	unsigned short map_sample[120];
-};
-
-
-
-#define IT_SAMPLE_EXISTS              1
-#define IT_SAMPLE_16BIT               2
-#define IT_SAMPLE_STEREO              4
-#define IT_SAMPLE_LOOP               16
-#define IT_SAMPLE_SUS_LOOP           32
-#define IT_SAMPLE_PINGPONG_LOOP      64
-#define IT_SAMPLE_PINGPONG_SUS_LOOP 128
-
-#define IT_VIBRATO_SINE     0
-#define IT_VIBRATO_SAWTOOTH 1 /* Ramp down */
-#define IT_VIBRATO_SQUARE   2
-#define IT_VIBRATO_RANDOM   3
-
-struct IT_SAMPLE {
-	unsigned char flags;
-	unsigned char global_volume;
-	unsigned char default_volume;
-	unsigned char default_pan;
-
-	long length;
-	long loop_start;
-	long loop_end;
-	long C5_speed;
-	long sus_loop_start;
-	long sus_loop_end;
-
-	unsigned char vibrato_speed;
-	unsigned char vibrato_depth;
-	unsigned char vibrato_rate;
-	unsigned char vibrato_waveform;
-
-	sample_t *left;
-	sample_t *right;
-};
-
-
-
-#define IT_ENTRY_NOTE       1
-#define IT_ENTRY_INSTRUMENT 2
-#define IT_ENTRY_VOLPAN     4
-#define IT_ENTRY_EFFECT     8
-
-#define IT_SET_END_ROW(entry) ((entry)->channel = 255)
-#define IT_IS_END_ROW(entry) ((entry)->channel >= DUMB_IT_N_CHANNELS)
-
-#define IT_NOTE_OFF 255
-#define IT_NOTE_CUT 254
-
-#define IT_ENVELOPE_SHIFT 8
-
-#define IT_SURROUND 100
-#define IT_IS_SURROUND(pan) ((pan) > 64)
-#define IT_IS_SURROUND_SHIFTED(pan) ((pan) > 64 << IT_ENVELOPE_SHIFT)
-
-#define IT_SET_SPEED              1
-#define IT_JUMP_TO_ORDER          2
-#define IT_BREAK_TO_ROW           3
-#define IT_VOLUME_SLIDE           4
-#define IT_PORTAMENTO_DOWN        5
-#define IT_PORTAMENTO_UP          6
-#define IT_TONE_PORTAMENTO        7
-#define IT_VIBRATO                8
-#define IT_TREMOR                 9
-#define IT_ARPEGGIO              10
-#define IT_VOLSLIDE_VIBRATO      11
-#define IT_VOLSLIDE_TONEPORTA    12
-#define IT_SET_CHANNEL_VOLUME    13
-#define IT_CHANNEL_VOLUME_SLIDE  14
-#define IT_SET_SAMPLE_OFFSET     15
-#define IT_PANNING_SLIDE         16
-#define IT_RETRIGGER_NOTE        17
-#define IT_TREMOLO               18
-#define IT_S                     19
-#define IT_SET_SONG_TEMPO        20
-#define IT_FINE_VIBRATO          21
-#define IT_SET_GLOBAL_VOLUME     22
-#define IT_GLOBAL_VOLUME_SLIDE   23
-#define IT_SET_PANNING           24
-#define IT_PANBRELLO             25
-#define IT_MIDI_MACRO            26 //see MIDI.TXT
-
-/* Some effects needed for XM compatibility */
-#define IT_XM_PORTAMENTO_DOWN    27
-#define IT_XM_PORTAMENTO_UP      28
-#define IT_XM_FINE_VOLSLIDE_DOWN 29
-#define IT_XM_FINE_VOLSLIDE_UP   30
-#define IT_XM_RETRIGGER_NOTE     31
-
-#define IT_N_EFFECTS             32
-
-/* These represent the top nibble of the command value. */
-#define IT_S_SET_FILTER              0 /* Greyed out in IT... */
-#define IT_S_SET_GLISSANDO_CONTROL   1 /* Greyed out in IT... */
-#define IT_S_FINETUNE                2 /* Greyed out in IT... */
-#define IT_S_SET_VIBRATO_WAVEFORM    3
-#define IT_S_SET_TREMOLO_WAVEFORM    4
-#define IT_S_SET_PANBRELLO_WAVEFORM  5
-#define IT_S_FINE_PATTERN_DELAY      6
-#define IT_S7                        7
-#define IT_S_SET_PAN                 8
-#define IT_S_SET_SURROUND_SOUND      9
-#define IT_S_SET_HIGH_OFFSET        10
-#define IT_S_PATTERN_LOOP           11
-#define IT_S_DELAYED_NOTE_CUT       12
-#define IT_S_NOTE_DELAY             13
-#define IT_S_PATTERN_DELAY          14
-#define IT_S_SET_MIDI_MACRO         15
-
-/*
-S0x Set filter
-S1x Set glissando control
-S2x Set finetune
-
-
-S3x Set vibrato waveform to type x
-S4x Set tremelo waveform to type x
-S5x Set panbrello waveform to type x
-  Waveforms for commands S3x, S4x and S5x:
-	0: Sine wave
-	1: Ramp down
-	2: Square wave
-	3: Random wave
-S6x Pattern delay for x ticks
-S70 Past note cut
-S71 Past note off
-S72 Past note fade
-S73 Set NNA to note cut
-S74 Set NNA to continue
-S75 Set NNA to note off
-S76 Set NNA to note fade
-S77 Turn off volume envelope
-S78 Turn on volume envelope
-S79 Turn off panning envelope
-S7A Turn on panning envelope
-S7B Turn off pitch envelope
-S7C Turn on pitch envelope
-S8x Set panning position
-S91 Set surround sound
-SAy Set high value of sample offset yxx00h
-SB0 Set loopback point
-SBx Loop x times to loopback point
-SCx Note cut after x ticks
-SDx Note delay for x ticks
-SEx Pattern delay for x rows
-SFx Set parameterised MIDI Macro
-*/
-
-struct IT_ENTRY {
-	unsigned char channel; /* End of row if channel >= DUMB_IT_N_CHANNELS */
-	unsigned char mask;
-	unsigned char note;
-	unsigned char instrument;
-	unsigned char volpan;
-	unsigned char effect;
-	unsigned char effectvalue;
-};
-
-
-
-struct IT_PATTERN {
-	int n_rows;
-	int n_entries;
-	IT_ENTRY *entry;
-};
-
-
-
-#define IT_STEREO            1
-#define IT_USE_INSTRUMENTS   4
-#define IT_LINEAR_SLIDES     8 /* If not set, use Amiga slides */
-#define IT_OLD_EFFECTS      16
-#define IT_COMPATIBLE_GXX   32
-
-/* Make sure IT_WAS_AN_XM and IT_WAS_A_MOD aren't set accidentally */
-#define IT_REAL_FLAGS       63
-
-#define IT_WAS_AN_XM        64 /* Set for both XMs and MODs */
-#define IT_WAS_A_MOD       128
-
-#define IT_ORDER_END  255
-#define IT_ORDER_SKIP 254
-
-struct DUMB_IT_SIGDATA {
-	int n_orders;
-	int n_instruments;
-	int n_samples;
-	int n_patterns;
-
-	int flags;
-
-	int global_volume;
-	int mixing_volume;
-	int speed;
-	int tempo;
-	int pan_separation;
-
-	unsigned char channel_pan[DUMB_IT_N_CHANNELS];
-	unsigned char channel_volume[DUMB_IT_N_CHANNELS];
-
-	unsigned char *order;
-	unsigned char restart_position; /* for XM compatiblity */
-
-	IT_INSTRUMENT *instrument;
-	IT_SAMPLE *sample;
-	IT_PATTERN *pattern;
-
-	IT_MIDI *midi;
-
-	IT_CHECKPOINT *checkpoint;
-};
-
-
-
-struct IT_PLAYING_ENVELOPE {
-	int next_node;
-	int tick;
-};
-
-
-
-#define IT_PLAYING_BACKGROUND 1
-#define IT_PLAYING_SUSTAINOFF 2
-#define IT_PLAYING_FADING     4
-#define IT_PLAYING_DEAD       8
-
-struct IT_PLAYING {
-	int flags;
-
-	IT_CHANNEL *channel;
-	IT_SAMPLE *sample;
-	IT_INSTRUMENT *instrument;
-	IT_INSTRUMENT *env_instrument;
-
-	unsigned short sampnum;
-	unsigned char instnum;
-
-	unsigned char channel_volume;
-
-	unsigned char volume;
-	unsigned short pan;
-
-	unsigned char note;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned short true_filter_cutoff;   /* These incorporate the filter envelope, and will not */
-	unsigned char true_filter_resonance; /* be changed if they would be set to 127<<8 and 0.    */
-
-	unsigned char vibrato_speed;
-	unsigned char vibrato_depth;
-	unsigned char vibrato_n; /* May be specified twice: volpan & effect. */
-	unsigned char vibrato_time;
-
-	unsigned char tremolo_speed;
-	unsigned char tremolo_depth;
-	unsigned char tremolo_time;
-
-	unsigned char sample_vibrato_time;
-	int sample_vibrato_depth; /* Starts at rate?0:depth, increases by rate */
-
-	int slide;
-	float delta;
-
-	IT_PLAYING_ENVELOPE volume_envelope;
-	IT_PLAYING_ENVELOPE pan_envelope;
-	IT_PLAYING_ENVELOPE pitch_envelope;
-
-	int fadeoutcount;
-
-	IT_FILTER_STATE filter_state[2]; /* Left and right */
-
-	DUMB_RESAMPLER resampler[2];
-
-	/* time_lost is used to emulate Impulse Tracker's sample looping
-	 * characteristics. When time_lost is added to pos, the result represents
-	 * the position in the theoretical version of the sample where all loops
-	 * have been expanded. If this is stored, the resampling helpers will
-	 * safely convert it for use with new loop boundaries. The situation is
-	 * slightly more complicated if dir == -1 when the change takes place; we
-	 * must reflect pos off the loop end point and set dir to 1 before
-	 * proceeding.
-	 */
-	long time_lost;
-};
-
-
-
-#define IT_CHANNEL_MUTED 1
-
-struct IT_CHANNEL {
-	int flags;
-
-	unsigned char volume;
-	signed char volslide;
-	signed char xm_volslide;
-
-	/* xm_volslide is used for volume slides done in the volume column in an
-	 * XM file, since it seems the volume column slide is applied first,
-	 * followed by clamping, followed by the effects column slide. IT does
-	 * not exhibit this behaviour, so xm_volslide is maintained at zero.
-	 */
-
-	unsigned char pan;
-	unsigned short truepan;
-
-	unsigned char channelvolume;
-	signed char channelvolslide;
-
-	unsigned char instrument;
-	unsigned char note;
-
-	unsigned char SFmacro;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned char note_cut_count;
-	unsigned char note_delay_count;
-	IT_ENTRY *note_delay_entry;
-
-	int arpeggio;
-	unsigned char retrig;
-	unsigned char xm_retrig;
-	int retrig_tick;
-
-	unsigned char tremor;
-	unsigned char tremor_time; /* Bit 6 set if note on; bit 7 set if tremor active. */
-
-	int portamento;
-	int toneporta;
-	unsigned char destnote;
-
-	/** WARNING - for neatness, should one or both of these be in the IT_PLAYING struct? */
-	unsigned short sample;
-	unsigned char truenote;
-
-	unsigned char midi_state;
-
-	signed char lastvolslide;
-	unsigned char lastDKL;
-	unsigned char lastEF; /* Doubles as last portamento up for XM files */
-	unsigned char lastG;
-	unsigned char lastHspeed;
-	unsigned char lastHdepth;
-	unsigned char lastRspeed;
-	unsigned char lastRdepth;
-	unsigned char lastI;
-	unsigned char lastJ; /* Doubles as last portamento down for XM files */
-	unsigned char lastN;
-	unsigned char lastO;
-	unsigned char high_offset;
-	unsigned char lastQ;
-	unsigned char lastS;
-	unsigned char pat_loop_row;
-	unsigned char pat_loop_count;
-	unsigned char lastW;
-
-	unsigned char xm_lastE1;
-	unsigned char xm_lastE2;
-	unsigned char xm_lastEA;
-	unsigned char xm_lastEB;
-	unsigned char xm_lastX1;
-	unsigned char xm_lastX2;
-
-	IT_PLAYING *playing;
-};
-
-
-
-struct DUMB_IT_SIGRENDERER {
-	DUMB_IT_SIGDATA *sigdata;
-
-	int n_channels;
-
-	unsigned char globalvolume;
-	signed char globalvolslide;
-
-	unsigned char tempo;
-	signed char temposlide;
-
-	IT_CHANNEL channel[DUMB_IT_N_CHANNELS];
-
-	IT_PLAYING *playing[DUMB_IT_N_NNA_CHANNELS];
-
-	int tick;
-	int speed;
-	int rowcount;
-
-	int order; /* Set to -1 if the song is terminated by a callback. */
-	int row;
-	int processorder;
-	int processrow;
-	int breakrow;
-	int pat_loop_row;
-
-	int n_rows;
-
-	IT_ENTRY *entry_start;
-	IT_ENTRY *entry;
-	IT_ENTRY *entry_end;
-
-	long time_left; /* Time before the next tick is processed */
-	int sub_time_left;
-
-	DUMB_CLICK_REMOVER **click_remover;
-
-	IT_CALLBACKS *callbacks;
-};
-
-
-
-struct IT_CHECKPOINT {
-	IT_CHECKPOINT *next;
-	long time;
-	DUMB_IT_SIGRENDERER *sigrenderer;
-};
-
-
-
-struct IT_CALLBACKS {
-	int (*loop)(void *data);
-	void *loop_data;
-	/* Return 1 to prevent looping; the music will terminate abruptly. If you
-	 * want to make the music stop but allow samples to fade (beware, as they
-	 * might not fade at all!), use dumb_it_sr_set_speed() and set the speed
-	 * to 0. Note that xm_speed_zero() will not be called if you set the
-	 * speed manually, and also that this will work for IT and S3M files even
-	 * though the music can't stop in this way by itself.
-	 */
-
-	int (*xm_speed_zero)(void *data);
-	void *xm_speed_zero_data;
-	/* Return 1 to terminate the mod, without letting samples fade. */
-
-	int (*midi)(void *data, int channel, unsigned char byte);
-	void *midi_data;
-	/* Return 1 to prevent DUMB from subsequently interpreting the MIDI bytes
-	 * itself. In other words, return 1 if the Zxx macros in an IT file are
-	 * controlling filters and shouldn't be.
-	 */
-};
-
-
-
-void _dumb_it_end_sigrenderer(sigrenderer_t *sigrenderer);
-void _dumb_it_unload_sigdata(sigdata_t *vsigdata);
-
-extern DUH_SIGTYPE_DESC _dumb_sigtype_it;
-
-
-
-long _dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata);
-
-
-
-#define XM_APPREGIO                0
-#define XM_PORTAMENTO_UP           1
-#define XM_PORTAMENTO_DOWN         2
-#define XM_TONE_PORTAMENTO         3
-#define XM_VIBRATO                 4
-#define XM_VOLSLIDE_TONEPORTA      5
-#define XM_VOLSLIDE_VIBRATO        6
-#define XM_TREMOLO                 7
-#define XM_SET_PANNING             8
-#define XM_SAMPLE_OFFSET           9
-#define XM_VOLUME_SLIDE            10 /* A */
-#define XM_POSITION_JUMP           11 /* B */
-#define XM_SET_CHANNEL_VOLUME      12 /* C */
-#define XM_PATTERN_BREAK           13 /* D */
-#define XM_E                       14 /* E */
-#define XM_SET_TEMPO_BPM           15 /* F */
-#define XM_SET_GLOBAL_VOLUME       16 /* G */
-#define XM_GLOBAL_VOLUME_SLIDE     17 /* H */
-#define XM_KEY_OFF                 20 /* K (undocumented) */
-#define XM_SET_ENVELOPE_POSITION   21 /* L */
-#define XM_PANNING_SLIDE           25 /* P */
-#define XM_MULTI_RETRIG            27 /* R */
-#define XM_TREMOR                  29 /* T */
-#define XM_X                       33 /* X */
-#define XM_N_EFFECTS               (10+26)
-
-#define XM_E_SET_FILTER            0x0
-#define XM_E_FINE_PORTA_UP         0x1
-#define XM_E_FINE_PORTA_DOWN       0x2
-#define XM_E_SET_GLISSANDO_CONTROL 0x3
-#define XM_E_SET_VIBRATO_CONTROL   0x4
-#define XM_E_SET_FINETUNE          0x5
-#define XM_E_SET_LOOP              0x6
-#define XM_E_SET_TREMOLO_CONTROL   0x7
-#define XM_E_RETRIG_NOTE           0x9
-#define XM_E_FINE_VOLSLIDE_UP      0xA
-#define XM_E_FINE_VOLSLIDE_DOWN    0xB
-#define XM_E_NOTE_CUT              0xC
-#define XM_E_NOTE_DELAY            0xD
-#define XM_E_PATTERN_DELAY         0xE
-
-#define XM_X_EXTRAFINE_PORTA_UP    1
-#define XM_X_EXTRAFINE_PORTA_DOWN  2
-
-/* To make my life a bit simpler during conversion, effect E:xy is converted
- * to effect number EBASE+x:y. The same applies to effect X, and IT's S. That
- * way, these effects can be manipulated like regular effects.
- */
-#define EBASE              (XM_N_EFFECTS)
-#define XBASE              (EBASE+16)
-#define SBASE              (IT_N_EFFECTS)
-
-#define EFFECT_VALUE(x, y) (((x)<<4)|(y))
-#define HIGH(v)            ((v)>>4)
-#define LOW(v)             ((v)&0x0F)
-#define SET_HIGH(v, x)     v = (((x)<<4)|((v)&0x0F))
-#define SET_LOW(v, y)      v = (((v)&0xF0)|(y))
-#define BCD_TO_NORMAL(v)   (HIGH(v)*10+LOW(v))
-
-
-
-#if 0
-unsigned char **_dumb_malloc2(int w, int h);
-void _dumb_free2(unsigned char **line);
-#endif
-
-void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry);
-int _dumb_it_fix_invalid_orders(DUMB_IT_SIGDATA *sigdata);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/dumb-0.9.2/it/it.h b/engines/ags/lib/dumb-0.9.2/it/it.h
deleted file mode 100644
index bf19d3703b..0000000000
--- a/engines/ags/lib/dumb-0.9.2/it/it.h
+++ /dev/null
@@ -1,714 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * internal/it.h - Internal stuff for IT playback     / / \  \
- *                 and MOD/XM/S3M conversion.        | <  /   \_
- *                                                   |  \/ /\   /
- *                                                    \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#ifndef AGS_LIB_DUMB_INTERNAL_IT_H
-#define AGS_LIB_DUMB_INTERNAL_IT_H
-
-namespace AGS3 {
-
-/** TO DO: THINK ABOUT THE FOLLOWING:
-
-sigdata->flags & IT_COMPATIBLE_GXX
-
-				Bit 5: On = Link Effect G's memory with Effect E/F. Also
-							Gxx with an instrument present will cause the
-							envelopes to be retriggered. If you change a
-							sample on a row with Gxx, it'll adjust the
-							frequency of the current note according to:
-
-							  NewFrequency = OldFrequency * NewC5 / OldC5;
-*/
-
-
-
-/* These #defines are TEMPORARY. They are used to write alternative code to
- * handle ambiguities in the format specification. The correct code in each
- * case will be determined most likely by experimentation.
- */
-#define STEREO_SAMPLES_COUNT_AS_TWO
-#define INVALID_ORDERS_END_SONG
-#define INVALID_NOTES_CAUSE_NOTE_CUT
-#define SUSTAIN_LOOP_OVERRIDES_NORMAL_LOOP
-#define VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
-
-
-
-#define SIGTYPE_IT DUMB_ID('I', 'T', ' ', ' ')
-
-#define IT_SIGNATURE            DUMB_ID('I', 'M', 'P', 'M')
-#define IT_INSTRUMENT_SIGNATURE DUMB_ID('I', 'M', 'P', 'I')
-#define IT_SAMPLE_SIGNATURE     DUMB_ID('I', 'M', 'P', 'S')
-
-
-
- /* 1 minute per 4 rows, each row 6 ticks; this is divided by the tempo to get
-  * the interval between ticks.
-  */
-#define TICK_TIME_DIVIDEND ((65536 * 60) / (4 * 6))
-
-
-
-  /* I'm not going to try to explain this, because I didn't derive it very
-   * formally ;)
-   */
-   /* #define AMIGA_DIVISOR ((float)(4.0 * 14317056.0)) */
-   /* I believe the following one to be more accurate. */
-#define AMIGA_DIVISOR ((float)(8.0 * 7159090.5))
-
-
-
-typedef struct IT_MIDI IT_MIDI;
-typedef struct IT_FILTER_STATE IT_FILTER_STATE;
-typedef struct IT_ENVELOPE IT_ENVELOPE;
-typedef struct IT_INSTRUMENT IT_INSTRUMENT;
-typedef struct IT_SAMPLE IT_SAMPLE;
-typedef struct IT_ENTRY IT_ENTRY;
-typedef struct IT_PATTERN IT_PATTERN;
-typedef struct IT_PLAYING_ENVELOPE IT_PLAYING_ENVELOPE;
-typedef struct IT_PLAYING IT_PLAYING;
-typedef struct IT_CHANNEL IT_CHANNEL;
-typedef struct IT_CHECKPOINT IT_CHECKPOINT;
-typedef struct IT_CALLBACKS IT_CALLBACKS;
-
-
-
-struct IT_MIDI {
-	unsigned char SFmacro[16][16]; // read these from 0x120
-	unsigned char SFmacrolen[16];
-	unsigned short SFmacroz[16]; /* Bitfield; bit 0 set = z in first position */
-	unsigned char Zmacro[128][16]; // read these from 0x320
-	unsigned char Zmacrolen[128];
-};
-
-
-
-struct IT_FILTER_STATE {
-	float currsample, prevsample;
-};
-
-
-
-#define IT_ENVELOPE_ON                1
-#define IT_ENVELOPE_LOOP_ON           2
-#define IT_ENVELOPE_SUSTAIN_LOOP      4
-#define IT_ENVELOPE_PITCH_IS_FILTER 128
-
-struct IT_ENVELOPE {
-	unsigned char flags;
-	unsigned char n_nodes;
-	unsigned char loop_start;
-	unsigned char loop_end;
-	unsigned char sus_loop_start;
-	unsigned char sus_loop_end;
-	signed char node_y[25];
-	unsigned short node_t[25];
-};
-
-
-
-#define NNA_NOTE_CUT      0
-#define NNA_NOTE_CONTINUE 1
-#define NNA_NOTE_OFF      2
-#define NNA_NOTE_FADE     3
-
-#define DCT_OFF        0
-#define DCT_NOTE       1
-#define DCT_SAMPLE     2
-#define DCT_INSTRUMENT 3
-
-#define DCA_NOTE_CUT  0
-#define DCA_NOTE_OFF  1
-#define DCA_NOTE_FADE 2
-
-struct IT_INSTRUMENT {
-	int fadeout;
-
-	IT_ENVELOPE volume_envelope;
-	IT_ENVELOPE pan_envelope;
-	IT_ENVELOPE pitch_envelope;
-
-	unsigned char new_note_action;
-	unsigned char dup_check_type;
-	unsigned char dup_check_action;
-	unsigned char pp_separation;
-	unsigned char pp_centre;
-	unsigned char global_volume;
-	unsigned char default_pan;
-	unsigned char random_volume;
-	unsigned char random_pan;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned char map_note[120];
-	unsigned short map_sample[120];
-};
-
-
-
-#define IT_SAMPLE_EXISTS              1
-#define IT_SAMPLE_16BIT               2
-#define IT_SAMPLE_STEREO              4
-#define IT_SAMPLE_LOOP               16
-#define IT_SAMPLE_SUS_LOOP           32
-#define IT_SAMPLE_PINGPONG_LOOP      64
-#define IT_SAMPLE_PINGPONG_SUS_LOOP 128
-
-#define IT_VIBRATO_SINE     0
-#define IT_VIBRATO_SAWTOOTH 1 /* Ramp down */
-#define IT_VIBRATO_SQUARE   2
-#define IT_VIBRATO_RANDOM   3
-
-struct IT_SAMPLE {
-	unsigned char flags;
-	unsigned char global_volume;
-	unsigned char default_volume;
-	unsigned char default_pan;
-
-	long length;
-	long loop_start;
-	long loop_end;
-	long C5_speed;
-	long sus_loop_start;
-	long sus_loop_end;
-
-	unsigned char vibrato_speed;
-	unsigned char vibrato_depth;
-	unsigned char vibrato_rate;
-	unsigned char vibrato_waveform;
-
-	sample_t *left;
-	sample_t *right;
-};
-
-
-
-#define IT_ENTRY_NOTE       1
-#define IT_ENTRY_INSTRUMENT 2
-#define IT_ENTRY_VOLPAN     4
-#define IT_ENTRY_EFFECT     8
-
-#define IT_SET_END_ROW(entry) ((entry)->channel = 255)
-#define IT_IS_END_ROW(entry) ((entry)->channel >= DUMB_IT_N_CHANNELS)
-
-#define IT_NOTE_OFF 255
-#define IT_NOTE_CUT 254
-
-#define IT_ENVELOPE_SHIFT 8
-
-#define IT_SURROUND 100
-#define IT_IS_SURROUND(pan) ((pan) > 64)
-#define IT_IS_SURROUND_SHIFTED(pan) ((pan) > 64 << IT_ENVELOPE_SHIFT)
-
-#define IT_SET_SPEED              1
-#define IT_JUMP_TO_ORDER          2
-#define IT_BREAK_TO_ROW           3
-#define IT_VOLUME_SLIDE           4
-#define IT_PORTAMENTO_DOWN        5
-#define IT_PORTAMENTO_UP          6
-#define IT_TONE_PORTAMENTO        7
-#define IT_VIBRATO                8
-#define IT_TREMOR                 9
-#define IT_ARPEGGIO              10
-#define IT_VOLSLIDE_VIBRATO      11
-#define IT_VOLSLIDE_TONEPORTA    12
-#define IT_SET_CHANNEL_VOLUME    13
-#define IT_CHANNEL_VOLUME_SLIDE  14
-#define IT_SET_SAMPLE_OFFSET     15
-#define IT_PANNING_SLIDE         16
-#define IT_RETRIGGER_NOTE        17
-#define IT_TREMOLO               18
-#define IT_S                     19
-#define IT_SET_SONG_TEMPO        20
-#define IT_FINE_VIBRATO          21
-#define IT_SET_GLOBAL_VOLUME     22
-#define IT_GLOBAL_VOLUME_SLIDE   23
-#define IT_SET_PANNING           24
-#define IT_PANBRELLO             25
-#define IT_MIDI_MACRO            26 //see MIDI.TXT
-
-/* Some effects needed for XM compatibility */
-#define IT_XM_PORTAMENTO_DOWN    27
-#define IT_XM_PORTAMENTO_UP      28
-#define IT_XM_FINE_VOLSLIDE_DOWN 29
-#define IT_XM_FINE_VOLSLIDE_UP   30
-#define IT_XM_RETRIGGER_NOTE     31
-
-#define IT_N_EFFECTS             32
-
-/* These represent the top nibble of the command value. */
-#define IT_S_SET_FILTER              0 /* Greyed out in IT... */
-#define IT_S_SET_GLISSANDO_CONTROL   1 /* Greyed out in IT... */
-#define IT_S_FINETUNE                2 /* Greyed out in IT... */
-#define IT_S_SET_VIBRATO_WAVEFORM    3
-#define IT_S_SET_TREMOLO_WAVEFORM    4
-#define IT_S_SET_PANBRELLO_WAVEFORM  5
-#define IT_S_FINE_PATTERN_DELAY      6
-#define IT_S7                        7
-#define IT_S_SET_PAN                 8
-#define IT_S_SET_SURROUND_SOUND      9
-#define IT_S_SET_HIGH_OFFSET        10
-#define IT_S_PATTERN_LOOP           11
-#define IT_S_DELAYED_NOTE_CUT       12
-#define IT_S_NOTE_DELAY             13
-#define IT_S_PATTERN_DELAY          14
-#define IT_S_SET_MIDI_MACRO         15
-
-/*
-S0x Set filter
-S1x Set glissando control
-S2x Set finetune
-
-
-S3x Set vibrato waveform to type x
-S4x Set tremelo waveform to type x
-S5x Set panbrello waveform to type x
-  Waveforms for commands S3x, S4x and S5x:
-	0: Sine wave
-	1: Ramp down
-	2: Square wave
-	3: Random wave
-S6x Pattern delay for x ticks
-S70 Past note cut
-S71 Past note off
-S72 Past note fade
-S73 Set NNA to note cut
-S74 Set NNA to continue
-S75 Set NNA to note off
-S76 Set NNA to note fade
-S77 Turn off volume envelope
-S78 Turn on volume envelope
-S79 Turn off panning envelope
-S7A Turn on panning envelope
-S7B Turn off pitch envelope
-S7C Turn on pitch envelope
-S8x Set panning position
-S91 Set surround sound
-SAy Set high value of sample offset yxx00h
-SB0 Set loopback point
-SBx Loop x times to loopback point
-SCx Note cut after x ticks
-SDx Note delay for x ticks
-SEx Pattern delay for x rows
-SFx Set parameterised MIDI Macro
-*/
-
-struct IT_ENTRY {
-	unsigned char channel; /* End of row if channel >= DUMB_IT_N_CHANNELS */
-	unsigned char mask;
-	unsigned char note;
-	unsigned char instrument;
-	unsigned char volpan;
-	unsigned char effect;
-	unsigned char effectvalue;
-};
-
-
-
-struct IT_PATTERN {
-	int n_rows;
-	int n_entries;
-	IT_ENTRY *entry;
-};
-
-
-
-#define IT_STEREO            1
-#define IT_USE_INSTRUMENTS   4
-#define IT_LINEAR_SLIDES     8 /* If not set, use Amiga slides */
-#define IT_OLD_EFFECTS      16
-#define IT_COMPATIBLE_GXX   32
-
-/* Make sure IT_WAS_AN_XM and IT_WAS_A_MOD aren't set accidentally */
-#define IT_REAL_FLAGS       63
-
-#define IT_WAS_AN_XM        64 /* Set for both XMs and MODs */
-#define IT_WAS_A_MOD       128
-
-#define IT_ORDER_END  255
-#define IT_ORDER_SKIP 254
-
-struct DUMB_IT_SIGDATA {
-	int n_orders;
-	int n_instruments;
-	int n_samples;
-	int n_patterns;
-
-	int flags;
-
-	int global_volume;
-	int mixing_volume;
-	int speed;
-	int tempo;
-	int pan_separation;
-
-	unsigned char channel_pan[DUMB_IT_N_CHANNELS];
-	unsigned char channel_volume[DUMB_IT_N_CHANNELS];
-
-	unsigned char *order;
-	unsigned char restart_position; /* for XM compatiblity */
-
-	IT_INSTRUMENT *instrument;
-	IT_SAMPLE *sample;
-	IT_PATTERN *pattern;
-
-	IT_MIDI *midi;
-
-	IT_CHECKPOINT *checkpoint;
-};
-
-
-
-struct IT_PLAYING_ENVELOPE {
-	int next_node;
-	int tick;
-};
-
-
-
-#define IT_PLAYING_BACKGROUND 1
-#define IT_PLAYING_SUSTAINOFF 2
-#define IT_PLAYING_FADING     4
-#define IT_PLAYING_DEAD       8
-
-struct IT_PLAYING {
-	int flags;
-
-	IT_CHANNEL *channel;
-	IT_SAMPLE *sample;
-	IT_INSTRUMENT *instrument;
-	IT_INSTRUMENT *env_instrument;
-
-	unsigned short sampnum;
-	unsigned char instnum;
-
-	unsigned char channel_volume;
-
-	unsigned char volume;
-	unsigned short pan;
-
-	unsigned char note;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned short true_filter_cutoff;   /* These incorporate the filter envelope, and will not */
-	unsigned char true_filter_resonance; /* be changed if they would be set to 127<<8 and 0.    */
-
-	unsigned char vibrato_speed;
-	unsigned char vibrato_depth;
-	unsigned char vibrato_n; /* May be specified twice: volpan & effect. */
-	unsigned char vibrato_time;
-
-	unsigned char tremolo_speed;
-	unsigned char tremolo_depth;
-	unsigned char tremolo_time;
-
-	unsigned char sample_vibrato_time;
-	int sample_vibrato_depth; /* Starts at rate?0:depth, increases by rate */
-
-	int slide;
-	float delta;
-
-	IT_PLAYING_ENVELOPE volume_envelope;
-	IT_PLAYING_ENVELOPE pan_envelope;
-	IT_PLAYING_ENVELOPE pitch_envelope;
-
-	int fadeoutcount;
-
-	IT_FILTER_STATE filter_state[2]; /* Left and right */
-
-	DUMB_RESAMPLER resampler[2];
-
-	/* time_lost is used to emulate Impulse Tracker's sample looping
-	 * characteristics. When time_lost is added to pos, the result represents
-	 * the position in the theoretical version of the sample where all loops
-	 * have been expanded. If this is stored, the resampling helpers will
-	 * safely convert it for use with new loop boundaries. The situation is
-	 * slightly more complicated if dir == -1 when the change takes place; we
-	 * must reflect pos off the loop end point and set dir to 1 before
-	 * proceeding.
-	 */
-	long time_lost;
-};
-
-
-
-#define IT_CHANNEL_MUTED 1
-
-struct IT_CHANNEL {
-	int flags;
-
-	unsigned char volume;
-	signed char volslide;
-	signed char xm_volslide;
-
-	/* xm_volslide is used for volume slides done in the volume column in an
-	 * XM file, since it seems the volume column slide is applied first,
-	 * followed by clamping, followed by the effects column slide. IT does
-	 * not exhibit this behaviour, so xm_volslide is maintained at zero.
-	 */
-
-	unsigned char pan;
-	unsigned short truepan;
-
-	unsigned char channelvolume;
-	signed char channelvolslide;
-
-	unsigned char instrument;
-	unsigned char note;
-
-	unsigned char SFmacro;
-
-	unsigned char filter_cutoff;
-	unsigned char filter_resonance;
-
-	unsigned char note_cut_count;
-	unsigned char note_delay_count;
-	IT_ENTRY *note_delay_entry;
-
-	int arpeggio;
-	unsigned char retrig;
-	unsigned char xm_retrig;
-	int retrig_tick;
-
-	unsigned char tremor;
-	unsigned char tremor_time; /* Bit 6 set if note on; bit 7 set if tremor active. */
-
-	int portamento;
-	int toneporta;
-	unsigned char destnote;
-
-	/** WARNING - for neatness, should one or both of these be in the IT_PLAYING struct? */
-	unsigned short sample;
-	unsigned char truenote;
-
-	unsigned char midi_state;
-
-	signed char lastvolslide;
-	unsigned char lastDKL;
-	unsigned char lastEF; /* Doubles as last portamento up for XM files */
-	unsigned char lastG;
-	unsigned char lastHspeed;
-	unsigned char lastHdepth;
-	unsigned char lastRspeed;
-	unsigned char lastRdepth;
-	unsigned char lastI;
-	unsigned char lastJ; /* Doubles as last portamento down for XM files */
-	unsigned char lastN;
-	unsigned char lastO;
-	unsigned char high_offset;
-	unsigned char lastQ;
-	unsigned char lastS;
-	unsigned char pat_loop_row;
-	unsigned char pat_loop_count;
-	unsigned char lastW;
-
-	unsigned char xm_lastE1;
-	unsigned char xm_lastE2;
-	unsigned char xm_lastEA;
-	unsigned char xm_lastEB;
-	unsigned char xm_lastX1;
-	unsigned char xm_lastX2;
-
-	IT_PLAYING *playing;
-};
-
-
-
-struct DUMB_IT_SIGRENDERER {
-	DUMB_IT_SIGDATA *sigdata;
-
-	int n_channels;
-
-	unsigned char globalvolume;
-	signed char globalvolslide;
-
-	unsigned char tempo;
-	signed char temposlide;
-
-	IT_CHANNEL channel[DUMB_IT_N_CHANNELS];
-
-	IT_PLAYING *playing[DUMB_IT_N_NNA_CHANNELS];
-
-	int tick;
-	int speed;
-	int rowcount;
-
-	int order; /* Set to -1 if the song is terminated by a callback. */
-	int row;
-	int processorder;
-	int processrow;
-	int breakrow;
-	int pat_loop_row;
-
-	int n_rows;
-
-	IT_ENTRY *entry_start;
-	IT_ENTRY *entry;
-	IT_ENTRY *entry_end;
-
-	long time_left; /* Time before the next tick is processed */
-	int sub_time_left;
-
-	DUMB_CLICK_REMOVER **click_remover;
-
-	IT_CALLBACKS *callbacks;
-};
-
-
-
-struct IT_CHECKPOINT {
-	IT_CHECKPOINT *next;
-	long time;
-	DUMB_IT_SIGRENDERER *sigrenderer;
-};
-
-
-
-struct IT_CALLBACKS {
-	int (*loop)(void *data);
-	void *loop_data;
-	/* Return 1 to prevent looping; the music will terminate abruptly. If you
-	 * want to make the music stop but allow samples to fade (beware, as they
-	 * might not fade at all!), use dumb_it_sr_set_speed() and set the speed
-	 * to 0. Note that xm_speed_zero() will not be called if you set the
-	 * speed manually, and also that this will work for IT and S3M files even
-	 * though the music can't stop in this way by itself.
-	 */
-
-	int (*xm_speed_zero)(void *data);
-	void *xm_speed_zero_data;
-	/* Return 1 to terminate the mod, without letting samples fade. */
-
-	int (*midi)(void *data, int channel, unsigned char byte);
-	void *midi_data;
-	/* Return 1 to prevent DUMB from subsequently interpreting the MIDI bytes
-	 * itself. In other words, return 1 if the Zxx macros in an IT file are
-	 * controlling filters and shouldn't be.
-	 */
-};
-
-
-
-void _dumb_it_end_sigrenderer(sigrenderer_t *sigrenderer);
-void _dumb_it_unload_sigdata(sigdata_t *vsigdata);
-
-extern DUH_SIGTYPE_DESC _dumb_sigtype_it;
-
-
-
-long _dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata);
-
-
-
-#define XM_APPREGIO                0
-#define XM_PORTAMENTO_UP           1
-#define XM_PORTAMENTO_DOWN         2
-#define XM_TONE_PORTAMENTO         3
-#define XM_VIBRATO                 4
-#define XM_VOLSLIDE_TONEPORTA      5
-#define XM_VOLSLIDE_VIBRATO        6
-#define XM_TREMOLO                 7
-#define XM_SET_PANNING             8
-#define XM_SAMPLE_OFFSET           9
-#define XM_VOLUME_SLIDE            10 /* A */
-#define XM_POSITION_JUMP           11 /* B */
-#define XM_SET_CHANNEL_VOLUME      12 /* C */
-#define XM_PATTERN_BREAK           13 /* D */
-#define XM_E                       14 /* E */
-#define XM_SET_TEMPO_BPM           15 /* F */
-#define XM_SET_GLOBAL_VOLUME       16 /* G */
-#define XM_GLOBAL_VOLUME_SLIDE     17 /* H */
-#define XM_KEY_OFF                 20 /* K (undocumented) */
-#define XM_SET_ENVELOPE_POSITION   21 /* L */
-#define XM_PANNING_SLIDE           25 /* P */
-#define XM_MULTI_RETRIG            27 /* R */
-#define XM_TREMOR                  29 /* T */
-#define XM_X                       33 /* X */
-#define XM_N_EFFECTS               (10+26)
-
-#define XM_E_SET_FILTER            0x0
-#define XM_E_FINE_PORTA_UP         0x1
-#define XM_E_FINE_PORTA_DOWN       0x2
-#define XM_E_SET_GLISSANDO_CONTROL 0x3
-#define XM_E_SET_VIBRATO_CONTROL   0x4
-#define XM_E_SET_FINETUNE          0x5
-#define XM_E_SET_LOOP              0x6
-#define XM_E_SET_TREMOLO_CONTROL   0x7
-#define XM_E_RETRIG_NOTE           0x9
-#define XM_E_FINE_VOLSLIDE_UP      0xA
-#define XM_E_FINE_VOLSLIDE_DOWN    0xB
-#define XM_E_NOTE_CUT              0xC
-#define XM_E_NOTE_DELAY            0xD
-#define XM_E_PATTERN_DELAY         0xE
-
-#define XM_X_EXTRAFINE_PORTA_UP    1
-#define XM_X_EXTRAFINE_PORTA_DOWN  2
-
-/* To make my life a bit simpler during conversion, effect E:xy is converted
- * to effect number EBASE+x:y. The same applies to effect X, and IT's S. That
- * way, these effects can be manipulated like regular effects.
- */
-#define EBASE              (XM_N_EFFECTS)
-#define XBASE              (EBASE+16)
-#define SBASE              (IT_N_EFFECTS)
-
-#define EFFECT_VALUE(x, y) (((x)<<4)|(y))
-#define HIGH(v)            ((v)>>4)
-#define LOW(v)             ((v)&0x0F)
-#define SET_HIGH(v, x)     v = (((x)<<4)|((v)&0x0F))
-#define SET_LOW(v, y)      v = (((v)&0xF0)|(y))
-#define BCD_TO_NORMAL(v)   (HIGH(v)*10+LOW(v))
-
-
-
-#if 0
-unsigned char **_dumb_malloc2(int w, int h);
-void _dumb_free2(unsigned char **line);
-#endif
-
-void _dumb_it_xm_convert_effect(int effect, int value, IT_ENTRY *entry);
-int _dumb_it_fix_invalid_orders(DUMB_IT_SIGDATA *sigdata);
-
-} // namespace AGS3
-
-#endif
diff --git a/engines/ags/lib/dumb-0.9.2/it/itmisc.cpp b/engines/ags/lib/dumb-0.9.2/it/itmisc.cpp
deleted file mode 100644
index 2971366034..0000000000
--- a/engines/ags/lib/dumb-0.9.2/it/itmisc.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-#include "common/textconsole.h"
-
-namespace AGS3 {
-
-DUMB_IT_SIGDATA *duh_get_it_sigdata(DUH *duh) {
-	warning("TODO: duh_get_it_sigdata");
-	return nullptr;
-}
-
-DUH_SIGRENDERER *duh_encapsulate_raw_sigrenderer(sigrenderer_t *vsigrenderer, DUH_SIGTYPE_DESC *desc, int n_channels, long pos) {
-	warning("TODO: duh_encapsulate_raw_sigrenderer");
-	return nullptr;
-}
-
-sigrenderer_t *duh_get_raw_sigrenderer(DUH_SIGRENDERER *sigrenderer, long type) {
-	warning("TODO: duh_get_raw_sigrenderer");
-	return nullptr;
-}
-
-void dumb_silence(sample_t *samples, long length) {
-	warning("TODO: dumb_silence");
-}
-
-long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, float volume, float delta) {
-	warning("TODO: dumb_resample");
-	return 0;
-}
-
-void dumb_reset_resampler(DUMB_RESAMPLER *resampler, sample_t *src, long pos, long start, long end) {
-	warning("TODO: dumb_reset_resampler");
-}
-
-sample_t dumb_resample_get_current_sample(DUMB_RESAMPLER *resampler, float volume) {
-	warning("TODO: dumb_resample_get_current_sample");
-	return (sample_t)0;
-}
-
-sample_t **create_sample_buffer(int n_channels, long length) {
-	warning("TODO: create_sample_buffer");
-	return nullptr;
-}
-
-void destroy_sample_buffer(sample_t **samples) {
-	warning("TODO: destroy_sample_buffer");
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/it/itrender.cpp b/engines/ags/lib/dumb-0.9.2/it/itrender.cpp
deleted file mode 100644
index aaed5e799e..0000000000
--- a/engines/ags/lib/dumb-0.9.2/it/itrender.cpp
+++ /dev/null
@@ -1,3533 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * itrender.c - Code to render an Impulse Tracker     / / \  \
- *              module.                              | <  /   \_
- *                                                   |  \/ /\   /
- * Written - painstakingly - by entheh.               \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-#include "ags/lib/dumb-0.9.2/it/it.h"
-
-namespace AGS3 {
-
-static IT_PLAYING *dup_playing(IT_PLAYING *src, IT_CHANNEL *dstchannel, IT_CHANNEL *srcchannel)
-{
-	IT_PLAYING *dst;
-
-	if (!src) return NULL;
-
-	dst = (IT_PLAYING *)malloc(sizeof(*dst));
-	if (!dst) return NULL;
-
-	dst->flags = src->flags;
-
-	ASSERT(src->channel);
-	dst->channel = &dstchannel[src->channel - srcchannel];
-	dst->sample = src->sample;
-	dst->instrument = src->instrument;
-	dst->env_instrument = src->env_instrument;
-
-	dst->sampnum = src->sampnum;
-	dst->instnum = src->instnum;
-
-	dst->channel_volume = src->channel_volume;
-
-	dst->volume = src->volume;
-	dst->pan = src->pan;
-
-	dst->note = src->note;
-
-	dst->filter_cutoff = src->filter_cutoff;
-	dst->filter_resonance = src->filter_resonance;
-
-	dst->true_filter_cutoff = src->true_filter_cutoff;
-	dst->true_filter_resonance = src->true_filter_resonance;
-
-	dst->vibrato_speed = src->vibrato_speed;
-	dst->vibrato_depth = src->vibrato_depth;
-	dst->vibrato_n = src->vibrato_n;
-	dst->vibrato_time = src->vibrato_time;
-
-	dst->tremolo_speed = src->tremolo_speed;
-	dst->tremolo_depth = src->tremolo_depth;
-	dst->tremolo_time = src->tremolo_time;
-
-	dst->sample_vibrato_time = src->sample_vibrato_time;
-	dst->sample_vibrato_depth = src->sample_vibrato_depth;
-
-	dst->slide = src->slide;
-	dst->delta = src->delta;
-
-	dst->volume_envelope = src->volume_envelope;
-	dst->pan_envelope = src->pan_envelope;
-	dst->pitch_envelope = src->pitch_envelope;
-
-	dst->fadeoutcount = src->fadeoutcount;
-
-	dst->filter_state[0] = src->filter_state[0];
-	dst->filter_state[1] = src->filter_state[1];
-
-	dst->resampler[0] = src->resampler[0];
-	dst->resampler[1] = src->resampler[1];
-	dst->resampler[1].pickup_data = dst->resampler[0].pickup_data = dst;
-	dst->time_lost = src->time_lost;
-
-	return dst;
-}
-
-
-
-static void dup_channel(IT_CHANNEL *dst, IT_CHANNEL *src)
-{
-	dst->flags = src->flags;
-
-	dst->volume = src->volume;
-	dst->volslide = src->volslide;
-	dst->xm_volslide = src->xm_volslide;
-
-	dst->pan = src->pan;
-	dst->truepan = src->truepan;
-
-	dst->channelvolume = src->channelvolume;
-	dst->channelvolslide = src->channelvolslide;
-
-	dst->instrument = src->instrument;
-	dst->note = src->note;
-
-	dst->SFmacro = src->SFmacro;
-
-	dst->filter_cutoff = src->filter_cutoff;
-	dst->filter_resonance = src->filter_resonance;
-
-	dst->note_cut_count = src->note_cut_count;
-	dst->note_delay_count = src->note_delay_count;
-	dst->note_delay_entry = src->note_delay_entry;
-
-	dst->arpeggio = src->arpeggio;
-	dst->retrig = src->retrig;
-	dst->xm_retrig = src->xm_retrig;
-	dst->retrig_tick = src->retrig_tick;
-
-	dst->tremor_time = src->tremor_time;
-
-	dst->portamento = src->portamento;
-	dst->toneporta = src->toneporta;
-	dst->destnote = src->destnote;
-
-	dst->sample = src->sample;
-	dst->truenote = src->truenote;
-
-	dst->midi_state = src->midi_state;
-
-	dst->lastvolslide = src->lastvolslide;
-	dst->lastDKL = src->lastDKL;
-	dst->lastEF = src->lastEF;
-	dst->lastG = src->lastG;
-	dst->lastHspeed = src->lastHspeed;
-	dst->lastHdepth = src->lastHdepth;
-	dst->lastRspeed = src->lastRspeed;
-	dst->lastRdepth = src->lastRdepth;
-	dst->lastI = src->lastI;
-	dst->lastJ = src->lastJ;
-	dst->lastN = src->lastN;
-	dst->lastO = src->lastO;
-	dst->high_offset = src->high_offset;
-	dst->lastQ = src->lastQ;
-	dst->lastS = src->lastS;
-	dst->pat_loop_row = src->pat_loop_row;
-	dst->pat_loop_count = src->pat_loop_count;
-	dst->lastW = src->lastW;
-
-	dst->xm_lastE1 = src->xm_lastE1;
-	dst->xm_lastE2 = src->xm_lastE2;
-	dst->xm_lastEA = src->xm_lastEA;
-	dst->xm_lastEB = src->xm_lastEB;
-	dst->xm_lastX1 = src->xm_lastX1;
-	dst->xm_lastX2 = src->xm_lastX2;
-
-	dst->playing = dup_playing(src->playing, dst, src);
-}
-
-
-
-/* Allocate the new callbacks first, then pass them to this function!
- * It will free them on failure.
- */
-static DUMB_IT_SIGRENDERER *dup_sigrenderer(DUMB_IT_SIGRENDERER *src, int n_channels, IT_CALLBACKS *callbacks)
-{
-	DUMB_IT_SIGRENDERER *dst;
-	int i;
-
-	if (!src) {
-		if (callbacks) free(callbacks);
-		return NULL;
-	}
-
-	dst = (DUMB_IT_SIGRENDERER *)malloc(sizeof(*dst));
-	if (!dst) {
-		if (callbacks) free(callbacks);
-		return NULL;
-	}
-
-	dst->sigdata = src->sigdata;
-
-	dst->n_channels = n_channels;
-
-	dst->globalvolume = src->globalvolume;
-	dst->globalvolslide = src->globalvolslide;
-
-	dst->tempo = src->tempo;
-	dst->temposlide = src->temposlide;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++)
-		dup_channel(&dst->channel[i], &src->channel[i]);
-
-	for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++)
-		dst->playing[i] = dup_playing(src->playing[i], dst->channel, src->channel);
-
-	dst->tick = src->tick;
-	dst->speed = src->speed;
-	dst->rowcount = src->rowcount;
-
-	dst->order = src->order;
-	dst->row = src->row;
-	dst->processorder = src->processorder;
-	dst->processrow = src->processrow;
-	dst->breakrow = src->breakrow;
-	dst->pat_loop_row = src->pat_loop_row;
-
-	dst->n_rows = src->n_rows;
-
-	dst->entry_start = src->entry_start;
-	dst->entry = src->entry;
-	dst->entry_end = src->entry_end;
-
-	dst->time_left = src->time_left;
-	dst->sub_time_left = src->sub_time_left;
-
-	dst->click_remover = NULL;
-
-	dst->callbacks = callbacks;
-
-	return dst;
-}
-
-
-
-static IT_MIDI default_midi = {
-	/* unsigned char SFmacro[16][16]; */
-	{
-		{0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
-	},
-	/* unsigned char SFmacrolen[16]; */
-	{4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-	/* unsigned short SFmacroz[16]; */
-	/* Bitfield; bit 0 set = z in first position */
-	{
-		0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
-	},
-	/* unsigned char Zmacro[128][16]; */
-	{
-		{0xF0, 0xF0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0xF0, 0xF0, 0x01, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
-	},
-	/* unsigned char Zmacrolen[128]; */
-	{
-		4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	}
-};
-
-
-
-static void it_reset_filter_state(IT_FILTER_STATE *state)
-{
-	state->currsample = 0;
-	state->prevsample = 0;
-}
-
-
-
-#define LOG10 2.30258509299
-
-/* IMPORTANT: This function expects one extra sample in 'src' so it can apply
- * click removal. It reads size samples, starting from src[0], and writes its
- * output starting at dst[pos]. The pos parameter is required for getting
- * click removal right.
- */
-static void it_filter(DUMB_CLICK_REMOVER *cr, IT_FILTER_STATE *state, sample_t *dst, long pos, sample_t *src, long size, int sampfreq, int cutoff, int resonance)
-{
-	float currsample = state->currsample;
-	float prevsample = state->prevsample;
-
-	float a, b, c;
-
-	{
-		float inv_angle = (float)(sampfreq * pow(0.5, 0.25 + cutoff*(1.0/(24<<IT_ENVELOPE_SHIFT))) * (1.0/(2*3.14159265358979323846*110.0)));
-		float loss = (float)exp(resonance*(-LOG10*1.2/128.0));
-		float d, e;
-#if 0
-		loss *= 2; // This is the mistake most players seem to make!
-#endif
-
-#if 1
-		d = (1.0f - loss) / inv_angle;
-		if (d > 2.0f) d = 2.0f;
-		d = (loss - d) * inv_angle;
-		e = inv_angle * inv_angle;
-		a = 1.0f / (1.0f + d + e);
-		c = -e * a;
-		b = 1.0f - a - c;
-#else
-		a = 1.0f / (inv_angle*inv_angle + inv_angle*loss + loss);
-		c = -(inv_angle*inv_angle) * a;
-		b = 1.0f - a - c;
-#endif
-	}
-
-	dst += pos;
-
-	if (cr) {
-		float startstep = src[0]*a + currsample*b + prevsample*c;
-		dumb_record_click(cr, pos, (sample_t)startstep);
-	}
-
-#define INT_FILTERS
-#ifdef INT_FILTERS
-#define MULSCA(a, b) ((int)((LONG_LONG)((a) << 4) * (b) >> 32))
-#define SCALEB 12
-	{
-		int ai = (int)(a * (1 << (16+SCALEB)));
-		int bi = (int)(b * (1 << (16+SCALEB)));
-		int ci = (int)(c * (1 << (16+SCALEB)));
-		sample_t csi = (sample_t)currsample;
-		sample_t psi = (sample_t)prevsample;
-		sample_t *dst_end = dst + size;
-		while (dst < dst_end) {
-			{
-				sample_t nsi = MULSCA(*src++, ai) + MULSCA(csi, bi) + MULSCA(psi, ci);
-				psi = csi;
-				csi = nsi;
-			}
-			*dst++ += csi;
-		}
-		currsample = csi;
-		prevsample = psi;
-	}
-#else
-	{
-		int i = size % 3;
-		while (i > 0) {
-			{
-				float newsample = *src++*a + currsample*b + prevsample*c;
-				prevsample = currsample;
-				currsample = newsample;
-			}
-			*dst++ += (sample_t)currsample;
-			i--;
-		}
-		i = size / 3;
-		while (i > 0) {
-			float newsample;
-			/* Gotta love unrolled loops! */
-			*dst++ += (sample_t)(newsample = *src++*a + currsample*b + prevsample*c);
-			*dst++ += (sample_t)(prevsample = *src++*a + newsample*b + currsample*c);
-			*dst++ += (sample_t)(currsample = *src++*a + prevsample*b + newsample*c);
-			i--;
-		}
-	}
-#endif
-
-	if (cr) {
-		float endstep = *src*a + currsample*b + prevsample*c;
-		dumb_record_click(cr, pos + size, -(sample_t)endstep);
-	}
-
-	state->currsample = currsample;
-	state->prevsample = prevsample;
-}
-
-#undef LOG10
-
-
-
-static signed char it_sine[256] = {
-	  0,  2,  3,  5,  6,  8,  9, 11, 12, 14, 16, 17, 19, 20, 22, 23,
-	 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44,
-	 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59,
-	 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60,
-	 59, 59, 58, 57, 56, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46,
-	 45, 44, 43, 42, 41, 39, 38, 37, 36, 34, 33, 32, 30, 29, 27, 26,
-	 24, 23, 22, 20, 19, 17, 16, 14, 12, 11,  9,  8,  6,  5,  3,  2,
-	  0, -2, -3, -5, -6, -8, -9,-11,-12,-14,-16,-17,-19,-20,-22,-23,
-	-24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,-43,-44,
-	-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-56,-57,-58,-59,
-	-59,-60,-60,-61,-61,-62,-62,-62,-63,-63,-63,-64,-64,-64,-64,-64,
-	-64,-64,-64,-64,-64,-64,-63,-63,-63,-62,-62,-62,-61,-61,-60,-60,
-	-59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-49,-48,-47,-46,
-	-45,-44,-43,-42,-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,
-	-24,-23,-22,-20,-19,-17,-16,-14,-12,-11, -9, -8, -6, -5, -3, -2
-};
-
-
-
-#if 0
-/** WARNING: use these! */
-/** JULIEN: Plus for XM compatibility it could be interesting to rename
- * it_sawtooth[] to it_rampdown[], and add an it_rampup[].
- * Also, still for XM compat', twood be good if it was possible to tell the
- * the player not to retrig' the waveform on a new instrument.
- * Both of these are only for completness though, as I don't think it would
- * be very noticeable ;)
- */
-/** ENTHEH: IT also has the 'don't retrig' thingy :) */
-
-static signed char it_sawtooth[256] = {
-	 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56,
-	 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48,
-	 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40,
-	 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32,
-	 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24,
-	 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16,
-	 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10,  9,  9,  8,
-	  8,  7,  7,  6,  6,  5,  5,  4,  4,  3,  3,  2,  2,  1,  1,  0,
-	  0, -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8,
-	 -8, -9, -9,-10,-10,-11,-11,-12,-12,-13,-13,-14,-14,-15,-15,-16,
-	-16,-17,-17,-18,-18,-19,-19,-20,-20,-21,-21,-22,-22,-23,-23,-24,
-	-24,-25,-25,-26,-26,-27,-27,-28,-28,-29,-29,-30,-30,-31,-31,-32,
-	-32,-33,-33,-34,-34,-35,-35,-36,-36,-37,-37,-38,-38,-39,-39,-40,
-	-40,-41,-41,-42,-42,-43,-43,-44,-44,-45,-45,-46,-46,-47,-47,-48,
-	-48,-49,-49,-50,-50,-51,-51,-52,-52,-53,-53,-54,-54,-55,-55,-56,
-	-56,-57,-57,-58,-58,-59,-59,-60,-60,-61,-61,-62,-62,-63,-63,-64
-};
-
-
-
-static signed char it_squarewave[256] = {
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
-};
-
-#endif
-
-
-
-static void reset_tick_counts(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	int i;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-		channel->note_cut_count = 0;
-		channel->note_delay_count = 0;
-	}
-}
-
-
-
-static void reset_effects(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	int i;
-
-	sigrenderer->globalvolslide = 0;
-	sigrenderer->temposlide = 0;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-		channel->volslide = 0;
-		channel->xm_volslide = 0;
-		channel->channelvolslide = 0;
-		channel->arpeggio = 0;
-		channel->retrig = 0;
-		if (channel->xm_retrig) {
-			channel->xm_retrig = 0;
-			channel->retrig_tick = 0;
-		}
-		channel->tremor_time &= 127;
-		channel->portamento = 0;
-		channel->toneporta = 0;
-		if (channel->playing) {
-			channel->playing->vibrato_n = 0;
-			channel->playing->tremolo_speed = 0;
-			channel->playing->tremolo_depth = 0;
-		}
-	}
-}
-
-
-
-static void update_tremor(IT_CHANNEL *channel)
-{
-	if ((channel->tremor_time & 128) && channel->playing) {
-		if (channel->tremor_time == 128)
-			channel->tremor_time = (channel->lastI >> 4) | 192;
-		else if (channel->tremor_time == 192)
-			channel->tremor_time = (channel->lastI & 15) | 128;
-		else
-			channel->tremor_time--;
-	}
-}
-
-
-
-static void it_pickup_loop(DUMB_RESAMPLER *resampler, void *data)
-{
-	resampler->pos -= resampler->end - resampler->start;
-	((IT_PLAYING *)data)->time_lost += resampler->end - resampler->start;
-}
-
-
-
-static void it_pickup_pingpong_loop(DUMB_RESAMPLER *resampler, void *data)
-{
-	if (resampler->dir < 0) {
-		resampler->pos = (resampler->start << 1) - 1 - resampler->pos;
-		resampler->subpos ^= 65535;
-		resampler->dir = 1;
-		((IT_PLAYING *)data)->time_lost += (resampler->end - resampler->start) << 1;
-	} else {
-		resampler->pos = (resampler->end << 1) - 1 - resampler->pos;
-		resampler->subpos ^= 65535;
-		resampler->dir = -1;
-	}
-}
-
-
-
-static void it_pickup_stop_at_end(DUMB_RESAMPLER *resampler, void *data)
-{
-	(void)data;
-
-	if (resampler->dir < 0) {
-		resampler->pos = (resampler->start << 1) - 1 - resampler->pos;
-		resampler->subpos ^= 65535;
-		/* By rights, time_lost would be updated here. However, there is no
-		 * need at this point; it will not be used.
-		 *
-		 * ((IT_PLAYING *)data)->time_lost += (resampler->src_end - resampler->src_start) << 1;
-		 */
-		resampler->dir = 1;
-	} else
-		resampler->dir = 0;
-}
-
-
-
-static void it_playing_update_resamplers(IT_PLAYING *playing)
-{
-	if ((playing->sample->flags & IT_SAMPLE_SUS_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF)) {
-		playing->resampler[0].start = playing->sample->sus_loop_start;
-		playing->resampler[0].end = playing->sample->sus_loop_end;
-		if (playing->sample->flags & IT_SAMPLE_PINGPONG_SUS_LOOP)
-			playing->resampler[0].pickup = &it_pickup_pingpong_loop;
-		else
-			playing->resampler[0].pickup = &it_pickup_loop;
-	} else if (playing->sample->flags & IT_SAMPLE_LOOP) {
-		playing->resampler[0].start = playing->sample->loop_start;
-		playing->resampler[0].end = playing->sample->loop_end;
-		if (playing->sample->flags & IT_SAMPLE_PINGPONG_LOOP)
-			playing->resampler[0].pickup = &it_pickup_pingpong_loop;
-		else
-			playing->resampler[0].pickup = &it_pickup_loop;
-	} else {
-		if (playing->sample->flags & IT_SAMPLE_SUS_LOOP)
-			playing->resampler[0].start = playing->sample->sus_loop_start;
-		else
-			playing->resampler[0].start = 0;
-		playing->resampler[0].end = playing->sample->length;
-		playing->resampler[0].pickup = &it_pickup_stop_at_end;
-	}
-	playing->resampler[1].start = playing->resampler[0].start;
-	playing->resampler[1].end = playing->resampler[0].end;
-	playing->resampler[1].pickup = playing->resampler[0].pickup;
-	ASSERT(playing->resampler[0].pickup_data == playing);
-	ASSERT(playing->resampler[1].pickup_data == playing);
-}
-
-
-
-/* This should be called whenever the sample or sample position changes. */
-static void it_playing_reset_resamplers(IT_PLAYING *playing, long pos)
-{
-	dumb_reset_resampler(&playing->resampler[0], playing->sample->left, pos, 0, 0);
-	dumb_reset_resampler(&playing->resampler[1], playing->sample->right, pos, 0, 0);
-	playing->resampler[1].pickup_data = playing->resampler[0].pickup_data = playing;
-	playing->time_lost = 0;
-	playing->flags &= ~IT_PLAYING_DEAD;
-	it_playing_update_resamplers(playing);
-}
-
-
-
-static void update_retrig(IT_CHANNEL *channel)
-{
-	if (channel->xm_retrig) {
-		channel->retrig_tick--;
-		if (channel->retrig_tick <= 0) {
-			if (channel->playing) it_playing_reset_resamplers(channel->playing, 0);
-			channel->retrig_tick = channel->xm_retrig;
-		}
-	} else if (channel->retrig & 0x0F) {
-		channel->retrig_tick--;
-		if (channel->retrig_tick <= 0) {
-			if (channel->retrig < 0x10) {
-			} else if (channel->retrig < 0x20) {
-				channel->volume--;
-				if (channel->volume > 64) channel->volume = 0;
-			} else if (channel->retrig < 0x30) {
-				channel->volume -= 2;
-				if (channel->volume > 64) channel->volume = 0;
-			} else if (channel->retrig < 0x40) {
-				channel->volume -= 4;
-				if (channel->volume > 64) channel->volume = 0;
-			} else if (channel->retrig < 0x50) {
-				channel->volume -= 8;
-				if (channel->volume > 64) channel->volume = 0;
-			} else if (channel->retrig < 0x60) {
-				channel->volume -= 16;
-				if (channel->volume > 64) channel->volume = 0;
-			} else if (channel->retrig < 0x70) {
-				channel->volume <<= 1;
-				channel->volume /= 3;
-			} else if (channel->retrig < 0x80) {
-				channel->volume >>= 1;
-			} else if (channel->retrig < 0x90) {
-			} else if (channel->retrig < 0xA0) {
-				channel->volume++;
-				if (channel->volume > 64) channel->volume = 64;
-			} else if (channel->retrig < 0xB0) {
-				channel->volume += 2;
-				if (channel->volume > 64) channel->volume = 64;
-			} else if (channel->retrig < 0xC0) {
-				channel->volume += 4;
-				if (channel->volume > 64) channel->volume = 64;
-			} else if (channel->retrig < 0xD0) {
-				channel->volume += 8;
-				if (channel->volume > 64) channel->volume = 64;
-			} else if (channel->retrig < 0xE0) {
-				channel->volume += 16;
-				if (channel->volume > 64) channel->volume = 64;
-			} else if (channel->retrig < 0xF0) {
-				channel->volume *= 3;
-				channel->volume >>= 1;
-				if (channel->volume > 64) channel->volume = 64;
-			} else {
-				channel->volume <<= 1;
-				if (channel->volume > 64) channel->volume = 64;
-			}
-			if (channel->playing) it_playing_reset_resamplers(channel->playing, 0);
-			channel->retrig_tick = channel->retrig & 0x0F;
-		}
-	}
-}
-
-
-
-static void update_smooth_effects(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	int i;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-		IT_PLAYING *playing = channel->playing;
-
-		if (playing) {
-			playing->vibrato_time += playing->vibrato_n *
-			                         (playing->vibrato_speed << 2);
-			playing->tremolo_time += playing->tremolo_speed << 2;
-		}
-	}
-}
-
-
-
-static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	int i;
-
-	if (sigrenderer->globalvolslide) {
-		sigrenderer->globalvolume += sigrenderer->globalvolslide;
-		if (sigrenderer->globalvolume > 128) {
-			if (sigrenderer->globalvolslide >= 0)
-				sigrenderer->globalvolume = 128;
-			else
-				sigrenderer->globalvolume = 0;
-		}
-	}
-
-	if (sigrenderer->temposlide) {
-		sigrenderer->tempo += sigrenderer->temposlide;
-		if (sigrenderer->tempo < 32) {
-			if (sigrenderer->temposlide >= 0)
-				sigrenderer->tempo = 255;
-			else
-				sigrenderer->tempo = 32;
-		}
-	}
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-		IT_PLAYING *playing = channel->playing;
-
-		if (channel->xm_volslide) {
-			channel->volume += channel->xm_volslide;
-			if (channel->volume > 64) {
-				if (channel->xm_volslide >= 0)
-					channel->volume = 64;
-				else
-					channel->volume = 0;
-			}
-		}
-
-		if (channel->volslide) {
-			channel->volume += channel->volslide;
-			if (channel->volume > 64) {
-				if (channel->volslide >= 0)
-					channel->volume = 64;
-				else
-					channel->volume = 0;
-			}
-		}
-
-		if (channel->channelvolslide) {
-			channel->channelvolume += channel->channelvolslide;
-			if (channel->channelvolume > 64) {
-				if (channel->channelvolslide >= 0)
-					channel->channelvolume = 64;
-				else
-					channel->channelvolume = 0;
-			}
-			if (channel->playing)
-				channel->playing->channel_volume = channel->channelvolume;
-		}
-
-		update_tremor(channel);
-
-		channel->arpeggio = (channel->arpeggio << 4) | (channel->arpeggio >> 8);
-		channel->arpeggio &= 0xFFF;
-
-		update_retrig(channel);
-
-		if (playing) {
-			playing->slide += channel->portamento;
-
-			if (sigrenderer->sigdata->flags & IT_LINEAR_SLIDES) {
-				if (channel->toneporta && channel->destnote < 120) {
-					int currpitch = ((playing->note - 60) << 8) + playing->slide;
-					int destpitch = (channel->destnote - 60) << 8;
-					if (currpitch > destpitch) {
-						currpitch -= channel->toneporta;
-						if (currpitch < destpitch) {
-							currpitch = destpitch;
-							channel->destnote = IT_NOTE_OFF;
-						}
-					} else if (currpitch < destpitch) {
-						currpitch += channel->toneporta;
-						if (currpitch > destpitch) {
-							currpitch = destpitch;
-							channel->destnote = IT_NOTE_OFF;
-						}
-					}
-					playing->slide = currpitch - ((playing->note - 60) << 8);
-				}
-			} else {
-				if (channel->toneporta && channel->destnote < 120) {
-					float amiga_multiplier = playing->sample->C5_speed * (1.0f / AMIGA_DIVISOR);
-
-					float deltanote = (float)pow(DUMB_SEMITONE_BASE, 60 - playing->note);
-					/* deltanote is 1.0 for C-5, 0.5 for C-6, etc. */
-
-					float deltaslid = deltanote - playing->slide * amiga_multiplier;
-
-					float destdelta = (float)pow(DUMB_SEMITONE_BASE, 60 - channel->destnote);
-					if (deltaslid < destdelta) {
-						playing->slide -= channel->toneporta;
-						deltaslid = deltanote - playing->slide * amiga_multiplier;
-						if (deltaslid > destdelta) {
-							playing->note = channel->destnote;
-							playing->slide = 0;
-							channel->destnote = IT_NOTE_OFF;
-						}
-					} else {
-						playing->slide += channel->toneporta;
-						deltaslid = deltanote - playing->slide * amiga_multiplier;
-						if (deltaslid < destdelta) {
-							playing->note = channel->destnote;
-							playing->slide = 0;
-							channel->destnote = IT_NOTE_OFF;
-						}
-					}
-				}
-			}
-		}
-	}
-
-	update_smooth_effects(sigrenderer);
-}
-
-
-
-static void update_pattern_variables(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	if (entry->mask & IT_ENTRY_EFFECT) {
-		if (entry->effect == IT_S) {
-			unsigned char effectvalue = entry->effectvalue;
-			if (effectvalue == 0)
-				effectvalue = channel->lastS;
-			channel->lastS = effectvalue;
-			switch (effectvalue >> 4) {
-				//case IT_S7:
-				case IT_S_PATTERN_LOOP:
-					{
-						unsigned char v = effectvalue & 15;
-						if (v == 0)
-							channel->pat_loop_row = sigrenderer->processrow;
-						else {
-							if (channel->pat_loop_count == 0) {
-								channel->pat_loop_count = v;
-								sigrenderer->pat_loop_row = channel->pat_loop_row;
-							} else {
-								if (--channel->pat_loop_count)
-									sigrenderer->pat_loop_row = channel->pat_loop_row;
-								else if (!(sigrenderer->sigdata->flags & IT_WAS_AN_XM))
-									channel->pat_loop_row = sigrenderer->processrow + 1;
-							}
-						}
-					}
-					break;
-				case IT_S_PATTERN_DELAY:
-					sigrenderer->rowcount = 1 + (effectvalue & 15);
-					break;
-			}
-		}
-	}
-}
-
-
-
-/* This function guarantees that channel->sample will always be valid if it
- * is nonzero. In other words, to check if it is valid, simply check if it is
- * nonzero.
- */
-static void instrument_to_sample(DUMB_IT_SIGDATA *sigdata, IT_CHANNEL *channel)
-{
-	if (sigdata->flags & IT_USE_INSTRUMENTS) {
-		if (channel->instrument >= 1 && channel->instrument <= sigdata->n_instruments) {
-			if (channel->note < 120) {
-				channel->sample = sigdata->instrument[channel->instrument-1].map_sample[channel->note];
-				channel->truenote = sigdata->instrument[channel->instrument-1].map_note[channel->note];
-			} else
-				channel->sample = 0;
-		} else
-			channel->sample = 0;
-	} else {
-		channel->sample = channel->instrument;
-		channel->truenote = channel->note;
-	}
-	if (!(channel->sample >= 1 && channel->sample <= sigdata->n_samples && (sigdata->sample[channel->sample-1].flags & IT_SAMPLE_EXISTS)))
-		channel->sample = 0;
-}
-
-
-
-static void fix_sample_looping(IT_PLAYING *playing)
-{
-	if ((playing->sample->flags & (IT_SAMPLE_LOOP | IT_SAMPLE_SUS_LOOP)) ==
-	                              (IT_SAMPLE_LOOP | IT_SAMPLE_SUS_LOOP)) {
-		if (playing->resampler[0].dir < 0) {
-			playing->resampler[1].pos = playing->resampler[0].pos = (playing->sample->sus_loop_end << 1) - 1 - playing->resampler[0].pos;
-			playing->resampler[1].subpos = playing->resampler[0].subpos ^= 65535;
-			playing->resampler[1].dir = playing->resampler[0].dir = 1;
-		}
-
-		playing->resampler[1].pos = playing->resampler[0].pos += playing->time_lost;
-	}
-}
-
-
-
-static void retrigger_it_envelopes(DUMB_IT_SIGDATA *sigdata, IT_CHANNEL *channel)
-{
-	channel->playing->volume_envelope.next_node = 0;
-	channel->playing->volume_envelope.tick = -1;
-	channel->playing->pan_envelope.next_node = 0;
-	channel->playing->pan_envelope.tick = -1;
-	channel->playing->pitch_envelope.next_node = 0;
-	channel->playing->pitch_envelope.tick = -1;
-	channel->playing->fadeoutcount = 1024;
-	// Should we remove IT_PLAYING_BACKGROUND? Test with sample with sustain loop...
-	channel->playing->flags &= ~(IT_PLAYING_BACKGROUND | IT_PLAYING_SUSTAINOFF | IT_PLAYING_FADING | IT_PLAYING_DEAD);
-	it_playing_update_resamplers(channel->playing);
-
-	if (channel->sample)
-		if (sigdata->flags & IT_USE_INSTRUMENTS)
-			channel->playing->env_instrument = &sigdata->instrument[channel->instrument-1];
-}
-
-
-
-static void it_retrigger_note(DUMB_IT_SIGRENDERER *sigrenderer, IT_CHANNEL *channel)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-	unsigned char nna;
-	int i;
-
-	if (channel->playing) {
-#ifdef INVALID_NOTES_CAUSE_NOTE_CUT
-		if (channel->note == IT_NOTE_OFF)
-			nna = NNA_NOTE_OFF;
-		else if (channel->note >= 120 || !channel->playing->instrument || (channel->playing->flags & IT_PLAYING_DEAD))
-			nna = NNA_NOTE_CUT;
-		else
-			nna = channel->playing->instrument->new_note_action;
-#else
-		if (channel->note == IT_NOTE_CUT)
-			nna = NNA_NOTE_CUT;
-		if (channel->note >= 120)
-			nna = NNA_NOTE_OFF;
-		else if (!channel->playing->instrument || (channel->playing->flags & IT_PLAYING_DEAD))
-			nna = NNA_NOTE_CUT;
-		else
-			nna = channel->playing->instrument->new_note_action;
-#endif
-
-		switch (nna) {
-			case NNA_NOTE_CUT:
-				free(channel->playing);
-				channel->playing = NULL;
-				break;
-			case NNA_NOTE_OFF:
-				channel->playing->flags |= IT_PLAYING_BACKGROUND | IT_PLAYING_SUSTAINOFF;
-				fix_sample_looping(channel->playing);
-				it_playing_update_resamplers(channel->playing);
-				if (channel->playing->instrument)
-					if ((channel->playing->instrument->volume_envelope.flags & (IT_ENVELOPE_ON | IT_ENVELOPE_LOOP_ON)) != IT_ENVELOPE_ON)
-						channel->playing->flags |= IT_PLAYING_FADING;
-				break;
-			case NNA_NOTE_FADE:
-				channel->playing->flags |= IT_PLAYING_BACKGROUND | IT_PLAYING_FADING;
-				break;
-		}
-	}
-
-	if (channel->sample == 0 || channel->note >= 120)
-		return;
-
-	channel->destnote = IT_NOTE_OFF;
-
-	if (channel->playing) {
-		for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
-			if (!sigrenderer->playing[i]) {
-				sigrenderer->playing[i] = channel->playing;
-				channel->playing = NULL;
-				break;
-			}
-		}
-/** WARNING - come up with some more heuristics for replacing old notes */
-#if 0
-		if (channel->playing) {
-			for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
-				if (sigrenderer->playing[i]->flags & IT_PLAYING_BACKGROUND) {
-					write_seqtime();
-					sequence_c(SEQUENCE_STOP_SIGNAL);
-					sequence_c(i);
-					channel->VChannel = &module->VChannel[i];
-					break;
-				}
-			}
-		}
-#endif
-	}
-
-	if (channel->playing)
-		free(channel->playing);
-
-	channel->playing = (IT_PLAYING *)malloc(sizeof(*channel->playing));
-
-	if (!channel->playing)
-		return;
-
-	channel->playing->flags = 0;
-	channel->playing->channel = channel;
-	channel->playing->sample = &sigdata->sample[channel->sample-1];
-	if (sigdata->flags & IT_USE_INSTRUMENTS)
-		channel->playing->instrument = &sigdata->instrument[channel->instrument-1];
-	else
-		channel->playing->instrument = NULL;
-	channel->playing->env_instrument = channel->playing->instrument;
-	channel->playing->sampnum = channel->sample;
-	channel->playing->instnum = channel->instrument;
-	channel->playing->channel_volume = channel->channelvolume;
-	channel->playing->note = channel->truenote;
-	channel->playing->filter_cutoff = 127;
-	channel->playing->filter_resonance = 0;
-	channel->playing->true_filter_cutoff = 127 << 8;
-	channel->playing->true_filter_resonance = 0;
-	channel->playing->vibrato_speed = 0;
-	channel->playing->vibrato_depth = 0;
-	channel->playing->vibrato_n = 0;
-	channel->playing->vibrato_time = 0;
-	channel->playing->tremolo_speed = 0;
-	channel->playing->tremolo_depth = 0;
-	channel->playing->tremolo_time = 0;
-	channel->playing->sample_vibrato_time = 0;
-	channel->playing->sample_vibrato_depth = 0;
-	channel->playing->slide = 0;
-	channel->playing->volume_envelope.next_node = 0;
-	channel->playing->volume_envelope.tick = -1;
-	channel->playing->pan_envelope.next_node = 0;
-	channel->playing->pan_envelope.tick = -1;
-	channel->playing->pitch_envelope.next_node = 0;
-	channel->playing->pitch_envelope.tick = -1;
-	channel->playing->fadeoutcount = 1024;
-	it_reset_filter_state(&channel->playing->filter_state[0]);
-	it_reset_filter_state(&channel->playing->filter_state[1]);
-	it_playing_reset_resamplers(channel->playing, 0);
-
-	/** WARNING - is everything initialised? */
-}
-
-
-
-static void get_default_volpan(DUMB_IT_SIGDATA *sigdata, IT_CHANNEL *channel)
-{
-	if (channel->sample == 0)
-		return;
-
-	channel->volume = sigdata->sample[channel->sample-1].default_volume;
-
-	{
-		int pan = sigdata->sample[channel->sample-1].default_pan;
-		if (pan >= 128 && pan <= 192) {
-			channel->pan = pan - 128;
-			return;
-		}
-	}
-
-	if (sigdata->flags & IT_USE_INSTRUMENTS) {
-		IT_INSTRUMENT *instrument = &sigdata->instrument[channel->instrument-1];
-		if (instrument->default_pan <= 64)
-			channel->pan = instrument->default_pan;
-		if (instrument->filter_cutoff >= 128)
-			channel->filter_cutoff = instrument->filter_cutoff - 128;
-		if (instrument->filter_resonance >= 128)
-			channel->filter_resonance = instrument->filter_resonance - 128;
-	}
-}
-
-
-
-static void get_true_pan(DUMB_IT_SIGDATA *sigdata, IT_CHANNEL *channel)
-{
-	channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-
-	if (!IT_IS_SURROUND_SHIFTED(channel->truepan) && (sigdata->flags & IT_USE_INSTRUMENTS)) {
-		IT_INSTRUMENT *instrument = &sigdata->instrument[channel->instrument-1];
-		int truepan = channel->truepan;
-		truepan += (channel->note - instrument->pp_centre) * instrument->pp_separation << (IT_ENVELOPE_SHIFT - 3);
-		channel->truepan = MID(0, truepan, 64 << IT_ENVELOPE_SHIFT);
-	}
-}
-
-
-
-static void post_process_it_volpan(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	if (entry->mask & IT_ENTRY_VOLPAN) {
-		if (entry->volpan <= 84) {
-			/* Volume */
-			/* Fine volume slide up */
-			/* Fine volume slide down */
-		} else if (entry->volpan <= 94) {
-			/* Volume slide up */
-			unsigned char v = entry->volpan - 85;
-			if (v == 0)
-				v = channel->lastvolslide;
-			channel->lastvolslide = v;
-			/* = effect Dx0 where x == entry->volpan - 85 */
-			channel->volslide = v;
-		} else if (entry->volpan <= 104) {
-			/* Volume slide down */
-			unsigned char v = entry->volpan - 95;
-			if (v == 0)
-				v = channel->lastvolslide;
-			channel->lastvolslide = v;
-			/* = effect D0x where x == entry->volpan - 95 */
-			channel->volslide = -v;
-		} else if (entry->volpan <= 114) {
-			/* Portamento down */
-			unsigned char v = (entry->volpan - 105) << 2;
-			if (v == 0)
-				v = channel->lastEF;
-			channel->lastEF = v;
-			channel->portamento -= v << 4;
-		} else if (entry->volpan <= 124) {
-			/* Portamento up */
-			unsigned char v = (entry->volpan - 115) << 2;
-			if (v == 0)
-				v = channel->lastEF;
-			channel->lastEF = v;
-			channel->portamento += v << 4;
-		} else if (entry->volpan <= 202) {
-			/* Pan */
-			/* Tone Portamento */
-		} else if (entry->volpan <= 212) {
-			/* Vibrato */
-			unsigned char v = entry->volpan - 203;
-			if (v == 0)
-				v = channel->lastHdepth;
-			else {
-				v <<= 2;
-				channel->lastHdepth = v;
-			}
-			if (channel->playing) {
-				channel->playing->vibrato_speed = channel->lastHspeed;
-				channel->playing->vibrato_depth = v;
-				channel->playing->vibrato_n++;
-			}
-		}
-	}
-}
-
-
-
-static void it_send_midi(DUMB_IT_SIGRENDERER *sigrenderer, IT_CHANNEL *channel, unsigned char byte)
-{
-	if (sigrenderer->callbacks->midi)
-		if ((*sigrenderer->callbacks->midi)(sigrenderer->callbacks->midi_data, channel - sigrenderer->channel, byte))
-			return;
-
-	switch (channel->midi_state) {
-		case 4: /* Ready to receive resonance parameter */
-			if (byte < 0x80) channel->filter_resonance = byte;
-			channel->midi_state = 0;
-			break;
-		case 3: /* Ready to receive cutoff parameter */
-			if (byte < 0x80) channel->filter_cutoff = byte;
-			channel->midi_state = 0;
-			break;
-		case 2: /* Ready for byte specifying which parameter will follow */
-			if (byte == 0) /* Cutoff */
-				channel->midi_state = 3;
-			else if (byte == 1) /* Resonance */
-				channel->midi_state = 4;
-			else
-				channel->midi_state = 0;
-			break;
-		default: /* Counting initial F0 bytes */
-			switch (byte) {
-				case 0xF0:
-					channel->midi_state++;
-					break;
-				case 0xFA:
-				case 0xFC:
-				case 0xFF:
-					/* Reset filter parameters for all channels */
-					{
-						int i;
-						for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-							sigrenderer->channel[i].filter_cutoff = 127;
-							sigrenderer->channel[i].filter_resonance = 0;
-							//// should we be resetting channel[i].playing->filter_* here?
-						}
-					}
-					/* Fall through */
-				default:
-					channel->midi_state = 0;
-					break;
-			}
-	}
-}
-
-
-
-/* Returns 1 if a callback caused termination of playback. */
-static int process_effects(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	if (entry->mask & IT_ENTRY_EFFECT) {
-		switch (entry->effect) {
-/*
-Notes about effects (as compared to other module formats)
-
-C               This is now in *HEX*. (Used to be in decimal in ST3)
-E/F/G/H/U       You need to check whether the song uses Amiga/Linear slides.
-H/U             Vibrato in Impulse Tracker is two times finer than in
-                any other tracker and is updated EVERY tick.
-                If "Old Effects" is *ON*, then the vibrato is played in the
-                normal manner (every non-row tick and normal depth)
-E/F/G           These commands ALL share the same memory.
-Oxx             Offsets to samples are to the 'xx00th' SAMPLE. (ie. for
-                16 bit samples, the offset is xx00h*2)
-                Oxx past the sample end will be ignored, unless "Old Effects"
-                is ON, in which case the Oxx will play from the end of the
-                sample.
-Yxy             This uses a table 4 times larger (hence 4 times slower) than
-                vibrato or tremelo. If the waveform is set to random, then
-                the 'speed' part of the command is interpreted as a delay.
-*/
-			case IT_SET_SPEED:
-				if (entry->effectvalue)
-					sigrenderer->tick = sigrenderer->speed = entry->effectvalue;
-				else if (sigdata->flags & IT_WAS_AN_XM) {
-					sigrenderer->speed = 0;
-					if (sigrenderer->callbacks->xm_speed_zero && (*sigrenderer->callbacks->xm_speed_zero)(sigrenderer->callbacks->xm_speed_zero_data))
-						return 1;
-				}
-				break;
-
-			case IT_JUMP_TO_ORDER: sigrenderer->processorder = entry->effectvalue - 1; sigrenderer->processrow = 0xFFFE; break;
-			case IT_BREAK_TO_ROW: sigrenderer->breakrow = entry->effectvalue; sigrenderer->processrow = 0xFFFE; break;
-
-			case IT_VOLSLIDE_VIBRATO:
-				if (channel->playing) {
-					channel->playing->vibrato_speed = channel->lastHspeed;
-					channel->playing->vibrato_depth = channel->lastHdepth;
-					channel->playing->vibrato_n++;
-				}
-				/* Fall through and process volume slide. */
-			case IT_VOLUME_SLIDE:
-			case IT_VOLSLIDE_TONEPORTA:
-				/* The tone portamento component is handled elsewhere. */
-				{
-					unsigned char v = entry->effectvalue;
-					if (!(sigdata->flags & IT_WAS_A_MOD)) {
-						if (v == 0)
-							v = channel->lastDKL;
-						channel->lastDKL = v;
-					}
-					if ((v & 0x0F) == 0) { /* Dx0 */
-						channel->volslide = v >> 4;
-						if (channel->volslide == 15 && !(sigdata->flags & IT_WAS_AN_XM)) {
-							channel->volume += 15;
-							if (channel->volume > 64) channel->volume = 64;
-						}
-					} else if ((v & 0xF0) == 0) { /* D0x */
-						channel->volslide = -v;
-						if (channel->volslide == -15 && !(sigdata->flags & IT_WAS_AN_XM)) {
-							channel->volume -= 15;
-							if (channel->volume > 64) channel->volume = 0;
-						}
-					} else if ((v & 0x0F) == 0x0F) { /* DxF */
-						channel->volume += v >> 4;
-						if (channel->volume > 64) channel->volume = 64;
-					} else if ((v & 0xF0) == 0xF0) { /* DFx */
-						channel->volume -= v & 15;
-						if (channel->volume > 64) channel->volume = 0;
-					}
-				}
-				break;
-			case IT_XM_FINE_VOLSLIDE_DOWN:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->xm_lastEB;
-					channel->xm_lastEB = v;
-					channel->volume -= v;
-					if (channel->volume > 64) channel->volume = 0;
-				}
-				break;
-			case IT_XM_FINE_VOLSLIDE_UP:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->xm_lastEA;
-					channel->xm_lastEA = v;
-					channel->volume += v;
-					if (channel->volume > 64) channel->volume = 64;
-				}
-				break;
-			case IT_PORTAMENTO_DOWN:
-				{
-					unsigned char v = entry->effectvalue;
-					if (sigdata->flags & IT_WAS_AN_XM) {
-						if (!(sigdata->flags & IT_WAS_A_MOD)) {
-							if (v == 0xF0)
-								v |= channel->xm_lastE2;
-							else if (v >= 0xF0)
-								channel->xm_lastE2 = v & 15;
-							else if (v == 0xE0)
-								v |= channel->xm_lastX2;
-							else
-								channel->xm_lastX2 = v & 15;
-						}
-					} else {
-						if (v == 0)
-							v = channel->lastEF;
-						channel->lastEF = v;
-					}
-					if (channel->playing) {
-						if ((v & 0xF0) == 0xF0)
-							channel->playing->slide -= (v & 15) << 4;
-						else if ((v & 0xF0) == 0xE0)
-							channel->playing->slide -= (v & 15) << 2;
-						else
-							channel->portamento -= v << 4;
-					}
-				}
-				break;
-			case IT_PORTAMENTO_UP:
-				{
-					unsigned char v = entry->effectvalue;
-					if (sigdata->flags & IT_WAS_AN_XM) {
-						if (!(sigdata->flags & IT_WAS_A_MOD)) {
-							if (v == 0xF0)
-								v |= channel->xm_lastE1;
-							else if (v >= 0xF0)
-								channel->xm_lastE1 = v & 15;
-							else if (v == 0xE0)
-								v |= channel->xm_lastX1;
-							else
-								channel->xm_lastX1 = v & 15;
-						}
-					} else {
-						if (v == 0)
-							v = channel->lastEF;
-						channel->lastEF = v;
-					}
-					if (channel->playing) {
-						if ((v & 0xF0) == 0xF0)
-							channel->playing->slide += (v & 15) << 4;
-						else if ((v & 0xF0) == 0xE0)
-							channel->playing->slide += (v & 15) << 2;
-						else
-							channel->portamento += v << 4;
-					}
-				}
-				break;
-			case IT_XM_PORTAMENTO_DOWN:
-				{
-					unsigned char v = entry->effectvalue;
-					if (!(sigdata->flags & IT_WAS_A_MOD)) {
-						if (v == 0)
-							v = channel->lastJ;
-						channel->lastJ = v;
-					}
-					if (channel->playing)
-						channel->portamento -= v << 4;
-				}
-				break;
-			case IT_XM_PORTAMENTO_UP:
-				{
-					unsigned char v = entry->effectvalue;
-					if (!(sigdata->flags & IT_WAS_A_MOD)) {
-						if (v == 0)
-							v = channel->lastEF;
-						channel->lastEF = v;
-					}
-					if (channel->playing)
-						channel->portamento += v << 4;
-				}
-				break;
-			case IT_VIBRATO:
-				{
-					unsigned char speed = entry->effectvalue >> 4;
-					unsigned char depth = entry->effectvalue & 15;
-					if (speed == 0)
-						speed = channel->lastHspeed;
-					channel->lastHspeed = speed;
-					if (depth == 0)
-						depth = channel->lastHdepth;
-					else {
-						if (sigdata->flags & IT_OLD_EFFECTS)
-							depth <<= 3;
-						else
-							depth <<= 2;
-						channel->lastHdepth = depth;
-					}
-					if (channel->playing) {
-						channel->playing->vibrato_speed = speed;
-						channel->playing->vibrato_depth = depth;
-						channel->playing->vibrato_n++;
-					}
-				}
-				break;
-			case IT_TREMOR:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->lastI;
-					else if (!(sigdata->flags & IT_OLD_EFFECTS)) {
-						if (v & 0xF0) v -= 0x10;
-						if (v & 0x0F) v -= 0x01;
-					}
-					channel->lastI = v;
-					channel->tremor_time |= 128;
-				}
-				update_tremor(channel);
-				break;
-			case IT_ARPEGGIO:
-				{
-					unsigned char v = entry->effectvalue;
-					/* XM files have no memory for arpeggio (000 = no effect)
-					 * and we use lastJ for portamento down instead.
-					 */
-					if (!(sigdata->flags & IT_WAS_AN_XM)) {
-						if (v == 0)
-							v = channel->lastJ;
-						channel->lastJ = v;
-					}
-					channel->arpeggio = v;
-				}
-				break;
-			case IT_SET_CHANNEL_VOLUME:
-				if (sigdata->flags & IT_WAS_AN_XM)
-					channel->volume = MIN(entry->effectvalue, 64);
-				else if (entry->effectvalue <= 64)
-					channel->channelvolume = entry->effectvalue;
-#ifdef VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
-				else
-					channel->channelvolume = 64;
-#endif
-				if (channel->playing)
-					channel->playing->channel_volume = channel->channelvolume;
-				break;
-			case IT_CHANNEL_VOLUME_SLIDE:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->lastN;
-					channel->lastN = v;
-					if ((v & 0x0F) == 0) { /* Nx0 */
-						channel->channelvolslide = v >> 4;
-					} else if ((v & 0xF0) == 0) { /* N0x */
-						channel->channelvolslide = -v;
-					} else {
-						if ((v & 0x0F) == 0x0F) { /* NxF */
-							channel->channelvolume += v >> 4;
-							if (channel->channelvolume > 64) channel->channelvolume = 64;
-						} else if ((v & 0xF0) == 0xF0) { /* NFx */
-							channel->channelvolume -= v & 15;
-							if (channel->channelvolume > 64) channel->channelvolume = 0;
-						} else
-							break;
-						if (channel->playing)
-							channel->playing->channel_volume = channel->channelvolume;
-					}
-				}
-				break;
-			case IT_SET_SAMPLE_OFFSET:
-				{
-					unsigned char v = entry->effectvalue;
-					if (sigdata->flags & IT_WAS_A_MOD) {
-						if (v == 0) break;
-					} else {
-						if (v == 0)
-							v = channel->lastO;
-						channel->lastO = v;
-					}
-					/* Note: we set the offset even if tone portamento is
-					 * specified. Impulse Tracker does the same.
-					 */
-					if (entry->mask & IT_ENTRY_NOTE) {
-						if (channel->playing) {
-							int offset = ((int)channel->high_offset << 16) | ((int)v << 8);
-							IT_PLAYING *playing = channel->playing;
-							IT_SAMPLE *sample = playing->sample;
-							int end;
-							if ((sample->flags & IT_SAMPLE_SUS_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF))
-								end = sample->sus_loop_end;
-							else if (sample->flags & IT_SAMPLE_LOOP)
-								end = sample->loop_end;
-							else
-								end = sample->length;
-							if (offset < end)
-								it_playing_reset_resamplers(playing, offset);
-							else if (sigdata->flags & IT_OLD_EFFECTS)
-								it_playing_reset_resamplers(playing, end);
-						}
-					}
-				}
-				break;
-			//case IT_PANNING_SLIDE:
-				/** JULIEN: guess what? the docs are wrong! (how unusual ;)
-				 * Pxy seems to memorize its previous value... and there
-				 * might be other mistakes like that... (sigh!)
-				 */
-				/** ENTHEH: umm... but... the docs say that Pxy memorises its
-				 * value... don't they? :o
-				 */
-			case IT_RETRIGGER_NOTE:
-				{
-					unsigned char v = entry->effectvalue;
-					if (sigdata->flags & IT_WAS_AN_XM) {
-						if ((v & 0x0F) == 0) v |= channel->lastQ & 0x0F;
-						if ((v & 0xF0) == 0) v |= channel->lastQ & 0xF0;
-					} else {
-						if (v == 0)
-							v = channel->lastQ;
-					}
-					channel->lastQ = v;
-					if ((v & 0x0F) == 0) v |= 0x01;
-					channel->retrig = v;
-					if (entry->mask & IT_ENTRY_NOTE) {
-						channel->retrig_tick = v & 0x0F;
-						/* Emulate a bug */
-						if (sigdata->flags & IT_WAS_AN_XM)
-							update_retrig(channel);
-					} else
-						update_retrig(channel);
-				}
-				break;
-			case IT_XM_RETRIGGER_NOTE:
-				channel->retrig_tick = channel->xm_retrig = entry->effectvalue;
-				if (entry->effectvalue == 0)
-					if (channel->playing) it_playing_reset_resamplers(channel->playing, 0);
-				break;
-			case IT_TREMOLO:
-				{
-					unsigned char speed = entry->effectvalue >> 4;
-					unsigned char depth = entry->effectvalue & 15;
-					if (speed == 0)
-						speed = channel->lastRspeed;
-					channel->lastRspeed = speed;
-					if (depth == 0)
-						depth = channel->lastRdepth;
-					channel->lastRdepth = depth;
-					if (channel->playing) {
-						channel->playing->tremolo_speed = speed;
-						channel->playing->tremolo_depth = depth;
-					}
-				}
-				break;
-			case IT_S:
-				{
-					/* channel->lastS was set in update_pattern_variables(). */
-					unsigned char effectvalue = channel->lastS;
-					switch (effectvalue >> 4) {
-						//case IT_S_SET_FILTER:
-						//case IT_S_SET_GLISSANDO_CONTROL:
-						//case IT_S_FINETUNE:
-						//case IT_S_SET_VIBRATO_WAVEFORM:
-						//case IT_S_SET_TREMOLO_WAVEFORM:
-						//case IT_S_SET_PANBRELLO_WAVEFORM:
-							/* Waveforms for commands S3x, S4x and S5x:
-							 *   0: Sine wave
-							 *   1: Ramp down
-							 *   2: Square wave
-							 *   3: Random wave
-							 */
-						case IT_S_FINE_PATTERN_DELAY:
-							sigrenderer->tick += effectvalue & 15;
-							break;
-						//case IT_S7:
-						case IT_S_SET_PAN:
-							channel->pan =
-								((effectvalue & 15) << 2) |
-								((effectvalue & 15) >> 2);
-							channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-							break;
-						case IT_S_SET_SURROUND_SOUND:
-							if ((effectvalue & 15) == 1)
-								channel->pan = IT_SURROUND;
-							channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-							break;
-						case IT_S_SET_HIGH_OFFSET:
-							channel->high_offset = effectvalue & 15;
-							break;
-						//case IT_S_PATTERN_LOOP:
-						case IT_S_DELAYED_NOTE_CUT:
-							channel->note_cut_count = effectvalue & 15;
-							if (!channel->note_cut_count) {
-								if (sigdata->flags & IT_WAS_AN_XM)
-									channel->volume = 0;
-								else
-									channel->note_cut_count = 1;
-							}
-							break;
-						case IT_S_SET_MIDI_MACRO:
-							channel->SFmacro = effectvalue & 15;
-							break;
-					}
-				}
-				break;
-			case IT_SET_SONG_TEMPO:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->lastW;
-					channel->lastW = v;
-					if (v < 0x10)
-						sigrenderer->temposlide = -v;
-					else if (v < 0x20)
-						sigrenderer->temposlide = v & 15;
-					else
-						sigrenderer->tempo = v;
-				}
-				break;
-			case IT_FINE_VIBRATO:
-				{
-					unsigned char speed = entry->effectvalue >> 4;
-					unsigned char depth = entry->effectvalue & 15;
-					if (speed == 0)
-						speed = channel->lastHspeed;
-					channel->lastHspeed = speed;
-					if (depth == 0)
-						depth = channel->lastHdepth;
-					else {
-						if (sigdata->flags & IT_OLD_EFFECTS)
-							depth <<= 1;
-						channel->lastHdepth = depth;
-					}
-					if (channel->playing) {
-						channel->playing->vibrato_speed = speed;
-						channel->playing->vibrato_depth = depth;
-						channel->playing->vibrato_n++;
-					}
-				}
-				break;
-			case IT_SET_GLOBAL_VOLUME:
-				if (entry->effectvalue <= 128)
-					sigrenderer->globalvolume = entry->effectvalue;
-#ifdef VOLUME_OUT_OF_RANGE_SETS_MAXIMUM
-				else
-					sigrenderer->globalvolume = 128;
-#endif
-				break;
-			case IT_GLOBAL_VOLUME_SLIDE:
-				{
-					unsigned char v = entry->effectvalue;
-					if (v == 0)
-						v = channel->lastW;
-					channel->lastW = v;
-					if ((v & 0x0F) == 0) { /* Wx0 */
-						sigrenderer->globalvolslide =
-							(sigdata->flags & IT_WAS_AN_XM) ? (v >> 4)*2 : (v >> 4);
-					} else if ((v & 0xF0) == 0) { /* W0x */
-						sigrenderer->globalvolslide =
-							(sigdata->flags & IT_WAS_AN_XM) ? (-v)*2 : (-v);
-					} else if ((v & 0x0F) == 0x0F) { /* WxF */
-						sigrenderer->globalvolume += v >> 4;
-						if (sigrenderer->globalvolume > 128) sigrenderer->globalvolume = 128;
-					} else if ((v & 0xF0) == 0xF0) { /* WFx */
-						sigrenderer->globalvolume -= v & 15;
-						if (sigrenderer->globalvolume > 128) sigrenderer->globalvolume = 0;
-					}
-				}
-				break;
-			case IT_SET_PANNING:
-				channel->pan = (entry->effectvalue + 2) >> 2;
-				channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-				break;
-			//case IT_PANBRELLO:
-			case IT_MIDI_MACRO:
-				{
-					IT_MIDI *midi = sigdata->midi ? sigdata->midi : &default_midi;
-					if (entry->effectvalue >= 0x80) {
-						int n = midi->Zmacrolen[entry->effectvalue-0x80];
-						int i;
-						for (i = 0; i < n; i++)
-							it_send_midi(sigrenderer, channel, midi->Zmacro[entry->effectvalue-0x80][i]);
-					} else {
-						int n = midi->SFmacrolen[channel->SFmacro];
-						int i, j;
-						for (i = 0, j = 1; i < n; i++, j <<= 1)
-							it_send_midi(sigrenderer, channel,
-								midi->SFmacroz[channel->SFmacro] & j ?
-									entry->effectvalue : midi->SFmacro[channel->SFmacro][i]);
-					}
-				}
-				break;
-		}
-	}
-
-	if (!(sigdata->flags & IT_WAS_AN_XM))
-		post_process_it_volpan(sigrenderer, entry);
-
-	return 0;
-}
-
-
-
-static int process_it_note_data(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	// When tone portamento and instrument are specified:
-	// If Gxx is off:
-	//   - same sample, do nothing but portamento
-	//   - diff sample, retrigger all but keep current note+slide + do porta
-	//   - if instrument is invalid, nothing; if sample is invalid, cut
-	// If Gxx is on:
-	//   - same sample or new sample invalid, retrigger envelopes
-	//   - diff sample/inst, start using new envelopes
-	// When tone portamento is specified alone, sample won't change.
-	// TODO: consider what happens with instrument alone after all this...
-
-	if (entry->mask & (IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT)) {
-		if (entry->mask & IT_ENTRY_INSTRUMENT)
-			channel->instrument = entry->instrument;
-		instrument_to_sample(sigdata, channel);
-		if (channel->note < 120) {
-			if ((sigdata->flags & IT_USE_INSTRUMENTS) && channel->sample == 0)
-				return 1;
-			if (entry->mask & IT_ENTRY_INSTRUMENT)
-				get_default_volpan(sigdata, channel);
-		} else
-			it_retrigger_note(sigrenderer, channel);
-	}
-
-	/** WARNING: This is not ideal, since channel->playing might not get allocated owing to lack of memory... */
-	if (channel->playing &&
-	   (((entry->mask & IT_ENTRY_VOLPAN) && entry->volpan >= 193 && entry->volpan <= 202) ||
-	    ((entry->mask & IT_ENTRY_EFFECT) && (entry->effect == IT_TONE_PORTAMENTO || entry->effect == IT_VOLSLIDE_TONEPORTA))))
-	{
-		if (entry->mask & IT_ENTRY_INSTRUMENT) {
-			if (sigdata->flags & IT_COMPATIBLE_GXX)
-				retrigger_it_envelopes(sigdata, channel);
-			else if ((!(sigdata->flags & IT_USE_INSTRUMENTS) ||
-				(channel->instrument >= 1 && channel->instrument <= sigdata->n_instruments)) &&
-				channel->sample != channel->playing->sampnum)
-			{
-				unsigned char note = channel->playing->note;
-				int slide = channel->playing->slide;
-				it_retrigger_note(sigrenderer, channel);
-				if (channel->playing) {
-					channel->playing->note = note;
-					channel->playing->slide = slide;
-					// Should we be preserving sample_vibrato_time? depth?
-				}
-			}
-		}
-
-		if ((entry->mask & IT_ENTRY_VOLPAN) && entry->volpan >= 193 && entry->volpan <= 202) {
-			/* Tone Portamento in the volume column */
-			static const unsigned char slidetable[] = {0, 1, 4, 8, 16, 32, 64, 96, 128, 255};
-			unsigned char v = slidetable[entry->volpan - 193];
-			if (sigdata->flags & IT_COMPATIBLE_GXX) {
-				if (v == 0)
-					v = channel->lastG;
-				channel->lastG = v;
-			} else {
-				if (v == 0)
-					v = channel->lastEF;
-				channel->lastEF = v;
-			}
-			if (entry->mask & IT_ENTRY_NOTE)
-				if (channel->sample)
-					channel->destnote = channel->truenote;
-			channel->toneporta = v << 4;
-		} else {
-			/* Tone Portamento in the effect column */
-			unsigned char v;
-			if (entry->effect == IT_TONE_PORTAMENTO)
-				v = entry->effectvalue;
-			else
-				v = 0;
-			if (sigdata->flags & IT_COMPATIBLE_GXX) {
-				if (v == 0)
-					v = channel->lastG;
-				channel->lastG = v;
-			} else {
-				if (v == 0)
-					v = channel->lastEF;
-				channel->lastEF = v;
-			}
-			if (entry->mask & IT_ENTRY_NOTE)
-				if (channel->sample)
-					channel->destnote = channel->truenote;
-			channel->toneporta = v << 4;
-		}
-	} else if ((entry->mask & IT_ENTRY_NOTE) ||
-		((entry->mask & IT_ENTRY_INSTRUMENT) && (!channel->playing || entry->instrument != channel->playing->instnum)))
-	{
-		if (channel->note < 120) {
-			get_true_pan(sigdata, channel);
-			it_retrigger_note(sigrenderer, channel);
-		}
-	}
-
-	if (entry->mask & IT_ENTRY_VOLPAN) {
-		if (entry->volpan <= 64) {
-			/* Volume */
-			channel->volume = entry->volpan;
-		} else if (entry->volpan <= 74) {
-			/* Fine volume slide up */
-			unsigned char v = entry->volpan - 65;
-			if (v == 0)
-				v = channel->lastvolslide;
-			channel->lastvolslide = v;
-			/* = effect DxF where x == entry->volpan - 65 */
-			channel->volume += v;
-			if (channel->volume > 64) channel->volume = 64;
-		} else if (entry->volpan <= 84) {
-			/* Fine volume slide down */
-			unsigned char v = entry->volpan - 75;
-			if (v == 0)
-				v = channel->lastvolslide;
-			channel->lastvolslide = v;
-			/* = effect DFx where x == entry->volpan - 75 */
-			channel->volume -= v;
-			if (channel->volume > 64) channel->volume = 0;
-		} else if (entry->volpan < 128) {
-			/* Volume slide up */
-			/* Volume slide down */
-			/* Portamento down */
-			/* Portamento up */
-		} else if (entry->volpan <= 192) {
-			/* Pan */
-			channel->pan = entry->volpan - 128;
-			channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-		}
-		/* else */
-		/* Tone Portamento */
-		/* Vibrato */
-	}
-	return 0;
-}
-
-
-
-static void retrigger_xm_envelopes(IT_PLAYING *playing)
-{
-	playing->volume_envelope.next_node = 0;
-	playing->volume_envelope.tick = -1;
-	playing->pan_envelope.next_node = 0;
-	playing->pan_envelope.tick = -1;
-	playing->fadeoutcount = 1024;
-}
-
-
-
-static void process_xm_note_data(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	if (entry->mask & IT_ENTRY_INSTRUMENT) {
-		channel->instrument = entry->instrument;
-		instrument_to_sample(sigdata, channel);
-		if (channel->playing) {
-			/* Retrigger vol/pan envelopes if enabled, and cancel fadeout.
-			 * Also reset vol/pan to that of _original_ instrument.
-			 */
-			channel->playing->flags &= ~(IT_PLAYING_SUSTAINOFF | IT_PLAYING_FADING);
-			it_playing_update_resamplers(channel->playing);
-
-			channel->volume = channel->playing->sample->default_volume;
-			if (channel->pan >= 128 && channel->pan <= 192)
-				channel->pan = channel->playing->sample->default_pan - 128;
-
-			retrigger_xm_envelopes(channel->playing);
-		}
-	}
-
-	if (entry->mask & IT_ENTRY_NOTE) {
-		if (!(entry->mask & IT_ENTRY_INSTRUMENT))
-			instrument_to_sample(sigdata, channel);
-
-		if (channel->note >= 120) {
-			if (channel->playing) {
-				if (!(sigdata->instrument[channel->instrument-1].volume_envelope.flags & IT_ENVELOPE_ON))
-					if (!(entry->mask & IT_ENTRY_INSTRUMENT))
-						channel->volume = 0;
-				channel->playing->flags |= IT_PLAYING_SUSTAINOFF | IT_PLAYING_FADING;
-				it_playing_update_resamplers(channel->playing);
-			}
-		} else if (channel->sample == 0) {
-			/** If we get here, one of the following is the case:
-			 ** 1. The instrument has never been specified on this channel.
-			 ** 2. The specified instrument is invalid.
-			 ** 3. The instrument has no sample mapped to the selected note.
-			 ** What should happen?
-			 **
-			 ** Experimentation shows that any existing note stops and cannot
-			 ** be brought back. A subsequent instrument change fixes that.
-			 **/
-			if (channel->playing) {
-				free(channel->playing);
-				channel->playing = NULL;
-			}
-			return;
-		} else if (channel->playing && (entry->mask & IT_ENTRY_VOLPAN) && ((entry->volpan>>4) == 0xF)) {
-			/* Don't retrigger note; portamento in the volume column. */
-		} else if (channel->playing &&
-		           (entry->mask & IT_ENTRY_EFFECT) &&
-		           (entry->effect == IT_TONE_PORTAMENTO ||
-		            entry->effect == IT_VOLSLIDE_TONEPORTA)) {
-			/* Don't retrigger note; portamento in the effects column. */
-		} else {
-			channel->destnote = IT_NOTE_OFF;
-
-			if (!channel->playing) {
-				channel->playing = (IT_PLAYING *)malloc(sizeof(*channel->playing));
-				if (!channel->playing)
-					return;
-				// Adding the following seems to do the trick for the case where a piece starts with an instrument alone and then some notes alone.
-				retrigger_xm_envelopes(channel->playing);
-			}
-
-			channel->playing->flags = 0;
-			channel->playing->channel = channel;
-			channel->playing->sample = &sigdata->sample[channel->sample-1];
-			if (sigdata->flags & IT_USE_INSTRUMENTS)
-				channel->playing->instrument = &sigdata->instrument[channel->instrument-1];
-			else
-				channel->playing->instrument = NULL;
-			channel->playing->env_instrument = channel->playing->instrument;
-			channel->playing->sampnum = channel->sample;
-			channel->playing->instnum = channel->instrument;
-			channel->playing->channel_volume = channel->channelvolume;
-			channel->playing->note = channel->truenote;
-			channel->playing->filter_cutoff = 127;
-			channel->playing->filter_resonance = 0;
-			channel->playing->true_filter_cutoff = 127 << 8;
-			channel->playing->true_filter_resonance = 0;
-			channel->playing->vibrato_speed = 0;
-			channel->playing->vibrato_depth = 0;
-			channel->playing->vibrato_n = 0;
-			channel->playing->vibrato_time = 0;
-			channel->playing->tremolo_speed = 0;
-			channel->playing->tremolo_depth = 0;
-			channel->playing->tremolo_time = 0;
-			channel->playing->sample_vibrato_time = 0;
-			channel->playing->sample_vibrato_depth = 0;
-			channel->playing->slide = 0;
-			it_reset_filter_state(&channel->playing->filter_state[0]); // Are these
-			it_reset_filter_state(&channel->playing->filter_state[1]); // necessary?
-			it_playing_reset_resamplers(channel->playing, 0);
-
-			/** WARNING - is everything initialised? */
-		}
-	}
-
-	if ((entry->mask & (IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT)) == (IT_ENTRY_NOTE | IT_ENTRY_INSTRUMENT)) {
-		if (channel->playing) retrigger_xm_envelopes(channel->playing);
-		get_default_volpan(sigdata, channel);
-		channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-	}
-
-	if ((entry->mask & IT_ENTRY_VOLPAN) && ((entry->volpan>>4) == 0xF)) {
-		/* Tone Portamento */
-		unsigned char v = (entry->volpan & 15) << 4;
-		if (v == 0)
-			v = channel->lastG;
-		channel->lastG = v;
-		if (entry->mask & IT_ENTRY_NOTE)
-			if (channel->sample)
-				channel->destnote = channel->truenote;
-		channel->toneporta = v << 4;
-	} else if ((entry->mask & IT_ENTRY_EFFECT) &&
-	           (entry->effect == IT_TONE_PORTAMENTO ||
-	            entry->effect == IT_VOLSLIDE_TONEPORTA)) {
-		unsigned char v;
-		if (entry->effect == IT_TONE_PORTAMENTO)
-			v = entry->effectvalue;
-		else
-			v = 0;
-		if (v == 0)
-			v = channel->lastG;
-		channel->lastG = v;
-		if (entry->mask & IT_ENTRY_NOTE)
-			if (channel->sample)
-				channel->destnote = channel->truenote;
-		channel->toneporta = v << 4;
-	}
-
-	if (entry->mask & IT_ENTRY_VOLPAN) {
-		int effect = entry->volpan >> 4;
-		int value  = entry->volpan & 15;
-		switch (effect) {
-			case 0x6: /* Volume slide down */
-				channel->xm_volslide = -value;
-				break;
-			case 0x7: /* Volume slide up */
-				channel->xm_volslide = value;
-				break;
-			case 0x8: /* Fine volume slide down */
-				channel->volume -= value;
-				if (channel->volume > 64) channel->volume = 0;
-				break;
-			case 0x9: /* Fine volume slide up */
-				channel->volume += value;
-				if (channel->volume > 64) channel->volume = 64;
-				break;
-			case 0xA: /* Set vibrato speed */
-				if (value)
-					channel->lastHspeed = value;
-				if (channel->playing)
-					channel->playing->vibrato_speed = channel->lastHspeed;
-				break;
-			case 0xB: /* Vibrato */
-				if (value)
-					channel->lastHdepth = value << 2; /** WARNING: correct ? */
-				if (channel->playing) {
-					channel->playing->vibrato_depth = channel->lastHdepth;
-					channel->playing->vibrato_speed = channel->lastHspeed;
-					channel->playing->vibrato_n++;
-				}
-				break;
-			case 0xC: /* Set panning */
-				channel->pan = (value*64)/15;
-				channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-				break;
-			case 0xD: /* Pan slide left */
-				// TODO
-				// channel->xm_panslide = -value;
-				break;
-			case 0xE: /* Pan slide Right */
-				// TODO
-				// channel->xm_panslide = value;
-				break;
-			case 0xF: /* Tone porta */
-				break;
-			default:  /* Volume */
-				channel->volume = entry->volpan - 0x10;
-				break;
-		}
-	}
-}
-
-
-
-/* This function assumes !IT_IS_END_ROW(entry). */
-static int process_note_data(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-
-	if (sigdata->flags & IT_WAS_AN_XM)
-		process_xm_note_data(sigrenderer, entry);
-	else
-		if (process_it_note_data(sigrenderer, entry)) return 0;
-
-	return process_effects(sigrenderer, entry);
-}
-
-
-
-static int process_entry(DUMB_IT_SIGRENDERER *sigrenderer, IT_ENTRY *entry)
-{
-	IT_CHANNEL *channel = &sigrenderer->channel[(int)entry->channel];
-
-	if (entry->mask & IT_ENTRY_NOTE)
-		channel->note = entry->note;
-
-	if ((entry->mask & IT_ENTRY_EFFECT) && entry->effect == IT_S) {
-		/* channel->lastS was set in update_pattern_variables(). */
-		unsigned char effectvalue = channel->lastS;
-		if (effectvalue >> 4 == IT_S_NOTE_DELAY) {
-			channel->note_delay_count = effectvalue & 15;
-			if (channel->note_delay_count == 0)
-				channel->note_delay_count = 1;
-			channel->note_delay_entry = entry;
-			return 0;
-		}
-	}
-
-	return process_note_data(sigrenderer, entry);
-}
-
-
-
-static void update_tick_counts(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	int i;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-
-		if (channel->note_cut_count) {
-			channel->note_cut_count--;
-			if (channel->note_cut_count == 0) {
-				if (sigrenderer->sigdata->flags & IT_WAS_AN_XM)
-					channel->volume = 0;
-				else if (channel->playing) {
-					free(channel->playing);
-					channel->playing = NULL;
-				}
-			}
-		} else if (channel->note_delay_count) {
-			channel->note_delay_count--;
-			if (channel->note_delay_count == 0)
-				process_note_data(sigrenderer, channel->note_delay_entry);
-					/* Don't bother checking the return value; if the note
-					 * was delayed, there can't have been a speed=0.
-					 */
-		}
-	}
-}
-
-
-
-static int envelope_get_y(IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe)
-{
-	int ys, ye;
-	int ts, te;
-	int t;
-
-	if (pe->next_node <= 0)
-		return envelope->node_y[0] << IT_ENVELOPE_SHIFT;
-
-	if (pe->next_node >= envelope->n_nodes)
-		return envelope->node_y[envelope->n_nodes-1] << IT_ENVELOPE_SHIFT;
-
-	ys = envelope->node_y[pe->next_node-1] << IT_ENVELOPE_SHIFT;
-	ts = envelope->node_t[pe->next_node-1];
-	te = envelope->node_t[pe->next_node];
-
-	if (ts == te)
-		return ys;
-
-	ye = envelope->node_y[pe->next_node] << IT_ENVELOPE_SHIFT;
-
-	t = pe->tick;
-
-	return ys + (ye - ys) * (t - ts) / (te - ts);
-}
-
-
-
-static int it_envelope_end(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe)
-{
-	if (pe->next_node >= envelope->n_nodes)
-		return 1;
-
-	if (pe->tick < envelope->node_t[pe->next_node]) return 0;
-
-	if ((envelope->flags & IT_ENVELOPE_LOOP_ON) &&
-	    envelope->loop_end >= pe->next_node &&
-	    envelope->node_t[envelope->loop_end] <= pe->tick) return 0;
-
-	if ((envelope->flags & IT_ENVELOPE_SUSTAIN_LOOP) &&
-	    !(playing->flags & IT_PLAYING_SUSTAINOFF) &&
-	    envelope->sus_loop_end >= pe->next_node &&
-	    envelope->node_t[envelope->sus_loop_end] <= pe->tick) return 0;
-
-	if (envelope->node_t[envelope->n_nodes-1] <= pe->tick) return 1;
-
-	return 0;
-}
-
-
-
-/* This returns 1 if the envelope finishes. */
-static int update_it_envelope(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe)
-{
-	if (!(envelope->flags & IT_ENVELOPE_ON))
-		return 0;
-
-	if (pe->next_node >= envelope->n_nodes)
-		return 1;
-
-	while (pe->tick >= envelope->node_t[pe->next_node]) {
-		if ((envelope->flags & IT_ENVELOPE_LOOP_ON) && pe->next_node == envelope->loop_end) {
-			pe->next_node = envelope->loop_start;
-			pe->tick = envelope->node_t[envelope->loop_start];
-			return it_envelope_end(playing, envelope, pe);
-		}
-		if ((envelope->flags & IT_ENVELOPE_SUSTAIN_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF) && pe->next_node == envelope->sus_loop_end) {
-			pe->next_node = envelope->sus_loop_start;
-			pe->tick = envelope->node_t[envelope->sus_loop_start];
-			return it_envelope_end(playing, envelope, pe);
-		}
-
-		pe->next_node++;
-
-		if (pe->next_node >= envelope->n_nodes)
-			return 1;
-	}
-
-	pe->tick++;
-
-	return it_envelope_end(playing, envelope, pe);
-}
-
-
-
-static void update_it_envelopes(IT_PLAYING *playing)
-{
-	IT_ENVELOPE *envelope = &playing->env_instrument->volume_envelope;
-
-	if (update_it_envelope(playing, envelope, &playing->volume_envelope)) {
-		playing->flags |= IT_PLAYING_FADING;
-		if (envelope->n_nodes && envelope->node_y[envelope->n_nodes-1] == 0)
-			playing->flags |= IT_PLAYING_DEAD;
-	}
-
-	update_it_envelope(playing, &playing->env_instrument->pan_envelope, &playing->pan_envelope);
-	update_it_envelope(playing, &playing->env_instrument->pitch_envelope, &playing->pitch_envelope);
-}
-
-
-
-static int xm_envelope_is_sustaining(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe)
-{
-	if ((envelope->flags & IT_ENVELOPE_SUSTAIN_LOOP) && !(playing->flags & IT_PLAYING_SUSTAINOFF))
-		if (envelope->sus_loop_start < envelope->n_nodes)
-			if (pe->tick == envelope->node_t[envelope->sus_loop_start])
-				return 1;
-	return 0;
-}
-
-
-
-static void update_xm_envelope(IT_PLAYING *playing, IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe)
-{
-	if (!(envelope->flags & IT_ENVELOPE_ON))
-		return;
-
-	if (xm_envelope_is_sustaining(playing, envelope, pe))
-		return;
-
-	if (pe->tick >= envelope->node_t[envelope->n_nodes-1])
-		return;
-
-	pe->tick++;
-
-	/* pe->next_node must be kept up to date for envelope_get_y(). */
-	while (pe->tick > envelope->node_t[pe->next_node])
-		pe->next_node++;
-
-	if ((envelope->flags & IT_ENVELOPE_LOOP_ON) && envelope->loop_end < envelope->n_nodes) {
-		if (pe->tick == envelope->node_t[envelope->loop_end]) {
-			pe->next_node = MID(0, envelope->loop_start, envelope->n_nodes - 1);
-			pe->tick = envelope->node_t[pe->next_node];
-		}
-	}
-
-	if (xm_envelope_is_sustaining(playing, envelope, pe))
-		return;
-
-	if (pe->tick >= envelope->node_t[envelope->n_nodes-1])
-		return;
-}
-
-
-
-static void update_xm_envelopes(IT_PLAYING *playing)
-{
-	update_xm_envelope(playing, &playing->env_instrument->volume_envelope, &playing->volume_envelope);
-	update_xm_envelope(playing, &playing->env_instrument->pan_envelope, &playing->pan_envelope);
-}
-
-
-
-static void update_fadeout(DUMB_IT_SIGDATA *sigdata, IT_PLAYING *playing)
-{
-	if (playing->flags & IT_PLAYING_FADING) {
-		playing->fadeoutcount -= playing->env_instrument->fadeout;
-		if (playing->fadeoutcount <= 0) {
-			playing->fadeoutcount = 0;
-			if (!(sigdata->flags & IT_WAS_AN_XM))
-				playing->flags |= IT_PLAYING_DEAD;
-		}
-	}
-}
-
-
-
-static void process_playing(DUMB_IT_SIGDATA *sigdata, IT_PLAYING *playing)
-{
-	if (playing->instrument) {
-		if (sigdata->flags & IT_WAS_AN_XM)
-			update_xm_envelopes(playing);
-		else
-			update_it_envelopes(playing);
-		update_fadeout(sigdata, playing);
-	}
-
-	//Calculate final volume if required
-	//Calculate final pan if required
-
-	if (sigdata->flags & IT_WAS_AN_XM) {
-		/* 'depth' is used to store the tick number for XM files. */
-		if (playing->sample_vibrato_depth < playing->sample->vibrato_rate)
-			playing->sample_vibrato_depth++;
-	} else {
-		playing->sample_vibrato_depth += playing->sample->vibrato_rate;
-		if (playing->sample_vibrato_depth > playing->sample->vibrato_depth << 8)
-			playing->sample_vibrato_depth = playing->sample->vibrato_depth << 8;
-	}
-
-	playing->sample_vibrato_time += playing->sample->vibrato_speed;
-}
-
-
-
-static void process_all_playing(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-	int i;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-		IT_PLAYING *playing = channel->playing;
-
-		if (playing) {
-			int vibrato_shift = it_sine[playing->vibrato_time];
-			vibrato_shift *= playing->vibrato_n;
-			vibrato_shift *= playing->vibrato_depth;
-			vibrato_shift >>= 4;
-
-			if (sigdata->flags & IT_OLD_EFFECTS)
-				vibrato_shift = -vibrato_shift;
-
-			playing->volume = channel->volume;
-			playing->pan = channel->truepan;
-
-			if (sigdata->flags & IT_LINEAR_SLIDES) {
-				int currpitch = ((playing->note - 60) << 8) + playing->slide
-				                                            + vibrato_shift;
-
-				/* We add a feature here, which is that of keeping the pitch
-				 * within range. Otherwise it crashes. Trust me. It happened.
-				 * The limit 32768 gives almost 11 octaves either way.
-				 */
-				if (currpitch < -32768)
-					currpitch = -32768;
-				else if (currpitch > 32767)
-					currpitch = 32767;
-
-				playing->delta = (float)pow(DUMB_PITCH_BASE, currpitch);
-				playing->delta *= playing->sample->C5_speed / 65536.0f;
-			} else {
-				int slide = playing->slide + vibrato_shift;
-
-				playing->delta = (float)pow(DUMB_SEMITONE_BASE, 60 - playing->note);
-				/* playing->delta is 1.0 for C-5, 0.5 for C-6, etc. */
-
-				playing->delta *= 1.0f / playing->sample->C5_speed;
-
-				playing->delta -= slide / AMIGA_DIVISOR;
-
-				if (playing->delta < (1.0f / 65536.0f) / 32768.0f) {
-					// Should XM notes die if Amiga slides go out of range?
-					playing->flags |= IT_PLAYING_DEAD;
-					continue;
-				}
-
-				playing->delta = (1.0f / 65536.0f) / playing->delta;
-			}
-
-			playing->delta *= (float)pow(DUMB_SEMITONE_BASE, channel->arpeggio >> 8);
-
-			playing->filter_cutoff = channel->filter_cutoff;
-			playing->filter_resonance = channel->filter_resonance;
-		}
-	}
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		if (sigrenderer->channel[i].playing) {
-			process_playing(sigdata, sigrenderer->channel[i].playing);
-			if (!(sigdata->flags & IT_WAS_AN_XM)) {
-				if ((sigrenderer->channel[i].playing->flags & (IT_PLAYING_BACKGROUND | IT_PLAYING_DEAD)) == (IT_PLAYING_BACKGROUND | IT_PLAYING_DEAD)) {
-					free(sigrenderer->channel[i].playing);
-					sigrenderer->channel[i].playing = NULL;
-				}
-			}
-		}
-	}
-
-	for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
-		if (sigrenderer->playing[i]) {
-			process_playing(sigdata, sigrenderer->playing[i]);
-			if (sigrenderer->playing[i]->flags & IT_PLAYING_DEAD) {
-				free(sigrenderer->playing[i]);
-				sigrenderer->playing[i] = NULL;
-			}
-		}
-	}
-}
-
-
-
-static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer)
-{
-	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
-
-	// Set note vol/freq to vol/freq set for each channel
-
-	if (sigrenderer->speed && --sigrenderer->tick == 0) {
-		reset_tick_counts(sigrenderer);
-		sigrenderer->tick = sigrenderer->speed;
-		sigrenderer->rowcount--;
-		if (sigrenderer->rowcount == 0) {
-			sigrenderer->rowcount = 1;
-			if (sigrenderer->pat_loop_row >= 0) {
-				int n = sigrenderer->pat_loop_row - 1;
-				sigrenderer->row = sigrenderer->processrow = n;
-				sigrenderer->pat_loop_row = -1;
-				if (n < 0)
-					sigrenderer->entry = NULL;
-				else {
-					sigrenderer->entry = sigrenderer->entry_start;
-					while (n) {
-						while (sigrenderer->entry < sigrenderer->entry_end) {
-							if (IT_IS_END_ROW(sigrenderer->entry)) {
-								sigrenderer->entry++;
-								break;
-							}
-							sigrenderer->entry++;
-						}
-						n--;
-					}
-				}
-			}
-
-			sigrenderer->processrow++;
-
-			if (sigrenderer->processrow >= sigrenderer->n_rows) {
-				IT_PATTERN *pattern;
-				int n;
-
-				sigrenderer->processrow = sigrenderer->breakrow;
-				sigrenderer->breakrow = 0;
-
-				for (;;) {
-					sigrenderer->processorder++;
-
-					if (sigrenderer->processorder >= sigdata->n_orders) {
-						sigrenderer->processorder = sigdata->restart_position;
-						if (sigrenderer->processorder >= sigdata->n_orders) {
-							/* Restarting beyond end. We'll loop for now. */
-							sigrenderer->processorder = -1;
-							continue;
-						}
-					}
-
-					n = sigdata->order[sigrenderer->processorder];
-
-					if (n < sigdata->n_patterns)
-						break;
-
-#ifdef INVALID_ORDERS_END_SONG
-					if (n != IT_ORDER_SKIP)
-						sigrenderer->processorder = -1;
-#else
-					if (n == IT_ORDER_END)
-						sigrenderer->processorder = -1;
-#endif
-				}
-
-				pattern = &sigdata->pattern[n];
-
-				sigrenderer->n_rows = pattern->n_rows;
-
-				if (sigrenderer->processrow >= sigrenderer->n_rows)
-					sigrenderer->processrow = 0;
-
-/** WARNING - everything pertaining to a new pattern initialised? */
-
-				sigrenderer->entry = sigrenderer->entry_start = pattern->entry;
-				sigrenderer->entry_end = sigrenderer->entry + pattern->n_entries;
-
-				if (sigrenderer->order >= sigrenderer->processorder) {
-					if (sigrenderer->callbacks->loop) {
-						if ((*sigrenderer->callbacks->loop)(sigrenderer->callbacks->loop_data))
-							return 1;
-						if (sigrenderer->speed == 0)
-							goto speed0; /* I love goto */
-					}
-				}
-				sigrenderer->order = sigrenderer->processorder;
-
-				n = sigrenderer->processrow;
-				while (n) {
-					while (sigrenderer->entry < sigrenderer->entry_end) {
-						if (IT_IS_END_ROW(sigrenderer->entry)) {
-							sigrenderer->entry++;
-							break;
-						}
-						sigrenderer->entry++;
-					}
-					n--;
-				}
-				sigrenderer->row = sigrenderer->processrow;
-			} else {
-				if (sigrenderer->entry) {
-					while (sigrenderer->entry < sigrenderer->entry_end) {
-						if (IT_IS_END_ROW(sigrenderer->entry)) {
-							sigrenderer->entry++;
-							break;
-						}
-						sigrenderer->entry++;
-					}
-					sigrenderer->row++;
-				} else {
-					sigrenderer->entry = sigrenderer->entry_start;
-					sigrenderer->row = 0;
-				}
-			}
-
-			reset_effects(sigrenderer);
-
-			{
-				IT_ENTRY *entry = sigrenderer->entry;
-
-				while (entry < sigrenderer->entry_end && !IT_IS_END_ROW(entry))
-					update_pattern_variables(sigrenderer, entry++);
-			}
-
-			{
-				IT_ENTRY *entry = sigrenderer->entry;
-
-				while (entry < sigrenderer->entry_end && !IT_IS_END_ROW(entry))
-					if (process_entry(sigrenderer, entry++))
-						return 1;
-			}
-
-			if (!(sigdata->flags & IT_OLD_EFFECTS))
-				update_smooth_effects(sigrenderer);
-		} else {
-			{
-				IT_ENTRY *entry = sigrenderer->entry;
-
-				while (entry < sigrenderer->entry_end && !IT_IS_END_ROW(entry))
-					process_effects(sigrenderer, entry++);
-						/* Don't bother checking the return value; if there
-						 * was a pattern delay, there can't be a speed=0.
-						 */
-			}
-
-			update_effects(sigrenderer);
-		}
-	} else {
-		speed0:
-		update_effects(sigrenderer);
-		update_tick_counts(sigrenderer);
-	}
-
-	process_all_playing(sigrenderer);
-
-	sigrenderer->time_left += TICK_TIME_DIVIDEND / sigrenderer->tempo;
-
-	return 0;
-}
-
-
-
-int dumb_it_max_to_mix = 64;
-
-
-
-static float calculate_volume(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float volume)
-{
-	if (volume != 0) {
-		int vol;
-
-		if (playing->channel->flags & IT_CHANNEL_MUTED)
-			return 0;
-
-		if ((playing->channel->tremor_time & 192) == 128)
-			return 0;
-
-		vol = it_sine[playing->tremolo_time];
-		vol *= playing->tremolo_depth;
-
-		vol = (playing->volume << 5) + vol;
-
-		if (vol <= 0)
-			return 0;
-
-		if (vol > 64 << 5)
-			vol = 64 << 5;
-
-		volume *= vol; /* 64 << 5 */
-		volume *= playing->sample->global_volume; /* 64 */
-		volume *= playing->channel_volume; /* 64 */
-		volume *= sigrenderer->globalvolume; /* 128 */
-		volume *= sigrenderer->sigdata->mixing_volume; /* 128 */
-		volume *= 1.0f / ((64 << 5) * 64.0f * 64.0f * 128.0f * 128.0f);
-
-		if (volume && playing->instrument) {
-			if (playing->env_instrument->volume_envelope.flags & IT_ENVELOPE_ON) {
-				volume *= envelope_get_y(&playing->env_instrument->volume_envelope, &playing->volume_envelope);
-				volume *= 1.0f / (64 << IT_ENVELOPE_SHIFT);
-			}
-			volume *= playing->instrument->global_volume; /* 128 */
-			volume *= playing->fadeoutcount; /* 1024 */
-			volume *= 1.0f / (128.0f * 1024.0f);
-		}
-	}
-
-	return volume;
-}
-
-
-
-static int apply_pan_envelope(IT_PLAYING *playing)
-{
-	int pan = playing->pan;
-	if (pan <= 64 << IT_ENVELOPE_SHIFT && playing->env_instrument && (playing->env_instrument->pan_envelope.flags & IT_ENVELOPE_ON)) {
-		int p = envelope_get_y(&playing->env_instrument->pan_envelope, &playing->pan_envelope);
-		if (pan > 32 << IT_ENVELOPE_SHIFT)
-			p *= (64 << IT_ENVELOPE_SHIFT) - pan;
-		else
-			p *= pan;
-		pan += p >> (5 + IT_ENVELOPE_SHIFT);
-	}
-	return pan;
-}
-
-
-
-/* Note: if a click remover is provided, and store_end_sample is set, then
- * the end point will be computed twice. This situation should not arise.
- */
-static long render_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float volume, float delta, long pos, long size, sample_t **samples, int store_end_sample, int *left_to_mix)
-{
-	int pan;
-
-	long size_rendered;
-
-	if (playing->flags & IT_PLAYING_DEAD)
-		return 0;
-
-	if (*left_to_mix <= 0)
-		volume = 0;
-
-	pan = apply_pan_envelope(playing);
-
-#define RESAMPLERV(rv, resampler, dst, volume)				 \
-{															 \
-	rv = dumb_resample(resampler, dst, size, volume, delta); \
-	if (store_end_sample)									 \
-		(dst)[rv] = RESAMPLE_VALUE(resampler, volume);		 \
-}
-
-#define RESAMPLE(resampler, dst, volume)   \
-{										   \
-	int i;								   \
-	RESAMPLERV(i, resampler, dst, volume); \
-}
-
-#define RESAMPLE_VALUE(resampler, volume) \
-	dumb_resample_get_current_sample(resampler, volume)
-
-	if (volume == 0) {
-		size_rendered = dumb_resample(&playing->resampler[0], NULL, size, 0, delta);
-		if (playing->sample->flags & IT_SAMPLE_STEREO)
-			dumb_resample(&playing->resampler[1], NULL, size, 0, delta);
-	} else {
-		if (sigrenderer->n_channels == 2) {
-			float vol = volume;
-			DUMB_RESAMPLER start = playing->resampler[0];
-			if (!IT_IS_SURROUND_SHIFTED(pan)) vol *= 2.0f - pan * (1.0f / (32 << IT_ENVELOPE_SHIFT));
-			if (sigrenderer->click_remover && sigrenderer->click_remover[0])
-				dumb_record_click(sigrenderer->click_remover[0], pos, RESAMPLE_VALUE(&playing->resampler[0], vol));
-			RESAMPLERV(size_rendered, &playing->resampler[0], samples[0] + pos, vol);
-			if (sigrenderer->click_remover && sigrenderer->click_remover[0])
-				dumb_record_click(sigrenderer->click_remover[0], pos + size_rendered, -RESAMPLE_VALUE(&playing->resampler[0], vol));
-			vol = -vol;
-			if (!IT_IS_SURROUND_SHIFTED(pan)) vol += 2.0f * volume;
-			if (playing->sample->flags & IT_SAMPLE_STEREO) {
-				if (sigrenderer->click_remover && sigrenderer->click_remover[1])
-					dumb_record_click(sigrenderer->click_remover[1], pos, RESAMPLE_VALUE(&playing->resampler[1], vol));
-				RESAMPLE(&playing->resampler[1], samples[1] + pos, vol);
-				if (sigrenderer->click_remover && sigrenderer->click_remover[1])
-					dumb_record_click(sigrenderer->click_remover[1], pos + size_rendered, -RESAMPLE_VALUE(&playing->resampler[1], vol));
-			} else {
-				playing->resampler[0] = start;
-				if (sigrenderer->click_remover && sigrenderer->click_remover[1])
-					dumb_record_click(sigrenderer->click_remover[1], pos, RESAMPLE_VALUE(&playing->resampler[0], vol));
-				RESAMPLE(&playing->resampler[0], samples[1] + pos, vol);
-				if (sigrenderer->click_remover && sigrenderer->click_remover[1])
-					dumb_record_click(sigrenderer->click_remover[1], pos + size_rendered, -RESAMPLE_VALUE(&playing->resampler[0], vol));
-			}
-		} else {
-			if (playing->sample->flags & IT_SAMPLE_STEREO) {
-				float vol = 0.5f * volume;
-				if (!IT_IS_SURROUND_SHIFTED(pan)) vol *= 2.0f - pan * (1.0f / (32 << IT_ENVELOPE_SHIFT));
-				if (sigrenderer->click_remover && sigrenderer->click_remover[0]) {
-					sample_t startstep, endstep;
-					startstep = RESAMPLE_VALUE(&playing->resampler[0], vol);
-					RESAMPLE(&playing->resampler[0], samples[0] + pos, vol);
-					endstep = RESAMPLE_VALUE(&playing->resampler[0], vol);
-					if (!IT_IS_SURROUND_SHIFTED(pan)) vol = 2.0f * volume - vol;
-					startstep += RESAMPLE_VALUE(&playing->resampler[1], vol);
-					RESAMPLERV(size_rendered, &playing->resampler[1], samples[0] + pos, vol);
-					endstep += RESAMPLE_VALUE(&playing->resampler[1], vol);
-					dumb_record_click(sigrenderer->click_remover[0], pos, startstep);
-					dumb_record_click(sigrenderer->click_remover[0], pos + size_rendered, -endstep);
-				} else {
-					RESAMPLE(&playing->resampler[0], samples[0] + pos, vol);
-					if (!IT_IS_SURROUND_SHIFTED(pan)) vol = 2.0f * volume - vol;
-					RESAMPLERV(size_rendered, &playing->resampler[1], samples[0] + pos, vol);
-				}
-			} else {
-				if (sigrenderer->click_remover && sigrenderer->click_remover[0])
-					dumb_record_click(sigrenderer->click_remover[0], pos, RESAMPLE_VALUE(&playing->resampler[0], volume));
-				RESAMPLERV(size_rendered, &playing->resampler[0], samples[0] + pos, volume);
-				if (sigrenderer->click_remover && sigrenderer->click_remover[0])
-					dumb_record_click(sigrenderer->click_remover[0], pos + size_rendered, -RESAMPLE_VALUE(&playing->resampler[0], volume));
-			}
-		}
-		(*left_to_mix)--;
-	}
-
-	if (playing->resampler[0].dir == 0)
-		playing->flags |= IT_PLAYING_DEAD;
-
-	return size_rendered;
-}
-
-
-
-typedef struct IT_TO_MIX
-{
-	IT_PLAYING *playing;
-	float volume;
-}
-IT_TO_MIX;
-
-
-
-static int it_to_mix_compare(const void *e1, const void *e2)
-{
-	if (((const IT_TO_MIX *)e1)->volume > ((const IT_TO_MIX *)e2)->volume)
-		return -1;
-
-	if (((const IT_TO_MIX *)e1)->volume < ((const IT_TO_MIX *)e2)->volume)
-		return 1;
-
-	return 0;
-}
-
-
-
-static void apply_pitch_modifications(DUMB_IT_SIGDATA *sigdata, IT_PLAYING *playing, float *delta, int *cutoff)
-{
-	{
-		int sample_vibrato_shift = it_sine[playing->sample_vibrato_time];
-
-		if (sigdata->flags & IT_WAS_AN_XM) {
-			int depth = playing->sample->vibrato_depth; /* True depth */
-			if (playing->sample->vibrato_rate) {
-				depth *= playing->sample_vibrato_depth; /* Tick number */
-				depth /= playing->sample->vibrato_rate; /* XM sweep */
-			}
-			sample_vibrato_shift *= depth;
-		} else
-			sample_vibrato_shift *= playing->sample_vibrato_depth >> 8;
-
-		sample_vibrato_shift >>= 4;
-
-		*delta *= (float)pow(DUMB_PITCH_BASE, sample_vibrato_shift);
-	}
-
-	if (playing->env_instrument &&
-		(playing->env_instrument->pitch_envelope.flags & IT_ENVELOPE_ON))
-	{
-		int p = envelope_get_y(&playing->env_instrument->pitch_envelope, &playing->pitch_envelope);
-		if (playing->env_instrument->pitch_envelope.flags & IT_ENVELOPE_PITCH_IS_FILTER)
-			*cutoff = (*cutoff * (p+(32<<IT_ENVELOPE_SHIFT))) >> (6 + IT_ENVELOPE_SHIFT);
-		else
-			*delta *= (float)pow(DUMB_PITCH_BASE, p >> (IT_ENVELOPE_SHIFT - 7));
-	}
-}
-
-
-
-static void render(DUMB_IT_SIGRENDERER *sigrenderer, float volume, float delta, long pos, long size, sample_t **samples)
-{
-	int i;
-
-	int n_to_mix = 0;
-	IT_TO_MIX to_mix[DUMB_IT_TOTAL_CHANNELS];
-	int left_to_mix = dumb_it_max_to_mix;
-
-	sample_t **samples_to_filter = NULL;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		if (sigrenderer->channel[i].playing && !(sigrenderer->channel[i].playing->flags & IT_PLAYING_DEAD)) {
-			to_mix[n_to_mix].playing = sigrenderer->channel[i].playing;
-			to_mix[n_to_mix].volume = volume == 0 ? 0 : calculate_volume(sigrenderer, sigrenderer->channel[i].playing, volume);
-			n_to_mix++;
-		}
-	}
-
-	for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
-		if (sigrenderer->playing[i]) { /* Won't be dead; it would have been freed. */
-			to_mix[n_to_mix].playing = sigrenderer->playing[i];
-			to_mix[n_to_mix].volume = volume == 0 ? 0 : calculate_volume(sigrenderer, sigrenderer->playing[i], volume);
-			n_to_mix++;
-		}
-	}
-
-	if (volume != 0)
-		qsort(to_mix, n_to_mix, sizeof(IT_TO_MIX), &it_to_mix_compare);
-
-	for (i = 0; i < n_to_mix; i++) {
-		IT_PLAYING *playing = to_mix[i].playing;
-		float note_delta = delta * playing->delta;
-		int cutoff = playing->filter_cutoff << IT_ENVELOPE_SHIFT;
-
-		apply_pitch_modifications(sigrenderer->sigdata, playing, &note_delta, &cutoff);
-
-		if (cutoff != 127 << IT_ENVELOPE_SHIFT || playing->filter_resonance != 0) {
-			playing->true_filter_cutoff = cutoff;
-			playing->true_filter_resonance = playing->filter_resonance;
-		}
-
-		if (to_mix[i].volume && (playing->true_filter_cutoff != 127 << IT_ENVELOPE_SHIFT || playing->true_filter_resonance != 0)) {
-			if (!samples_to_filter) {
-				samples_to_filter = create_sample_buffer(sigrenderer->n_channels, size + 1);
-				if (!samples_to_filter) {
-					render_playing(sigrenderer, playing, 0, note_delta, pos, size, NULL, 0, &left_to_mix);
-					continue;
-				}
-			}
-			{
-				long size_rendered;
-				DUMB_CLICK_REMOVER **cr = sigrenderer->click_remover;
-				dumb_silence(samples_to_filter[0], sigrenderer->n_channels * (size + 1));
-				sigrenderer->click_remover = NULL;
-				size_rendered = render_playing(sigrenderer, playing, to_mix[i].volume, note_delta, 0, size, samples_to_filter, 1, &left_to_mix);
-				sigrenderer->click_remover = cr;
-				it_filter(cr ? cr[0] : NULL, &playing->filter_state[0], samples[0], pos, samples_to_filter[0], size_rendered,
-					65536.0f/delta, playing->true_filter_cutoff, playing->true_filter_resonance);
-				if (sigrenderer->n_channels == 2)
-					it_filter(cr ? cr[1] : NULL, &playing->filter_state[1], samples[1], pos, samples_to_filter[1], size_rendered,
-						65536.0f/delta, playing->true_filter_cutoff, playing->true_filter_resonance);
-				// warning: filtering is not prevented by low left_to_mix!
-			}
-		} else {
-			it_reset_filter_state(&playing->filter_state[0]);
-			it_reset_filter_state(&playing->filter_state[1]);
-			render_playing(sigrenderer, playing, to_mix[i].volume, note_delta, pos, size, samples, 0, &left_to_mix);
-		}
-	}
-
-	destroy_sample_buffer(samples_to_filter);
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		if (sigrenderer->channel[i].playing) {
-			if ((sigrenderer->channel[i].playing->flags & (IT_PLAYING_BACKGROUND | IT_PLAYING_DEAD)) == (IT_PLAYING_BACKGROUND | IT_PLAYING_DEAD)) {
-				free(sigrenderer->channel[i].playing);
-				sigrenderer->channel[i].playing = NULL;
-			}
-		}
-	}
-
-	for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++) {
-		if (sigrenderer->playing[i]) {
-			if (sigrenderer->playing[i]->flags & IT_PLAYING_DEAD) {
-				free(sigrenderer->playing[i]);
-				sigrenderer->playing[i] = NULL;
-			}
-		}
-	}
-}
-
-
-
-static DUMB_IT_SIGRENDERER *init_sigrenderer(DUMB_IT_SIGDATA *sigdata, int n_channels, int startorder, IT_CALLBACKS *callbacks, DUMB_CLICK_REMOVER **cr)
-{
-	DUMB_IT_SIGRENDERER *sigrenderer;
-	int i;
-
-	if (startorder > sigdata->n_orders) {
-		free(callbacks);
-		dumb_destroy_click_remover_array(n_channels, cr);
-		return NULL;
-	}
-
-	sigrenderer = (DUMB_IT_SIGRENDERER *)malloc(sizeof(*sigrenderer));
-	if (!sigrenderer) {
-		free(callbacks);
-		dumb_destroy_click_remover_array(n_channels, cr);
-		return NULL;
-	}
-
-	sigrenderer->callbacks = callbacks;
-	sigrenderer->click_remover = cr;
-
-	sigrenderer->sigdata = sigdata;
-	sigrenderer->n_channels = n_channels;
-	sigrenderer->globalvolume = sigdata->global_volume;
-	sigrenderer->tempo = sigdata->tempo;
-
-	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
-		IT_CHANNEL *channel = &sigrenderer->channel[i];
-#if IT_CHANNEL_MUTED != 1
-#error this is wrong
-#endif
-		channel->flags = sigdata->channel_pan[i] >> 7;
-		channel->volume = (sigdata->flags & IT_WAS_AN_XM) ? 0 : 64;
-		channel->pan = sigdata->channel_pan[i] & 0x7F;
-		channel->truepan = channel->pan << IT_ENVELOPE_SHIFT;
-		channel->channelvolume = sigdata->channel_volume[i];
-		channel->instrument = 0;
-		channel->note = 0;
-		channel->SFmacro = 0;
-		channel->filter_cutoff = 127;
-		channel->filter_resonance = 0;
-		channel->xm_retrig = 0;
-		channel->retrig_tick = 0;
-		channel->tremor_time = 0;
-		channel->midi_state = 0;
-		channel->lastvolslide = 0;
-		channel->lastDKL = 0;
-		channel->lastEF = 0;
-		channel->lastG = 0;
-		channel->lastHspeed = 0;
-		channel->lastHdepth = 0;
-		channel->lastRspeed = 0;
-		channel->lastRdepth = 0;
-		channel->lastI = 0;
-		channel->lastJ = 0;
-		channel->lastN = 0;
-		channel->lastO = 0;
-		channel->high_offset = 0;
-		channel->lastQ = 0;
-		channel->lastS = 0;
-		channel->pat_loop_row = 0;
-		channel->pat_loop_count = 0;
-		channel->lastW = 0;
-		channel->xm_lastE1 = 0;
-		channel->xm_lastE2 = 0;
-		channel->xm_lastEA = 0;
-		channel->xm_lastEB = 0;
-		channel->xm_lastX1 = 0;
-		channel->xm_lastX2 = 0;
-		channel->playing = NULL;
-	}
-
-	for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++)
-		sigrenderer->playing[i] = NULL;
-
-	sigrenderer->speed = sigdata->speed;
-
-	sigrenderer->processrow = 0;
-	sigrenderer->breakrow = 0;
-	sigrenderer->pat_loop_row = -1;
-	sigrenderer->rowcount = 1;
-
-	reset_tick_counts(sigrenderer);
-
-	sigrenderer->tick = sigrenderer->speed;
-
-	{
-		IT_PATTERN *pattern;
-		int n;
-
-		sigrenderer->processorder = startorder;
-		for (;;) {
-			n = sigdata->order[sigrenderer->processorder];
-
-			if (n < sigdata->n_patterns)
-				break;
-
-#ifdef INVALID_ORDERS_END_SONG
-			if (n != IT_ORDER_SKIP)
-#else
-			if (n == IT_ORDER_END)
-#endif
-			{
-				_dumb_it_end_sigrenderer(sigrenderer);
-				return NULL;
-			}
-
-			sigrenderer->processorder++;
-			if (sigrenderer->processorder >= sigdata->n_orders)
-				sigrenderer->processorder = 0;
-			if (sigrenderer->processorder == startorder) {
-				_dumb_it_end_sigrenderer(sigrenderer);
-				return NULL;
-			}
-		}
-
-		pattern = &sigdata->pattern[n];
-
-		sigrenderer->n_rows = pattern->n_rows;
-
-/** WARNING - everything pertaining to a new pattern initialised? */
-
-		sigrenderer->entry = sigrenderer->entry_start = pattern->entry;
-		sigrenderer->entry_end = sigrenderer->entry + pattern->n_entries;
-
-		sigrenderer->order = sigrenderer->processorder;
-		sigrenderer->row = 0;
-	}
-
-	reset_effects(sigrenderer);
-
-	{
-		IT_ENTRY *entry = sigrenderer->entry;
-
-		while (entry < sigrenderer->entry_end && !IT_IS_END_ROW(entry))
-			update_pattern_variables(sigrenderer, entry++);
-	}
-
-	{
-		IT_ENTRY *entry = sigrenderer->entry;
-
-		while (entry < sigrenderer->entry_end && !IT_IS_END_ROW(entry)) {
-			if (process_entry(sigrenderer, entry++)) {
-				/* Oops, that song ended quickly! */
-				_dumb_it_end_sigrenderer(sigrenderer);
-				return NULL;
-			}
-		}
-	}
-
-	if (!(sigdata->flags & IT_OLD_EFFECTS))
-		update_smooth_effects(sigrenderer);
-
-	process_all_playing(sigrenderer);
-
-	sigrenderer->time_left = TICK_TIME_DIVIDEND / sigrenderer->tempo;
-	sigrenderer->sub_time_left = 0;
-
-	return sigrenderer;
-}
-
-
-
-void dumb_it_set_loop_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data)
-{
-	if (sigrenderer) {
-		sigrenderer->callbacks->loop = callback;
-		sigrenderer->callbacks->loop_data = data;
-	}
-}
-
-
-
-void dumb_it_set_xm_speed_zero_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data), void *data)
-{
-	if (sigrenderer) {
-		sigrenderer->callbacks->xm_speed_zero = callback;
-		sigrenderer->callbacks->xm_speed_zero_data = data;
-	}
-}
-
-
-
-void dumb_it_set_midi_callback(DUMB_IT_SIGRENDERER *sigrenderer, int (*callback)(void *data, int channel, unsigned char byte), void *data)
-{
-	if (sigrenderer) {
-		sigrenderer->callbacks->midi = callback;
-		sigrenderer->callbacks->midi_data = data;
-	}
-}
-
-
-
-static IT_CALLBACKS *create_callbacks(void)
-{
-	IT_CALLBACKS *callbacks = (IT_CALLBACKS *)malloc(sizeof(*callbacks));
-	if (!callbacks) return NULL;
-	callbacks->loop = NULL;
-	callbacks->xm_speed_zero = NULL;
-	callbacks->midi = NULL;
-	return callbacks;
-}
-
-
-
-static DUMB_IT_SIGRENDERER *dumb_it_init_sigrenderer(DUMB_IT_SIGDATA *sigdata, int n_channels, int startorder)
-{
-	IT_CALLBACKS *callbacks;
-
-	if (!sigdata) return NULL;
-
-	callbacks = create_callbacks();
-	if (!callbacks) return NULL;
-
-	return init_sigrenderer(sigdata, n_channels, startorder, callbacks,
-		dumb_create_click_remover_array(n_channels));
-}
-
-
-
-DUH_SIGRENDERER *dumb_it_start_at_order(DUH *duh, int n_channels, int startorder)
-{
-	DUMB_IT_SIGDATA *itsd = duh_get_it_sigdata(duh);
-	DUMB_IT_SIGRENDERER *itsr = dumb_it_init_sigrenderer(itsd, n_channels, startorder);
-	return duh_encapsulate_it_sigrenderer(itsr, n_channels, 0);
-}
-
-
-
-static sigrenderer_t *it_start_sigrenderer(DUH *duh, sigdata_t *vsigdata, int n_channels, long pos)
-{
-	DUMB_IT_SIGDATA *sigdata = (DUMB_IT_SIGDATA *)vsigdata;
-	DUMB_IT_SIGRENDERER *sigrenderer;
-
-	(void)duh;
-
-	{
-		IT_CALLBACKS *callbacks = create_callbacks();
-		if (!callbacks) return NULL;
-
-		if (sigdata->checkpoint) {
-			IT_CHECKPOINT *checkpoint = sigdata->checkpoint;
-			while (checkpoint->next && checkpoint->next->time < pos)
-				checkpoint = checkpoint->next;
-			sigrenderer = dup_sigrenderer(checkpoint->sigrenderer, n_channels, callbacks);
-			if (!sigrenderer) return NULL;
-			sigrenderer->click_remover = dumb_create_click_remover_array(n_channels);
-			pos -= checkpoint->time;
-		} else {
-			sigrenderer = init_sigrenderer(sigdata, n_channels, 0, callbacks,
-				dumb_create_click_remover_array(n_channels));
-			if (!sigrenderer) return NULL;
-		}
-	}
-
-	for (;;) {
-		if (sigrenderer->time_left >= pos)
-			break;
-
-		render(sigrenderer, 0, 1.0f, 0, sigrenderer->time_left, NULL);
-
-		pos -= sigrenderer->time_left;
-		sigrenderer->time_left = 0;
-
-		if (process_tick(sigrenderer)) {
-			_dumb_it_end_sigrenderer(sigrenderer);
-			return NULL;
-		}
-	}
-
-	render(sigrenderer, 0, 1.0f, 0, pos, NULL);
-	sigrenderer->time_left -= pos;
-
-	/** WARNING - everything initialised? */
-
-	return sigrenderer;
-}
-
-
-
-static long it_sigrenderer_get_samples(
-	sigrenderer_t *vsigrenderer,
-	float volume, float delta,
-	long size, sample_t **samples
-)
-{
-	DUMB_IT_SIGRENDERER *sigrenderer = (DUMB_IT_SIGRENDERER *)vsigrenderer;
-	long pos;
-	int dt;
-	long todo;
-	LONG_LONG t;
-
-	if (sigrenderer->order < 0) return 0;
-
-	pos = 0;
-	dt = (int)(delta * 65536.0f + 0.5f);
-
-	/* When samples is finally used in render_playing(), it won't be used if
-	 * volume is 0.
-	 */
-	if (!samples) volume = 0;
-
-	for (;;) {
-		todo = (long)((((LONG_LONG)sigrenderer->time_left << 16) | sigrenderer->sub_time_left) / dt);
-
-		if (todo >= size)
-			break;
-
-		render(sigrenderer, volume, delta, pos, todo, samples);
-
-		pos += todo;
-		size -= todo;
-
-		t = sigrenderer->sub_time_left - (LONG_LONG)todo * dt;
-		sigrenderer->sub_time_left = (long)t & 65535;
-		sigrenderer->time_left += (long)(t >> 16);
-
-		if (process_tick(sigrenderer)) {
-			sigrenderer->order = -1;
-			sigrenderer->row = -1;
-			return pos;
-		}
-	}
-
-	render(sigrenderer, volume, delta, pos, size, samples);
-
-	pos += size;
-
-	t = sigrenderer->sub_time_left - (LONG_LONG)size * dt;
-	sigrenderer->sub_time_left = (long)t & 65535;
-	sigrenderer->time_left += (long)(t >> 16);
-
-	dumb_remove_clicks_array(sigrenderer->n_channels, sigrenderer->click_remover, samples, pos, 512.0f / delta);
-
-	return pos;
-}
-
-
-
-static void it_sigrenderer_get_current_sample(sigrenderer_t *vsigrenderer, float volume, sample_t *samples)
-{
-	DUMB_IT_SIGRENDERER *sigrenderer = (DUMB_IT_SIGRENDERER *)vsigrenderer;
-	(void)volume; // for consideration: in any of these such functions, is 'volume' going to be required?
-	dumb_click_remover_get_offset_array(sigrenderer->n_channels, sigrenderer->click_remover, samples);
-}
-
-
-
-void _dumb_it_end_sigrenderer(sigrenderer_t *vsigrenderer)
-{
-	DUMB_IT_SIGRENDERER *sigrenderer = (DUMB_IT_SIGRENDERER *)vsigrenderer;
-
-	int i;
-
-	if (sigrenderer) {
-		for (i = 0; i < DUMB_IT_N_CHANNELS; i++)
-			if (sigrenderer->channel[i].playing)
-				free(sigrenderer->channel[i].playing);
-
-		for (i = 0; i < DUMB_IT_N_NNA_CHANNELS; i++)
-			if (sigrenderer->playing[i])
-				free(sigrenderer->playing[i]);
-
-		dumb_destroy_click_remover_array(sigrenderer->n_channels, sigrenderer->click_remover);
-
-		if (sigrenderer->callbacks)
-			free(sigrenderer->callbacks);
-
-		free(vsigrenderer);
-	}
-}
-
-
-
-DUH_SIGTYPE_DESC _dumb_sigtype_it = {
-	SIGTYPE_IT,
-	NULL,
-	&it_start_sigrenderer,
-	NULL,
-	&it_sigrenderer_get_samples,
-	&it_sigrenderer_get_current_sample,
-	&_dumb_it_end_sigrenderer,
-	&_dumb_it_unload_sigdata
-};
-
-
-
-DUH_SIGRENDERER *duh_encapsulate_it_sigrenderer(DUMB_IT_SIGRENDERER *it_sigrenderer, int n_channels, long pos)
-{
-	return duh_encapsulate_raw_sigrenderer(it_sigrenderer, &_dumb_sigtype_it, n_channels, pos);
-}
-
-
-
-DUMB_IT_SIGRENDERER *duh_get_it_sigrenderer(DUH_SIGRENDERER *sigrenderer)
-{
-	return (DUMB_IT_SIGRENDERER *)duh_get_raw_sigrenderer(sigrenderer, SIGTYPE_IT);
-}
-
-
-
-/* Values of 64 or more will access NNA channels here. */
-void dumb_it_sr_get_channel_state(DUMB_IT_SIGRENDERER *sr, int channel, DUMB_IT_CHANNEL_STATE *state)
-{
-	IT_PLAYING *playing;
-	int t; /* temporary var for holding accurate pan and filter cutoff */
-	float delta;
-	ASSERT(channel < DUMB_IT_TOTAL_CHANNELS);
-	if (!sr) { state->sample = 0; return; }
-	if (channel >= DUMB_IT_N_CHANNELS) {
-		playing = sr->playing[channel - DUMB_IT_N_CHANNELS];
-		if (!playing) { state->sample = 0; return; }
-	} else {
-		playing = sr->channel[channel].playing;
-		if (!playing) { state->sample = 0; return; }
-	}
-
-	if (playing->flags & IT_PLAYING_DEAD) { state->sample = 0; return; }
-
-	state->channel = playing->channel - sr->channel;
-	state->sample = playing->sampnum;
-	state->volume = calculate_volume(sr, playing, 1.0f);
-
-	t = apply_pan_envelope(playing);
-	state->pan = (unsigned char)((t + 128) >> IT_ENVELOPE_SHIFT);
-	state->subpan = (signed char)t;
-
-	delta = playing->delta * 65536.0f;
-	t = playing->filter_cutoff << IT_ENVELOPE_SHIFT;
-	apply_pitch_modifications(sr->sigdata, playing, &delta, &t);
-	state->freq = (int)delta;
-	if (t == 127 << IT_ENVELOPE_SHIFT && playing->filter_resonance == 0) {
-		state->filter_resonance = playing->true_filter_resonance;
-		t = playing->true_filter_cutoff;
-	} else
-		state->filter_resonance = playing->filter_resonance;
-	state->filter_cutoff = (unsigned char)(t >> 8);
-	state->filter_subcutoff = (unsigned char)t;
-}
-
-
-
-int dumb_it_callback_terminate(void *data)
-{
-	(void)data;
-	return 1;
-}
-
-
-
-int dumb_it_callback_midi_block(void *data, int channel, unsigned char byte)
-{
-	(void)data;
-	(void)channel;
-	(void)byte;
-	return 1;
-}
-
-
-
-#define IT_CHECKPOINT_INTERVAL (30 * 65536) /* Half a minute */
-
-
-
-/* Returns the length of the module, up until it first loops. */
-long _dumb_it_build_checkpoints(DUMB_IT_SIGDATA *sigdata)
-{
-	IT_CHECKPOINT *checkpoint = (IT_CHECKPOINT *)malloc(sizeof(*checkpoint));
-	if (!checkpoint) return 0;
-	checkpoint->time = 0;
-	checkpoint->sigrenderer = dumb_it_init_sigrenderer(sigdata, 0, 0);
-	if (!checkpoint->sigrenderer) {
-		free(checkpoint);
-		return 0;
-	}
-	checkpoint->sigrenderer->callbacks->loop = &dumb_it_callback_terminate;
-	checkpoint->sigrenderer->callbacks->xm_speed_zero = &dumb_it_callback_terminate;
-	sigdata->checkpoint = checkpoint;
-
-	for (;;) {
-		long l;
-		DUMB_IT_SIGRENDERER *sigrenderer = dup_sigrenderer(checkpoint->sigrenderer, 0, checkpoint->sigrenderer->callbacks);
-		checkpoint->sigrenderer->callbacks = NULL;
-		if (!sigrenderer) {
-			checkpoint->next = NULL;
-			return checkpoint->time;
-		}
-
-		l = it_sigrenderer_get_samples(sigrenderer, 0, 1.0f, IT_CHECKPOINT_INTERVAL, NULL);
-		if (l < IT_CHECKPOINT_INTERVAL) {
-			_dumb_it_end_sigrenderer(sigrenderer);
-			checkpoint->next = NULL;
-			return checkpoint->time + l;
-		}
-
-		checkpoint->next = (IT_CHECKPOINT *)malloc(sizeof(*checkpoint->next));
-		if (!checkpoint->next) {
-			_dumb_it_end_sigrenderer(sigrenderer);
-			return checkpoint->time + IT_CHECKPOINT_INTERVAL;
-		}
-
-		checkpoint->next->time = checkpoint->time + IT_CHECKPOINT_INTERVAL;
-		checkpoint = checkpoint->next;
-		checkpoint->sigrenderer = sigrenderer;
-	}
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/it/itunload.cpp b/engines/ags/lib/dumb-0.9.2/it/itunload.cpp
deleted file mode 100644
index d94a9ecac9..0000000000
--- a/engines/ags/lib/dumb-0.9.2/it/itunload.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*  _______         ____    __         ___    ___
- * \    _  \       \    /  \  /       \   \  /   /       '   '  '
- *  |  | \  \       |  |    ||         |   \/   |         .      .
- *  |  |  |  |      |  |    ||         ||\  /|  |
- *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
- *  |  |  |  |      |  |    ||         ||    |  |         .      .
- *  |  |_/  /        \  \__//          ||    |  |
- * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
- *                                                      /  \
- *                                                     / .  \
- * itunload.c - Code to free an Impulse Tracker       / / \  \
- *              module from memory.                  | <  /   \_
- *                                                   |  \/ /\   /
- * By entheh.                                         \_  /  > /
- *                                                      | \ / /
- *                                                      |  ' /
- *                                                       \__/
- */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-#include "ags/lib/dumb-0.9.2/it/it.h"
-
-namespace AGS3 {
-
-void _dumb_it_unload_sigdata(sigdata_t *vsigdata) {
-	if (vsigdata) {
-		DUMB_IT_SIGDATA *sigdata = (DUMB_IT_SIGDATA *)vsigdata;
-		int n;
-
-		if (sigdata->order)
-			free(sigdata->order);
-
-		if (sigdata->instrument)
-			free(sigdata->instrument);
-
-		if (sigdata->sample) {
-			for (n = 0; n < sigdata->n_samples; n++) {
-				if (sigdata->sample[n].left)
-					free(sigdata->sample[n].left);
-				if (sigdata->sample[n].right)
-					free(sigdata->sample[n].right);
-			}
-			free(sigdata->sample);
-		}
-
-		if (sigdata->pattern) {
-			for (n = 0; n < sigdata->n_patterns; n++)
-				if (sigdata->pattern[n].entry)
-					free(sigdata->pattern[n].entry);
-			free(sigdata->pattern);
-		}
-
-		if (sigdata->midi)
-			free(sigdata->midi);
-
-		{
-			IT_CHECKPOINT *checkpoint = sigdata->checkpoint;
-			while (checkpoint) {
-				IT_CHECKPOINT *next = checkpoint->next;
-				_dumb_it_end_sigrenderer(checkpoint->sigrenderer);
-				free(checkpoint);
-				checkpoint = next;
-			}
-		}
-
-		free(vsigdata);
-	}
-}
-
-} // namespace AGS3
diff --git a/engines/ags/lib/dumb-0.9.2/readxm.cpp b/engines/ags/lib/dumb-0.9.2/readxm.cpp
deleted file mode 100644
index 775620e8c5..0000000000
--- a/engines/ags/lib/dumb-0.9.2/readxm.cpp
+++ /dev/null
@@ -1,1007 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
- /*  _______         ____    __         ___    ___
-  * \    _  \       \    /  \  /       \   \  /   /       '   '  '
-  *  |  | \  \       |  |    ||         |   \/   |         .      .
-  *  |  |  |  |      |  |    ||         ||\  /|  |
-  *  |  |  |  |      |  |    ||         || \/ |  |         '  '  '
-  *  |  |  |  |      |  |    ||         ||    |  |         .      .
-  *  |  |_/  /        \  \__//          ||    |  |
-  * /_______/ynamic    \____/niversal  /__\  /____\usic   /|  .  . ibliotheque
-  *                                                      /  \
-  *                                                     / .  \
-  * readxm.c - Code to read a Fast Tracker II          / / \  \
-  *            module from an open file.              | <  /   \_
-  *                                                   |  \/ /\   /
-  * By Julien Cugniere. Some bits of code taken        \_  /  > /
-  * from reads3m.c.                                      | \ / /
-  *                                                      |  ' /
-  *                                                       \__/
-  */
-
-#include "ags/lib/dumb-0.9.2/dumb.h"
-#include "ags/lib/dumb-0.9.2/it.h"
-
-namespace AGS3 {
-
-/** TODO:
-
- * XM_TREMOLO                        doesn't sound quite right...
- * XM_E_SET_FINETUNE                 todo.
- * XM_SET_ENVELOPE_POSITION          todo.
-
- * VIBRATO conversion needs to be checked (sample/effect/volume). Plus check
-   that effect memory is correct when using XM_VOLSLIDE_VIBRATO.
-   - sample vibrato (instrument vibrato) is now handled correctly. - entheh
-
- * XM_E_SET_VIBRATO/TREMOLO_CONTROL: effectvalue&4 -> don't retrig wave when
-   a new instrument is played. In retrigger_note()?. Is it worth implementing?
-
- * Lossy fadeout approximation. 0..31 converted to 0 --> won't fade at all.
-
- * Replace DUMB's sawtooth by ramp_down/ramp_up. Update XM loader.
-
- * A lot of things need to be reset when the end of the song is reached.
-
- * It seems that IT and XM don't behave the same way when dealing with
-   mixed loops. When IT encounters multiple SBx (x>0) commands on the same
-   row, it decrements the loop count for all, but only execute the loop of
-   the last one (highest channel). FT2 only decrements the loop count of the
-   last one. Not that I know of any modules using so convoluted combinations!
-
- * Maybe we could remove patterns that don't appear in the order table ? Or
-   provide a function to "optimize" a DUMB_IT_SIGDATA ?
-
-*/
-
-
-
-#define XM_LINEAR_FREQUENCY        1 /* otherwise, use amiga slides */
-
-#define XM_ENTRY_PACKED            128
-#define XM_ENTRY_NOTE              1
-#define XM_ENTRY_INSTRUMENT        2
-#define XM_ENTRY_VOLUME            4
-#define XM_ENTRY_EFFECT            8
-#define XM_ENTRY_EFFECTVALUE       16
-
-#define XM_NOTE_OFF                97
-
-#define XM_ENVELOPE_ON             1
-#define XM_ENVELOPE_SUSTAIN        2
-#define XM_ENVELOPE_LOOP           4
-
-#define XM_SAMPLE_NO_LOOP          0
-#define XM_SAMPLE_FORWARD_LOOP     1
-#define XM_SAMPLE_PINGPONG_LOOP    2
-#define XM_SAMPLE_16BIT            16
-#define XM_SAMPLE_STEREO           32
-
-#define XM_VIBRATO_SINE            0
-#define XM_VIBRATO_SQUARE          1
-#define XM_VIBRATO_RAMP_DOWN       2
-#define XM_VIBRATO_RAMP_UP         3
-
-
-
-/* Probably useless :) */
-static const char xm_convert_vibrato[] = {
-	IT_VIBRATO_SINE,
-	IT_VIBRATO_SQUARE,
-	IT_VIBRATO_SAWTOOTH,
-	IT_VIBRATO_SAWTOOTH
-};
-
-
-
-#define XM_MAX_SAMPLES_PER_INSTRUMENT 16
-
-
-
-/* Extra data that doesn't fit inside IT_INSTRUMENT */
-typedef struct XM_INSTRUMENT_EXTRA {
-	int n_samples;
-	int vibrato_type;
-	int vibrato_sweep; /* 0-0xFF */
-	int vibrato_depth; /* 0-0x0F */
-	int vibrato_speed; /* 0-0x3F */
-}
-XM_INSTRUMENT_EXTRA;
-
-
-
-/* Frees the original block if it can't resize it or if size is 0, and acts
- * as malloc if ptr is NULL.
- */
-static void *safe_realloc(void *ptr, size_t size) {
-	if (ptr == NULL)
-		return malloc(size);
-
-	if (size == 0) {
-		free(ptr);
-		return NULL;
-	} else {
-		void *new_block = realloc(ptr, size);
-		if (!new_block)
-			free(ptr);
-		return new_block;
-	}
-}
-
-
-
-/* The interpretation of the XM volume column is left to the player. Here, we
- * just filter bad values.
- */
- // This function is so tiny now, should we inline it?
-static void it_xm_convert_volume(int volume, IT_ENTRY *entry) {
-	entry->mask |= IT_ENTRY_VOLPAN;
-	entry->volpan = volume;
-
-	switch (volume >> 4) {
-	case 0xA: /* set vibrato speed */
-	case 0xB: /* vibrato */
-	case 0xF: /* tone porta */
-	case 0x6: /* vol slide up */
-	case 0x7: /* vol slide down */
-	case 0x8: /* fine vol slide up */
-	case 0x9: /* fine vol slide down */
-	case 0xC: /* set panning */
-	case 0xD: /* pan slide left */
-	case 0xE: /* pan slide right */
-	case 0x1: /* set volume */
-	case 0x2: /* set volume */
-	case 0x3: /* set volume */
-	case 0x4: /* set volume */
-		break;
-
-	case 0x5:
-		if (volume == 0x50)
-			break; /* set volume */
-		/* else fall through */
-
-	default:
-		entry->mask &= ~IT_ENTRY_VOLPAN;
-		break;
-	}
-}
-
-
-
-static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels, unsigned char *buffer) {
-	int size;
-	int pos;
-	int channel;
-	int row;
-	int effect, effectvalue;
-	IT_ENTRY *entry;
-
-	/* pattern header size */
-	if (dumbfile_igetl(f) != 0x09) {
-		TRACE("XM error: unexpected pattern header size\n");
-		return -1;
-	}
-
-	/* pattern data packing type */
-	if (dumbfile_getc(f) != 0) {
-		TRACE("XM error: unexpected pattern packing type\n");
-		return -1;
-	}
-
-	pattern->n_rows = dumbfile_igetw(f);  /* 1..256 */
-	size = dumbfile_igetw(f);
-	pattern->n_entries = 0;
-
-	if (dumbfile_error(f))
-		return -1;
-
-	if (size == 0)
-		return 0;
-
-	if (size > 1280 * n_channels) {
-		TRACE("XM error: pattern data size > %d bytes\n", 1280 * n_channels);
-		return -1;
-	}
-
-	if (dumbfile_getnc(buffer, size, f) < size)
-		return -1;
-
-	/* compute number of entries */
-	pattern->n_entries = 0;
-	pos = channel = row = 0;
-	while (pos < size) {
-		if (!(buffer[pos] & XM_ENTRY_PACKED) || (buffer[pos] & 31))
-			pattern->n_entries++;
-
-		channel++;
-		if (channel >= n_channels) {
-			channel = 0;
-			row++;
-			pattern->n_entries++;
-		}
-
-		if (buffer[pos] & XM_ENTRY_PACKED) {
-			static const char offset[] = { 0, 1, 1, 2, 1, 2, 2, 3,   1, 2, 2, 3, 2, 3, 3, 4,
-										   1, 2, 2, 3, 2, 3, 3, 4,   2, 3, 3, 4, 3, 4, 4, 5 };
-			pos += 1 + offset[buffer[pos] & 31];
-		} else {
-			pos += 5;
-		}
-	}
-
-	if (row != pattern->n_rows) {
-		TRACE("XM error: wrong number of rows in pattern data\n");
-		return -1;
-	}
-
-	pattern->entry = malloc(pattern->n_entries * sizeof(*pattern->entry));
-	if (!pattern->entry)
-		return -1;
-
-	/* read the entries */
-	entry = pattern->entry;
-	pos = channel = row = 0;
-	while (pos < size) {
-		unsigned char mask;
-
-		if (buffer[pos] & XM_ENTRY_PACKED)
-			mask = buffer[pos++] & 31;
-		else
-			mask = 31;
-
-		if (mask) {
-			ASSERT(entry < pattern->entry + pattern->n_entries);
-
-			entry->channel = channel;
-			entry->mask = 0;
-
-			if (mask & XM_ENTRY_NOTE) {
-				int note = buffer[pos++]; /* 1-96 <=> C0-B7 */
-				entry->note = (note == XM_NOTE_OFF) ? (IT_NOTE_OFF) : (note - 1);
-				entry->mask |= IT_ENTRY_NOTE;
-			}
-
-			if (mask & XM_ENTRY_INSTRUMENT) {
-				entry->instrument = buffer[pos++]; /* 1-128 */
-				entry->mask |= IT_ENTRY_INSTRUMENT;
-			}
-
-			if (mask & XM_ENTRY_VOLUME)
-				it_xm_convert_volume(buffer[pos++], entry);
-
-			effect = effectvalue = 0;
-			if (mask & XM_ENTRY_EFFECT)      effect = buffer[pos++];
-			if (mask & XM_ENTRY_EFFECTVALUE) effectvalue = buffer[pos++];
-			_dumb_it_xm_convert_effect(effect, effectvalue, entry);
-
-			entry++;
-		}
-
-		channel++;
-		if (channel >= n_channels) {
-			channel = 0;
-			row++;
-			IT_SET_END_ROW(entry);
-			entry++;
-		}
-	}
-
-	return 0;
-}
-
-
-
-static int it_xm_make_envelope(IT_ENVELOPE *envelope, const unsigned short *data, int y_offset) {
-	int i, pos;
-
-	if (envelope->n_nodes > 12) {
-		TRACE("XM error: wrong number of envelope nodes (%d)\n", envelope->n_nodes);
-		envelope->n_nodes = 0;
-		return -1;
-	}
-
-	pos = 0;
-	for (i = 0; i < envelope->n_nodes; i++) {
-		envelope->node_t[i] = data[pos++];
-		if (data[pos] > 64) {
-			TRACE("XM error: out-of-range envelope node (node_y[%d]=%d)\n", i, data[pos]);
-			envelope->n_nodes = 0;
-			return -1;
-		}
-		envelope->node_y[i] = (signed char)(data[pos++] + y_offset);
-	}
-
-	return 0;
-}
-
-
-
-static int it_xm_read_instrument(IT_INSTRUMENT *instrument, XM_INSTRUMENT_EXTRA *extra, DUMBFILE *f) {
-	unsigned long size, bytes_read;
-	unsigned short vol_points[24];
-	unsigned short pan_points[24];
-	int i, type;
-
-	/* Header size. Tends to be more than the actual size of the structure.
-	 * So unread bytes must be skipped before reading the first sample
-	 * header.
-	 */
-	size = dumbfile_igetl(f);
-
-	//memset(instrument, 0, sizeof(*instrument));
-	dumbfile_skip(f, 22); /* Instrument name */
-	dumbfile_skip(f, 1);  /* Instrument type. Should be 0, but seems random. */
-	extra->n_samples = dumbfile_igetw(f);
-
-	if (dumbfile_error(f) || (unsigned int)extra->n_samples > XM_MAX_SAMPLES_PER_INSTRUMENT)
-		return -1;
-
-	bytes_read = 4 + 22 + 1 + 2;
-
-	if (extra->n_samples) {
-		/* sample header size */
-		if (dumbfile_igetl(f) != 0x28) {
-			TRACE("XM error: unexpected sample header size\n");
-			return -1;
-		}
-
-		/* sample map */
-		for (i = 0; i < 96; i++) {
-			instrument->map_sample[i] = dumbfile_getc(f) + 1;
-			instrument->map_note[i] = i;
-		}
-
-		if (dumbfile_error(f))
-			return 1;
-
-		/* volume/panning envelopes */
-		for (i = 0; i < 24; i++)
-			vol_points[i] = dumbfile_igetw(f);
-		for (i = 0; i < 24; i++)
-			pan_points[i] = dumbfile_igetw(f);
-
-		instrument->volume_envelope.n_nodes = dumbfile_getc(f);
-		instrument->pan_envelope.n_nodes = dumbfile_getc(f);
-
-		if (dumbfile_error(f))
-			return -1;
-
-		instrument->volume_envelope.sus_loop_start = dumbfile_getc(f);
-		instrument->volume_envelope.loop_start = dumbfile_getc(f);
-		instrument->volume_envelope.loop_end = dumbfile_getc(f);
-
-		instrument->pan_envelope.sus_loop_start = dumbfile_getc(f);
-		instrument->pan_envelope.loop_start = dumbfile_getc(f);
-		instrument->pan_envelope.loop_end = dumbfile_getc(f);
-
-		/* The envelope handler for XM files won't use sus_loop_end. */
-
-		type = dumbfile_getc(f);
-		instrument->volume_envelope.flags = 0;
-		if ((type & XM_ENVELOPE_ON) && instrument->volume_envelope.n_nodes)
-			instrument->volume_envelope.flags |= IT_ENVELOPE_ON;
-		if (type & XM_ENVELOPE_LOOP)    instrument->volume_envelope.flags |= IT_ENVELOPE_LOOP_ON;
-#if 1
-		if (type & XM_ENVELOPE_SUSTAIN) instrument->volume_envelope.flags |= IT_ENVELOPE_SUSTAIN_LOOP;
-#else // This is now handled in itrender.c
-		/* let's avoid fading out when reaching the last envelope node */
-		if (!(type & XM_ENVELOPE_LOOP)) {
-			instrument->volume_envelope.loop_start = instrument->volume_envelope.n_nodes - 1;
-			instrument->volume_envelope.loop_end = instrument->volume_envelope.n_nodes - 1;
-		}
-		instrument->volume_envelope.flags |= IT_ENVELOPE_LOOP_ON;
-#endif
-
-		type = dumbfile_getc(f);
-		instrument->pan_envelope.flags = 0;
-		if ((type & XM_ENVELOPE_ON) && instrument->pan_envelope.n_nodes)
-			instrument->pan_envelope.flags |= IT_ENVELOPE_ON;
-		if (type & XM_ENVELOPE_LOOP)    instrument->pan_envelope.flags |= IT_ENVELOPE_LOOP_ON; // should this be here?
-		if (type & XM_ENVELOPE_SUSTAIN) instrument->pan_envelope.flags |= IT_ENVELOPE_SUSTAIN_LOOP;
-
-		if (it_xm_make_envelope(&instrument->volume_envelope, vol_points, 0) != 0) {
-			TRACE("XM error: volume envelope\n");
-			if (instrument->volume_envelope.flags & IT_ENVELOPE_ON) return -1;
-		}
-
-		if (it_xm_make_envelope(&instrument->pan_envelope, pan_points, -32) != 0) {
-			TRACE("XM error: pan envelope\n");
-			if (instrument->pan_envelope.flags & IT_ENVELOPE_ON) return -1;
-		}
-
-		instrument->pitch_envelope.flags = 0;
-
-		extra->vibrato_type = dumbfile_getc(f);
-		extra->vibrato_sweep = dumbfile_getc(f);
-		extra->vibrato_depth = dumbfile_getc(f);
-		extra->vibrato_speed = dumbfile_getc(f);
-
-		if (dumbfile_error(f) || extra->vibrato_type >= 4)
-			return -1;
-
-		/** WARNING: lossy approximation */
-		instrument->fadeout = (dumbfile_igetw(f) * 128 + 64) / 0xFFF;
-
-		dumbfile_skip(f, 2); /* reserved */
-
-		bytes_read += 4 + 96 + 48 + 48 + 14 * 1 + 2 + 2;
-	}
-
-	if (dumbfile_skip(f, size - bytes_read))
-		return -1;
-
-	instrument->new_note_action = NNA_NOTE_CUT;
-	instrument->dup_check_type = DCT_OFF;
-	instrument->dup_check_action = DCA_NOTE_CUT;
-	instrument->pp_separation = 0;
-	instrument->pp_centre = 60; /* C-5 */
-	instrument->global_volume = 128;
-	instrument->default_pan = 32;
-	instrument->random_volume = 0;
-	instrument->random_pan = 0;
-	instrument->filter_cutoff = 0;
-	instrument->filter_resonance = 0;
-
-	return 0;
-}
-
-
-
-/* I (entheh) have two XM files saved by a very naughty program. After a
- * 16-bit sample, it saved a rogue byte. The length of the sample was indeed
- * an odd number, incremented to include the rogue byte.
- *
- * In this function we are converting sample lengths and loop points so they
- * are measured in samples. This means we forget about the extra bytes, and
- * they don't get skipped. So we fail trying to read the next instrument.
- *
- * To get around this, this function returns the number of rogue bytes that
- * won't be accounted for by reading sample->length samples. It returns a
- * negative number on failure.
- */
-static int it_xm_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f) {
-	int type;
-	int relative_note_number; /* relative to C4 */
-	int finetune;
-	int roguebytes;
-	int roguebytesmask;
-
-	sample->length = dumbfile_igetl(f);
-	sample->loop_start = dumbfile_igetl(f);
-	sample->loop_end = sample->loop_start + dumbfile_igetl(f);
-	sample->global_volume = 64;
-	sample->default_volume = dumbfile_getc(f);
-	finetune = (signed char)dumbfile_getc(f); /* -128..127 <=> -1 semitone .. +127/128 of a semitone */
-	type = dumbfile_getc(f);
-	sample->default_pan = (dumbfile_getc(f) * 64) / 255 | 128; /* 0-255 */
-	relative_note_number = (signed char)dumbfile_getc(f);
-
-	dumbfile_skip(f, 1);  /* reserved */
-	dumbfile_skip(f, 22); /* sample name */
-
-	if (dumbfile_error(f))
-		return -1;
-
-	sample->C5_speed = (long)(16726.0 * pow(DUMB_SEMITONE_BASE, relative_note_number) * pow(DUMB_PITCH_BASE, finetune * 2));
-
-	sample->flags = IT_SAMPLE_EXISTS;
-
-	roguebytes = (int)sample->length;
-	roguebytesmask = 3;
-
-	if (type & XM_SAMPLE_16BIT) {
-		sample->flags |= IT_SAMPLE_16BIT;
-		sample->length >>= 1;
-		sample->loop_start >>= 1;
-		sample->loop_end >>= 1;
-	} else
-		roguebytesmask >>= 1;
-
-	if (type & XM_SAMPLE_STEREO) {
-		sample->flags |= IT_SAMPLE_STEREO;
-		sample->length >>= 1;
-		sample->loop_start >>= 1;
-		sample->loop_end >>= 1;
-	} else
-		roguebytesmask >>= 1;
-
-	roguebytes &= roguebytesmask;
-
-	if ((unsigned int)sample->loop_start < (unsigned int)sample->loop_end) {
-		if (type & XM_SAMPLE_FORWARD_LOOP) sample->flags |= IT_SAMPLE_LOOP;
-		if (type & XM_SAMPLE_PINGPONG_LOOP) sample->flags |= IT_SAMPLE_LOOP | IT_SAMPLE_PINGPONG_LOOP;
-	}
-
-	if (sample->length <= 0)
-		sample->flags &= ~IT_SAMPLE_EXISTS;
-	else if ((unsigned int)sample->loop_end > (unsigned int)sample->length)
-		sample->flags &= ~IT_SAMPLE_LOOP;
-	else if ((unsigned int)sample->loop_start >= (unsigned int)sample->loop_end)
-		sample->flags &= ~IT_SAMPLE_LOOP;
-
-	return roguebytes;
-}
-
-
-
-static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, DUMBFILE *f) {
-	int old;
-	long i;
-	long truncated_size;
-
-	if (!(sample->flags & IT_SAMPLE_EXISTS))
-		return dumbfile_skip(f, roguebytes);
-
-	/* let's get rid of the sample data coming after the end of the loop */
-	if ((sample->flags & IT_SAMPLE_LOOP) && sample->loop_end < sample->length) {
-		truncated_size = sample->length - sample->loop_end;
-		sample->length = sample->loop_end;
-	} else {
-		truncated_size = 0;
-	}
-
-	sample->left = malloc(sample->length * sizeof(*sample->left));
-	if (!sample->left)
-		return -1;
-
-	if (sample->flags & IT_SAMPLE_STEREO) {
-		sample->right = malloc(sample->length * sizeof(*sample->right));
-		if (!sample->right)
-			return -1;
-	}
-
-	/* sample data is stored as signed delta values */
-	old = 0;
-	if (sample->flags & IT_SAMPLE_16BIT) {
-		for (i = 0; i < sample->length; i++) {
-			old = sample->left[i] = (int)(signed short)(old + dumbfile_igetw(f));
-			sample->left[i] <<= 8;
-		}
-	} else {
-		for (i = 0; i < sample->length; i++) {
-			old = sample->left[i] = (int)(signed char)(old + dumbfile_getc(f));
-			sample->left[i] <<= 16;
-		}
-	}
-
-	/* skip truncated data */
-	dumbfile_skip(f, (sample->flags & IT_SAMPLE_16BIT) ? (2 * truncated_size) : (truncated_size));
-
-	if (sample->flags & IT_SAMPLE_STEREO) {
-		old = 0;
-		if (sample->flags & IT_SAMPLE_16BIT) {
-			for (i = 0; i < sample->length; i++) {
-				old = sample->right[i] = (int)(signed short)(old + dumbfile_igetw(f));
-				sample->right[i] <<= 8;
-			}
-		} else {
-			for (i = 0; i < sample->length; i++) {
-				old = sample->right[i] = (int)(signed char)(old + dumbfile_getc(f));
-				sample->right[i] <<= 16;
-			}
-		}
-		/* skip truncated data */
-		dumbfile_skip(f, (sample->flags & IT_SAMPLE_16BIT) ? (2 * truncated_size) : (truncated_size));
-	}
-
-	dumbfile_skip(f, roguebytes);
-
-	if (dumbfile_error(f))
-		return -1;
-
-	return 0;
-}
-
-
-
-/* "Real programmers don't document. If it was hard to write,
- *  it should be hard to understand."
- *
- * (Never trust the documentation provided with a tracker.
- *  Real files are the only truth...)
- */
-static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f) {
-	DUMB_IT_SIGDATA *sigdata;
-	char id_text[18];
-
-	int flags;
-	int n_channels;
-	int total_samples;
-	int i, j;
-
-	/* check ID text */
-	if (dumbfile_getnc(id_text, 17, f) < 17)
-		return NULL;
-	id_text[17] = 0;
-	if (strcmp(id_text, "Extended Module: ") != 0) {
-		TRACE("XM error: Not an Extended Module\n");
-		return NULL;
-	}
-
-	/* song name */
-	if (dumbfile_skip(f, 20))
-		return NULL;
-
-	if (dumbfile_getc(f) != 0x1A) {
-		TRACE("XM error: 0x1A not found\n");
-		return NULL;
-	}
-
-	/* tracker name */
-	if (dumbfile_skip(f, 20))
-		return NULL;
-
-	/* version number */
-	if (dumbfile_igetw(f) != 0x0104) {
-		TRACE("XM error: wrong format version\n");
-		return NULL;
-	}
-
-	/*
-		------------------
-		---   Header   ---
-		------------------
-	*/
-
-	/* header size */
-	if (dumbfile_igetl(f) != 0x0114) {
-		TRACE("XM error: unexpected header size\n");
-		return NULL;
-	}
-
-	sigdata = malloc(sizeof(*sigdata));
-	if (!sigdata)
-		return NULL;
-
-	sigdata->order = NULL;
-	sigdata->instrument = NULL;
-	sigdata->sample = NULL;
-	sigdata->pattern = NULL;
-	sigdata->midi = NULL;
-	sigdata->checkpoint = NULL;
-
-	sigdata->n_samples = 0;
-	sigdata->n_orders = dumbfile_igetw(f);
-	sigdata->restart_position = dumbfile_igetw(f);
-	n_channels = dumbfile_igetw(f); /* max 32 but we'll be lenient */
-	sigdata->n_patterns = dumbfile_igetw(f);
-	sigdata->n_instruments = dumbfile_igetw(f); /* max 128 */
-	flags = dumbfile_igetw(f);
-	sigdata->speed = dumbfile_igetw(f);
-	sigdata->tempo = dumbfile_igetw(f);
-
-	/* sanity checks */
-	if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_orders > 256 || sigdata->n_patterns > 256 || sigdata->n_instruments > 128 || n_channels > DUMB_IT_N_CHANNELS) {
-		_dumb_it_unload_sigdata(sigdata);
-		return NULL;
-	}
-
-	//if (sigdata->restart_position >= sigdata->n_orders)
-		//sigdata->restart_position = 0;
-
-	/* order table */
-	sigdata->order = malloc(sigdata->n_orders * sizeof(*sigdata->order));
-	if (!sigdata->order) {
-		_dumb_it_unload_sigdata(sigdata);
-		return NULL;
-	}
-	dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
-	dumbfile_skip(f, 256 - sigdata->n_orders);
-
-	if (dumbfile_error(f)) {
-		_dumb_it_unload_sigdata(sigdata);
-		return NULL;
-	}
-
-	/*
-		--------------------
-		---   Patterns   ---
-		--------------------
-	*/
-
-	sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
-	if (!sigdata->pattern) {
-		_dumb_it_unload_sigdata(sigdata);
-		return NULL;
-	}
-	for (i = 0; i < sigdata->n_patterns; i++)
-		sigdata->pattern[i].entry = NULL;
-
-	{
-		unsigned char *buffer = malloc(1280 * n_channels); /* 256 rows * 5 bytes */
-		if (!buffer) {
-			_dumb_it_unload_sigdata(sigdata);
-			return NULL;
-		}
-		for (i = 0; i < sigdata->n_patterns; i++) {
-			if (it_xm_read_pattern(&sigdata->pattern[i], f, n_channels, buffer) != 0) {
-				free(buffer);
-				_dumb_it_unload_sigdata(sigdata);
-				return NULL;
-			}
-		}
-		free(buffer);
-	}
-
-	/*
-		-----------------------------------
-		---   Instruments and Samples   ---
-		-----------------------------------
-	*/
-
-	sigdata->instrument = malloc(sigdata->n_instruments * sizeof(*sigdata->instrument));
-	if (!sigdata->instrument) {
-		_dumb_it_unload_sigdata(sigdata);
-		return NULL;
-	}
-
-	/* With XM, samples are not global, they're part of an instrument. In a
-	 * file, each instrument is stored with its samples. Because of this, I
-	 * don't know how to find how many samples are present in the file. Thus
-	 * I have to do n_instruments reallocation on sigdata->sample.
-	 * Looking at FT2, it doesn't seem possible to have more than 16 samples
-	 * per instrument (even though n_samples is stored as 2 bytes). So maybe
-	 * we could allocate a 128*16 array of samples, and shrink it back to the
-	 * correct size when we know it?
-	 * Alternatively, I could allocate samples by blocks of N (still O(n)),
-	 * or double the number of allocated samples when I need more (O(log n)).
-	 */
-	total_samples = 0;
-	sigdata->sample = NULL;
-
-	for (i = 0; i < sigdata->n_instruments; i++) {
-		XM_INSTRUMENT_EXTRA extra;
-
-		if (it_xm_read_instrument(&sigdata->instrument[i], &extra, f) < 0) {
-			TRACE("XM error: instrument %d\n", i + 1);
-			_dumb_it_unload_sigdata(sigdata);
-			return NULL;
-		}
-
-		if (extra.n_samples) {
-			unsigned char roguebytes[XM_MAX_SAMPLES_PER_INSTRUMENT];
-
-			/* adjust instrument sample map (make indices absolute) */
-			for (j = 0; j < 96; j++)
-				sigdata->instrument[i].map_sample[j] += total_samples;
-
-			sigdata->sample = safe_realloc(sigdata->sample, sizeof(*sigdata->sample) * (total_samples + extra.n_samples));
-			if (!sigdata->sample) {
-				_dumb_it_unload_sigdata(sigdata);
-				return NULL;
-			}
-			for (j = total_samples; j < total_samples + extra.n_samples; j++)
-				sigdata->sample[j].right = sigdata->sample[j].left = NULL;
-
-			/* read instrument's samples */
-			for (j = 0; j < extra.n_samples; j++) {
-				IT_SAMPLE *sample = &sigdata->sample[total_samples + j];
-				int b = it_xm_read_sample_header(sample, f);
-				if (b < 0) {
-					_dumb_it_unload_sigdata(sigdata);
-					return NULL;
-				}
-				roguebytes[j] = b;
-				// Any reason why these can't be set inside it_xm_read_sample_header()?
-				sample->vibrato_speed = extra.vibrato_speed;
-				sample->vibrato_depth = extra.vibrato_depth;
-				sample->vibrato_rate = extra.vibrato_sweep;
-				/* Rate and sweep don't match, but the difference is
-				 * accounted for in itrender.c.
-				 */
-				sample->vibrato_waveform = xm_convert_vibrato[extra.vibrato_type];
-			}
-			for (j = 0; j < extra.n_samples; j++) {
-				if (it_xm_read_sample_data(&sigdata->sample[total_samples + j], roguebytes[j], f) != 0) {
-					_dumb_it_unload_sigdata(sigdata);
-					return NULL;
-				}
-			}
-			total_samples += extra.n_samples;
-		}
-	}
-
-	sigdata->n_samples = total_samples;
-
-	sigdata->flags = IT_WAS_AN_XM | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_STEREO | IT_USE_INSTRUMENTS;
-	// Are we OK with IT_COMPATIBLE_GXX off?
-	//
-	// When specifying note + instr + tone portamento, and an old note is still playing (even after note off):
-	// - If Compatible Gxx is on, the new note will be triggered only if the instrument _changes_.
-	// - If Compatible Gxx is off, the new note will always be triggered, provided the instrument is specified.
-	// - FT2 seems to do the latter (unconfirmed).
-
-	// Err, wait. XM playback has its own code. The change made to the IT
-	// playbackc code didn't affect XM playback. Forget this then. There's
-	// still a bug in XM playback though, and it'll need some investigation...
-	// tomorrow...
-
-	// UPDATE: IT_COMPATIBLE_GXX is required to be on, so that tone porta has
-	// separate memory from portamento.
-
-	if (flags & XM_LINEAR_FREQUENCY)
-		sigdata->flags |= IT_LINEAR_SLIDES;
-
-	sigdata->global_volume = 128;
-	sigdata->mixing_volume = 48;
-	sigdata->pan_separation = 128;
-
-	memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
-	memset(sigdata->channel_pan, 32, DUMB_IT_N_CHANNELS);
-
-	_dumb_it_fix_invalid_orders(sigdata);
-
-	return sigdata;
-}
-
-
-
-#if 0 // no fucking way, dude!
-
-/* The length returned is the time required to play from the beginning of the
- * file to the last row of the last order (which is when the player will
- * loop). Depending on the song, the sound might stop sooner.
- * Due to fixed point roundoffs, I think this is only reliable to the second.
- * Full precision could be achieved by using a double during the computation,
- * or maybe a LONG_LONG.
- */
-long it_compute_length(const DUMB_IT_SIGDATA *sigdata) {
-	IT_PATTERN *pattern;
-	int tempo, speed;
-	int loop_start[IT_N_CHANNELS];
-	char loop_count[IT_N_CHANNELS];
-	int order, entry;
-	int row_first_entry = 0;
-	int jump, jump_dest;
-	int delay, fine_delay;
-	int i;
-	long t;
-
-	if (!sigdata)
-		return 0;
-
-	tempo = sigdata->tempo;
-	speed = sigdata->speed;
-	order = entry = 0;
-	jump = jump_dest = 0;
-	t = 0;
-
-	/* for each PATTERN */
-	for (order = 0; order < sigdata->n_orders; order++) {
-
-		if (sigdata->order[order] == IT_ORDER_END) break;
-		if (sigdata->order[order] == IT_ORDER_SKIP) continue;
-
-		for (i = 0; i < IT_N_CHANNELS; i++)
-			loop_count[i] = -1;
-
-		pattern = &sigdata->pattern[sigdata->order[order]];
-		entry = 0;
-		if (jump == IT_BREAK_TO_ROW) {
-			int row = 0;
-			while (row < jump_dest)
-				if (pattern->entry[entry++].channel >= IT_N_CHANNELS)
-					row++;
-		}
-
-		/* for each ROW */
-		while (entry < pattern->n_entries) {
-			row_first_entry = entry;
-			delay = fine_delay = 0;
-			jump = 0;
-
-			/* for each note NOTE */
-			while (entry < pattern->n_entries && pattern->entry[entry].channel < IT_N_CHANNELS) {
-				int value = pattern->entry[entry].effectvalue;
-				int channel = pattern->entry[entry].channel;
-
-				switch (pattern->entry[entry].effect) {
-
-				case IT_SET_SPEED: speed = value; break;
-
-				case IT_JUMP_TO_ORDER:
-					if (value <= order) /* infinite loop */
-						return 0;
-					jump = IT_JUMP_TO_ORDER;
-					jump_dest = value;
-					break;
-
-				case IT_BREAK_TO_ROW:
-					jump = IT_BREAK_TO_ROW;
-					jump_dest = value;
-					break;
-
-				case IT_S:
-					switch (HIGH(value)) {
-					case IT_S_PATTERN_DELAY:      delay = LOW(value); break;
-					case IT_S_FINE_PATTERN_DELAY: fine_delay = LOW(value); break;
-					case IT_S_PATTERN_LOOP:
-						if (LOW(value) == 0) {
-							loop_start[channel] = row_first_entry;
-						} else {
-							if (loop_count[channel] == -1)
-								loop_count[channel] = LOW(value);
-
-							if (loop_count[channel]) {
-								jump = IT_S_PATTERN_LOOP;
-								jump_dest = loop_start[channel];
-							}
-							loop_count[channel]--;
-						}
-						break;
-					}
-					break;
-
-				case IT_SET_SONG_TEMPO:
-					switch (HIGH(value)) { /* slides happen every non-row frames */
-					case 0:  tempo = tempo - LOW(value) * (speed - 1); break;
-					case 1:  tempo = tempo + LOW(value) * (speed - 1); break;
-					default: tempo = value;
-					}
-					tempo = MID(32, tempo, 255);
-					break;
-				}
-
-				entry++;
-			}
-
-			/* end of ROW */
-			entry++;
-			t += TICK_TIME_DIVIDEND * (speed * (1 + delay) + fine_delay) / tempo;
-
-			if (jump == IT_JUMP_TO_ORDER) {
-				order = jump_dest - 1;
-				break;
-			} else if (jump == IT_BREAK_TO_ROW)
-				break;
-			else if (jump == IT_S_PATTERN_LOOP)
-				entry = jump_dest - 1;
-		}
-
-		/* end of PATTERN */
-	}
-
-	return t;
-}
-
-#endif /* 0 */
-
-
-
-DUH *dumb_read_xm(DUMBFILE *f) {
-	sigdata_t *sigdata;
-	long length;
-
-	DUH_SIGTYPE_DESC *descptr = &_dumb_sigtype_it;
-
-	sigdata = it_xm_load_sigdata(f);
-
-	if (!sigdata)
-		return NULL;
-
-	length = _dumb_it_build_checkpoints(sigdata);
-
-	return make_duh(length, 1, &descptr, &sigdata);
-}
-
-} // namespace AGS3
diff --git a/engines/ags/module.mk b/engines/ags/module.mk
index 6fa5f8089f..6fc4cf43a2 100644
--- a/engines/ags/module.mk
+++ b/engines/ags/module.mk
@@ -25,16 +25,9 @@ MODULE_OBJS = \
 	lib/allegro/mouse.o \
 	lib/allegro/system.o \
 	lib/allegro/unicode.o \
-	lib/audio/aldumb.o \
 	lib/audio/digi.o \
 	lib/audio/midi.o \
 	lib/audio/sound.o \
-	lib/dumb-0.9.2/dumb.o \
-	lib/dumb-0.9.2/dumbfile.o \
-	lib/dumb-0.9.2/helpers/clickrem.o \
-	lib/dumb-0.9.2/it/itmisc.o \
-	lib/dumb-0.9.2/it/itrender.o \
-	lib/dumb-0.9.2/it/itunload.o \
 	lib/hq2x/hq2x3x.o \
 	lib/std/std.o \
 	lib/system/datetime.o \




More information about the Scummvm-git-logs mailing list