diff options
author | elupus <elupus@svn> | 2010-01-23 20:28:12 +0000 |
---|---|---|
committer | elupus <elupus@svn> | 2010-01-23 20:28:12 +0000 |
commit | 514bc8bdcff14a6b0c38f4abed2bf9ffa9f74e4b (patch) | |
tree | b1eb4384a01a316836f1efc05171f8b89453e148 /lib | |
parent | c059a8975af3ba9b96eb194ccedb3c5f23c1e505 (diff) |
added: libmodplug library for win32 (totally untested, just made it compile and link)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@27112 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libmodplug/libmodplug_2008.sln | 20 | ||||
-rw-r--r-- | lib/libmodplug/libmodplug_2008.vcproj | 299 | ||||
-rw-r--r-- | lib/libmodplug/src/libmodplug/stdafx.h | 12 | ||||
-rw-r--r-- | lib/libmodplug/src/load_abc.cpp | 5 | ||||
-rw-r--r-- | lib/libmodplug/src/load_mid.cpp | 11 | ||||
-rw-r--r-- | lib/libmodplug/src/load_pat.cpp | 19 | ||||
-rw-r--r-- | lib/libmodplug/src/load_ptm.cpp | 2 | ||||
-rw-r--r-- | lib/libmodplug/src/snd_flt.cpp | 2 | ||||
-rw-r--r-- | lib/libmodplug/src/snd_fx.cpp | 1 | ||||
-rw-r--r-- | lib/libmodplug/src/sndfile.cpp | 16 | ||||
-rw-r--r-- | lib/libmodplug/src/sndmix.cpp | 4 | ||||
-rwxr-xr-x | lib/libmodplug/src/tables.h | 4 |
12 files changed, 365 insertions, 30 deletions
diff --git a/lib/libmodplug/libmodplug_2008.sln b/lib/libmodplug/libmodplug_2008.sln new file mode 100644 index 0000000000..d462572f2a --- /dev/null +++ b/lib/libmodplug/libmodplug_2008.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmodplug_2008", "libmodplug_2008.vcproj", "{C15B374E-7126-48FF-B618-A375D7B17FCF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C15B374E-7126-48FF-B618-A375D7B17FCF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C15B374E-7126-48FF-B618-A375D7B17FCF}.Debug|Win32.Build.0 = Debug|Win32
+ {C15B374E-7126-48FF-B618-A375D7B17FCF}.Release|Win32.ActiveCfg = Release|Win32
+ {C15B374E-7126-48FF-B618-A375D7B17FCF}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/lib/libmodplug/libmodplug_2008.vcproj b/lib/libmodplug/libmodplug_2008.vcproj new file mode 100644 index 0000000000..40974ee4ed --- /dev/null +++ b/lib/libmodplug/libmodplug_2008.vcproj @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="libmodplug_2008"
+ ProjectGUID="{C15B374E-7126-48FF-B618-A375D7B17FCF}"
+ RootNamespace="libmodplug_2008"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""$(InputDir)\libmodplug""
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;MSC_VER;_CRT_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories=""$(InputDir)\libmodplug""
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;MSC_VER;_CRT_SECURE_NO_WARNINGS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\src\fastmix.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_669.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_abc.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_amf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_ams.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_dbm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_dmf.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_dsm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_far.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_it.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_j2b.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_mdl.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_med.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_mid.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_mod.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_mt2.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_mtm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_okt.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_pat.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_pat.h"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_psm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_ptm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_s3m.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_stm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_ult.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_umx.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_wav.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\load_xm.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\mmcmp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\modplug.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\modplug.h"
+ >
+ </File>
+ <File
+ RelativePath=".\src\snd_dsp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\snd_flt.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\snd_fx.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\sndfile.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\sndmix.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\tables.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/lib/libmodplug/src/libmodplug/stdafx.h b/lib/libmodplug/src/libmodplug/stdafx.h index 6631b8b0b6..e4815aaaf2 100644 --- a/lib/libmodplug/src/libmodplug/stdafx.h +++ b/lib/libmodplug/src/libmodplug/stdafx.h @@ -36,9 +36,20 @@ #include <stdio.h> #include <malloc.h> +#pragma warning(disable:4996) + +typedef unsigned __int32 uint32_t; +typedef __int32 int32_t; +typedef unsigned __int16 uint16_t; +typedef __int16 int16_t; +typedef unsigned __int8 uint8_t; +typedef __int8 int8_t; + #define srandom(_seed) srand(_seed) #define random() rand() #define sleep(_ms) Sleep(_ms) +#define strncasecmp strnicmp +#define strcasecmp stricmp inline void ProcessPlugins(int n) {} @@ -47,6 +58,7 @@ inline void ProcessPlugins(int n) {} #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <unistd.h> #ifdef HAVE_MALLOC_H #include <malloc.h> #endif diff --git a/lib/libmodplug/src/load_abc.cpp b/lib/libmodplug/src/load_abc.cpp index 2fe8ea2bc9..448b26ac82 100644 --- a/lib/libmodplug/src/load_abc.cpp +++ b/lib/libmodplug/src/load_abc.cpp @@ -29,7 +29,7 @@ #include <string.h> #include <math.h> #include <ctype.h> -#include <unistd.h> // for sleep +#include "stdafx.h" #ifdef NEWMIKMOD #include "mikmod.h" @@ -400,6 +400,7 @@ static void abc_dumptracks(ABCHANDLE *h, const char *p) #define DupStr(h,buf,sz) strdup(buf) #define _mm_calloc(h,n,sz) calloc(n,sz) #define _mm_recalloc(h,buf,sz,elsz) realloc(buf,sz) +#undef _mm_free #define _mm_free(h,p) free(p) typedef struct { @@ -2369,7 +2370,7 @@ static ABCHANDLE *ABC_Init(void) } } else { - srandom(time(0)); // initialize random generator with seed + srandom((unsigned int)time(0)); // initialize random generator with seed retval->pickrandom = 1+(int)(10000.0*random()/(RAND_MAX+1.0)); // can handle pickin' from songbooks with 10.000 songs #ifdef NEWMIKMOD diff --git a/lib/libmodplug/src/load_mid.cpp b/lib/libmodplug/src/load_mid.cpp index 1429af4baf..5a84b3500b 100644 --- a/lib/libmodplug/src/load_mid.cpp +++ b/lib/libmodplug/src/load_mid.cpp @@ -29,7 +29,7 @@ #include <string.h> #include <math.h> #include <ctype.h> -#include <unistd.h> // for sleep +#include "stdafx.h" #ifdef NEWMIKMOD #include "mikmod.h" @@ -119,6 +119,7 @@ typedef struct _MIDTRACK #define DupStr(h,buf,sz) strdup(buf) #define _mm_calloc(h,n,sz) calloc(n,sz) #define _mm_recalloc(h,buf,sz,elsz) realloc(buf,sz) +#undef _mm_free #define _mm_free(h,p) free(p) typedef struct { @@ -1157,7 +1158,7 @@ static int MID_ReadPatterns(MODCOMMAND *pattern[], WORD psize[], MIDHANDLE *h, i n = pat_modnote(e->note); ins = e->smpno; if( e->volume == 0 ) { - m->param = modticks(h, e->tracktick - tt1); + m->param = (BYTE)modticks(h, e->tracktick - tt1); if( m->param ) { // note cut m->command = CMD_S3MCMDEX; m->param |= 0xC0; @@ -1171,14 +1172,14 @@ static int MID_ReadPatterns(MODCOMMAND *pattern[], WORD psize[], MIDHANDLE *h, i else { vol = e->volume/2; if( el->volume == 0 ) { - m->param = modticks(h, el->tracktick - tt1); + m->param = (BYTE)modticks(h, el->tracktick - tt1); if( m->param ) { // note cut m->command = CMD_S3MCMDEX; m->param |= 0xC0; } } else { - m->param = modticks(h, e->tracktick - tt1); + m->param = (BYTE)modticks(h, e->tracktick - tt1); if( m->param ) { // note delay m->command = CMD_S3MCMDEX; m->param |= 0xD0; @@ -1211,7 +1212,7 @@ static int MID_ReadPatterns(MODCOMMAND *pattern[], WORD psize[], MIDHANDLE *h, i } else { // retrigger same note... m->command = CMD_RETRIG; - m->param = modticks(h, el->tracktick - tt1); + m->param = (BYTE)modticks(h, el->tracktick - tt1); } } else diff --git a/lib/libmodplug/src/load_pat.cpp b/lib/libmodplug/src/load_pat.cpp index 9f8a6d838c..032f95e341 100644 --- a/lib/libmodplug/src/load_pat.cpp +++ b/lib/libmodplug/src/load_pat.cpp @@ -33,7 +33,7 @@ #include <string.h> #include <math.h> #include <ctype.h> -#include <unistd.h> // for sleep +#include "stdafx.h" #ifdef NEWMIKMOD #include "mikmod.h" @@ -134,9 +134,9 @@ typedef struct { #define C4SPD 8363 #define C4mHz 523251 -#define C4 523.251 -#define PI 3.141592653589793 -#define OMEGA ((2.0 * PI * C4)/(float)C4SPD) +#define C4 523.251f +#define PI 3.141592653589793f +#define OMEGA ((2.0f * PI * C4)/(float)C4SPD) /************************************************************************** **************************************************************************/ @@ -252,9 +252,9 @@ static float pat_sinus(int i) static float pat_square(int i) { - float res = 30.0 * sinf(OMEGA * (float)i); - if( res > 0.99 ) return 0.99; - if( res < -0.99 ) return -0.99; + float res = 30.0f * sinf(OMEGA * (float)i); + if( res > 0.99f ) return 0.99f; + if( res < -0.99f ) return -0.99f; return res; } @@ -269,8 +269,8 @@ static float pat_sawtooth(int i) i = -2; } res = (float)i * res / PI; - if( res > 0.9 ) return 1.0 - res; - if( res < -0.9 ) return 1.0 + res; + if( res > 0.9f ) return 1.0f - res; + if( res < -0.9f ) return 1.0f + res; return res; } @@ -299,6 +299,7 @@ static PAT_SAMPLE_FUN pat_fun[] = { pat_sinus, pat_square, pat_sawtooth }; #define DupStr(h,buf,sz) strdup(buf) #define _mm_calloc(h,n,sz) calloc(n,sz) #define _mm_recalloc(h,buf,sz,elsz) realloc(buf,sz) +#undef _mm_free #define _mm_free(h,p) free(p) typedef struct { diff --git a/lib/libmodplug/src/load_ptm.cpp b/lib/libmodplug/src/load_ptm.cpp index 3acc5596fc..83df89d29f 100644 --- a/lib/libmodplug/src/load_ptm.cpp +++ b/lib/libmodplug/src/load_ptm.cpp @@ -114,7 +114,7 @@ BOOL CSoundFile::ReadPTM(const BYTE *lpStream, DWORD dwMemLength) if ((psmp->sampletype & 3) == 1) { UINT smpflg = RS_PCM8D; - DWORD samplepos = psmp->fileofs[1] << 16 + + DWORD samplepos = (psmp->fileofs[1] << 16) + psmp->fileofs[0]; pins->nLength = bswapLE32(*(LPDWORD)(psmp->length)); pins->nLoopStart = bswapLE32(*(LPDWORD)(psmp->loopbeg)); diff --git a/lib/libmodplug/src/snd_flt.cpp b/lib/libmodplug/src/snd_flt.cpp index 0865e59770..f8a573cbe6 100644 --- a/lib/libmodplug/src/snd_flt.cpp +++ b/lib/libmodplug/src/snd_flt.cpp @@ -80,7 +80,7 @@ void CSoundFile::SetupChannelFilter(MODCHANNEL *pChn, BOOL bReset, int flt_modif float d = (1.0f-2.0f*dmpfac)* fc; if (d>2.0) d = 2.0; d = (2.0f*dmpfac - d)/fc; - float e = pow(1.0f/fc,2.0); + float e = pow(1.0f/fc,2.0f); fg=1/(1+d+e); fb0=(d+e+e)/(1+d+e); diff --git a/lib/libmodplug/src/snd_fx.cpp b/lib/libmodplug/src/snd_fx.cpp index a0287b2127..dcc875d292 100644 --- a/lib/libmodplug/src/snd_fx.cpp +++ b/lib/libmodplug/src/snd_fx.cpp @@ -7,6 +7,7 @@ #include "stdafx.h" #include "sndfile.h" #include "tables.h" +#include <stdlib.h> #ifdef MSC_VER #pragma warning(disable:4244) diff --git a/lib/libmodplug/src/sndfile.cpp b/lib/libmodplug/src/sndfile.cpp index 88baf2ebca..66defb2983 100644 --- a/lib/libmodplug/src/sndfile.cpp +++ b/lib/libmodplug/src/sndfile.cpp @@ -6,8 +6,8 @@ */ #include <math.h> //for GCCFIX -#include <libmodplug/stdafx.h> -#include <libmodplug/sndfile.h> +#include "libmodplug/stdafx.h" +#include "libmodplug/sndfile.h" #define MMCMP_SUPPORT @@ -1634,9 +1634,6 @@ void CSoundFile::AdjustSampleLoop(MODINSTRUMENT *pIns) DWORD CSoundFile::TransposeToFrequency(int transp, int ftune) //----------------------------------------------------------- { - //---GCCFIX: Removed assembly. - return (DWORD)(8363*pow(2, (transp*128+ftune)/(1536))); - #ifdef MSC_VER const float _fbase = 8363; const float _factor = 1.0f/(12.0f*128.0f); @@ -1666,6 +1663,9 @@ DWORD CSoundFile::TransposeToFrequency(int transp, int ftune) if (derr <= 5) freq -= derr; if (derr >= 995) freq += 1000-derr; return freq; +#else + //---GCCFIX: Removed assembly. + return (DWORD)(8363*pow(2, (transp*128+ftune)/(1536))); #endif } @@ -1674,9 +1674,6 @@ DWORD CSoundFile::TransposeToFrequency(int transp, int ftune) int CSoundFile::FrequencyToTranspose(DWORD freq) //---------------------------------------------- { - //---GCCFIX: Removed assembly. - return int(1536*(log(freq/8363)/log(2))); - #ifdef MSC_VER const float _f1_8363 = 1.0f / 8363.0f; const float _factor = 128 * 12; @@ -1692,6 +1689,9 @@ int CSoundFile::FrequencyToTranspose(DWORD freq) fistp result } return result; +#else + //---GCCFIX: Removed assembly. + return int(1536*(log(freq/8363)/log(2))); #endif } diff --git a/lib/libmodplug/src/sndmix.cpp b/lib/libmodplug/src/sndmix.cpp index a2078d76ee..4be1c4e298 100644 --- a/lib/libmodplug/src/sndmix.cpp +++ b/lib/libmodplug/src/sndmix.cpp @@ -4,8 +4,8 @@ * Authors: Olivier Lapicque <olivierl@jps.net> */ -#include <libmodplug/stdafx.h> -#include <libmodplug/sndfile.h> +#include "libmodplug/stdafx.h" +#include "libmodplug/sndfile.h" #include "tables.h" #ifdef MODPLUG_TRACKER diff --git a/lib/libmodplug/src/tables.h b/lib/libmodplug/src/tables.h index ebe5ceadb0..a572caef86 100755 --- a/lib/libmodplug/src/tables.h +++ b/lib/libmodplug/src/tables.h @@ -4,8 +4,8 @@ * Authors: Olivier Lapicque <olivierl@jps.net> */ -#include <libmodplug/stdafx.h> -#include <libmodplug/sndfile.h> +#include "libmodplug/stdafx.h" +#include "libmodplug/sndfile.h" #ifndef MODPLUG_FASTSOUNDLIB //#pragma data_seg(".tables") |