From: <man...@us...> - 2013-06-08 19:03:30
|
Revision: 2329 http://sourceforge.net/p/modplug/code/2329 Author: manxorist Date: 2013-06-08 19:03:21 +0000 (Sat, 08 Jun 2013) Log Message: ----------- [Fix] Correct truncation/rounding in C versions of output sample format converter functions. [Ref] Use overloading instead of function names to select the proper conversion function. [Ref] Tag the names of the old conversion functions with "Interleaved". [Ref] Move the declarations into Sndfile.h instead of duplicating them in multiple cpp files. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/Waveform.cpp Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-08 18:11:19 UTC (rev 2328) +++ trunk/OpenMPT/common/typedefs.h 2013-06-08 19:03:21 UTC (rev 2329) @@ -234,6 +234,8 @@ } }; STATIC_ASSERT(sizeof(int24) == 3); +#define int24_min (0-0x00800000) +#define int24_max (0+0x007fffff) typedef float float32; STATIC_ASSERT(sizeof(float32) == 4); Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-08 18:11:19 UTC (rev 2328) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-08 19:03:21 UTC (rev 2329) @@ -1728,13 +1728,71 @@ ////////////////////////////////////////////////////////////////////////////////////////// +template<typename Tsample> +forceinline Tsample ConvertSample(int val) +{ + STATIC_ASSERT(false); // unimplemented +} +template<> +forceinline uint8 ConvertSample(int val) +{ + val = (val + (1<<(23-MIXING_ATTENUATION))) >> (24-MIXING_ATTENUATION); + if(val < int8_min) val = int8_min; + if(val > int8_max) val = int8_max; + return (uint8)(val+0x80); // unsigned +} +template<> +forceinline int16 ConvertSample(int val) +{ + val = (val + (1<<(15-MIXING_ATTENUATION))) >> (16-MIXING_ATTENUATION); + if(val < int16_min) val = int16_min; + if(val > int16_max) val = int16_max; + return (int16)val; +} +template<> +forceinline int24 ConvertSample(int val) +{ + val = (val + (1<<(7-MIXING_ATTENUATION))) >> (8-MIXING_ATTENUATION); + if(val < int24_min) val = int24_min; + if(val > int24_max) val = int24_max; + return (int24)val; +} +template<> +forceinline int32 ConvertSample(int val) +{ + return (int32)(Clamp(val, (int)MIXING_CLIPMIN, (int)MIXING_CLIPMAX) << MIXING_ATTENUATION); +} + +template<typename Tsample> +forceinline void C_Convert32ToInterleaved(Tsample *p, const int *mixbuffer, std::size_t count) +{ + for(std::size_t i = 0; i < count; ++i) + { + p[i] = ConvertSample<Tsample>(mixbuffer[i]); + } +} + +template<typename Tsample> +forceinline void C_Convert32ToNonInterleaved(Tsample * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) +{ + for(std::size_t i = 0; i < count; ++i) + { + for(std::size_t channel = 0; channel < channels; ++channel) + { + buffers[channel][i] = ConvertSample<Tsample>(*mixbuffer); + mixbuffer++; + } + } +} + + #ifdef ENABLE_X86 -static void X86_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------------- +static void X86_Convert32To8(uint8 *lp8, const int *pBuffer, DWORD lSampleCount) +//------------------------------------------------------------------------------ { _asm { - mov ebx, lp16 // ebx = 8-bit buffer + mov ebx, lp8 // ebx = 8-bit buffer mov edx, pBuffer // edx = pBuffer mov edi, lSampleCount // edi = lSampleCount cliploop: @@ -1764,50 +1822,27 @@ } #endif -static void C_Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//----------------------------------------------------------------------- -{ - uint8 * p = (uint8*)lp16; - for(DWORD i=0; i<lSampleCount; i++) - { - int v = pBuffer[i]; - if(v < MIXING_CLIPMIN) v = MIXING_CLIPMIN; - else if(v > MIXING_CLIPMAX) v = MIXING_CLIPMAX; - p[i] = (uint8)((v >> (24-MIXING_ATTENUATION))+0x80); // unsigned - } -} - // Clip and convert to 8 bit -void Convert32To8(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------- +void Convert32ToInterleaved(uint8 *dest, const int *mixbuffer, std::size_t count) +//------------------------------------------------------------------------------- { #ifdef ENABLE_X86 - X86_Convert32To8(lp16, pBuffer, lSampleCount); + X86_Convert32To8(dest, mixbuffer, count); #else - C_Convert32To8(lp16, pBuffer, lSampleCount); + C_Convert32ToInterleaved(dest, mixbuffer, count); #endif } void Convert32ToNonInterleaved(uint8 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) //-------------------------------------------------------------------------------------------------------------------------- { - for(std::size_t i = 0; i < count; ++i) - { - for(std::size_t channel = 0; channel < channels; ++channel) - { - int v = *mixbuffer; - if(v < MIXING_CLIPMIN) v = MIXING_CLIPMIN; - else if(v > MIXING_CLIPMAX) v = MIXING_CLIPMAX; - buffers[channel][i] = (uint8)((v >> (24-MIXING_ATTENUATION))+0x80); // unsigned - mixbuffer++; - } - } + C_Convert32ToNonInterleaved(buffers, mixbuffer, channels, count); } #ifdef ENABLE_X86 -static void X86_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------------- +static void X86_Convert32To16(int16 *lp16, const int *pBuffer, DWORD lSampleCount) +//-------------------------------------------------------------------------------- { _asm { mov ebx, lp16 // ebx = 16-bit buffer @@ -1839,50 +1874,30 @@ } #endif -static void C_Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------------ -{ - int16 * p = (int16*)lp16; - for(DWORD i=0; i<lSampleCount; i++) - { - int v = pBuffer[i]; - if(v < MIXING_CLIPMIN) v = MIXING_CLIPMIN; - else if(v > MIXING_CLIPMAX) v = MIXING_CLIPMAX; - p[i] = (int16)(v >> (16-MIXING_ATTENUATION)); - } -} - // Clip and convert to 16 bit -void Convert32To16(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//--------------------------------------------------------------- +void Convert32ToInterleaved(int16 *dest, const int *mixbuffer, std::size_t count) +//------------------------------------------------------------------------------- { #ifdef ENABLE_X86 - X86_Convert32To16(lp16, pBuffer, lSampleCount); + X86_Convert32To16(dest, mixbuffer, count); #else - C_Convert32To16(lp16, pBuffer, lSampleCount); + C_Convert32ToInterleaved(dest, mixbuffer, count); #endif } void Convert32ToNonInterleaved(int16 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) //-------------------------------------------------------------------------------------------------------------------------- { - for(std::size_t i = 0; i < count; ++i) - { - for(std::size_t channel = 0; channel < channels; ++channel) - { - buffers[channel][i] = (int16)(Clamp(*mixbuffer, (int)MIXING_CLIPMIN, (int)MIXING_CLIPMAX) >> (16-MIXING_ATTENUATION)); - mixbuffer++; - } - } + C_Convert32ToNonInterleaved(buffers, mixbuffer, channels, count); } #ifdef ENABLE_X86 -static void X86_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------------- +static void X86_Convert32To24(int24 *lp24, const int *pBuffer, DWORD lSampleCount) +//-------------------------------------------------------------------------------- { _asm { - mov ebx, lp16 // ebx = 8-bit buffer + mov ebx, lp24 // ebx = 24-bit buffer mov edx, pBuffer // edx = pBuffer mov edi, lSampleCount // edi = lSampleCount cliploop: @@ -1913,51 +1928,30 @@ } #endif -static void C_Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------------ -{ - int24 * p = (int24*)lp16; - for(DWORD i=0; i<lSampleCount; i++) - { - int v = pBuffer[i]; - if(v < MIXING_CLIPMIN) v = MIXING_CLIPMIN; - else if(v > MIXING_CLIPMAX) v = MIXING_CLIPMAX; - v >>= (8-MIXING_ATTENUATION); - p[i] = (int24)v; - } -} - // Clip and convert to 24 bit -void Convert32To24(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//--------------------------------------------------------------- +void Convert32ToInterleaved(int24 *dest, const int *mixbuffer, std::size_t count) +//------------------------------------------------------------------------------- { #ifdef ENABLE_X86 - X86_Convert32To24(lp16, pBuffer, lSampleCount); + X86_Convert32To24(dest, mixbuffer, count); #else - C_Convert32To24(lp16, pBuffer, lSampleCount); + C_Convert32ToInterleaved(dest, mixbuffer, count); #endif } void Convert32ToNonInterleaved(int24 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) //-------------------------------------------------------------------------------------------------------------------------- { - for(std::size_t i = 0; i < count; ++i) - { - for(std::size_t channel = 0; channel < channels; ++channel) - { - buffers[channel][i] = (int24)(Clamp(*mixbuffer, (int)MIXING_CLIPMIN, (int)MIXING_CLIPMAX) >> (8-MIXING_ATTENUATION)); - mixbuffer++; - } - } + C_Convert32ToNonInterleaved(buffers, mixbuffer, channels, count); } #ifdef ENABLE_X86 -static void X86_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//-------------------------------------------------------------------------- +static void X86_Convert32To32(int32 *lp32, const int *pBuffer, DWORD lSampleCount) +//-------------------------------------------------------------------------------- { _asm { - mov ebx, lp16 // ebx = 32-bit buffer + mov ebx, lp32 // ebx = 32-bit buffer mov edx, pBuffer // edx = pBuffer mov edi, lSampleCount // edi = lSampleCount cliploop: @@ -1985,53 +1979,32 @@ } #endif -static void C_Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------------ -{ - int32 * p = (int32*)lp16; - for(DWORD i=0; i<lSampleCount; i++) - { - int v = pBuffer[i]; - if(v < MIXING_CLIPMIN) v = MIXING_CLIPMIN; - else if(v > MIXING_CLIPMAX) v = MIXING_CLIPMAX; - p[i] = v << MIXING_ATTENUATION; - } -} - // Clip and convert to 32 bit -void Convert32To32(LPVOID lp16, int *pBuffer, DWORD lSampleCount) -//--------------------------------------------------------------- +void Convert32ToInterleaved(int32 *dest, const int *mixbuffer, std::size_t count) +//------------------------------------------------------------------------------- { #ifdef ENABLE_X86 - X86_Convert32To32(lp16, pBuffer, lSampleCount); + X86_Convert32To32(dest, mixbuffer, count); #else - C_Convert32To32(lp16, pBuffer, lSampleCount); + C_Convert32ToInterleaved(dest, mixbuffer, count); #endif } void Convert32ToNonInterleaved(int32 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) //-------------------------------------------------------------------------------------------------------------------------- { - for(std::size_t i = 0; i < count; ++i) - { - for(std::size_t channel = 0; channel < channels; ++channel) - { - buffers[channel][i] = (int32)(Clamp(*mixbuffer, (int)MIXING_CLIPMIN, (int)MIXING_CLIPMAX) << MIXING_ATTENUATION); - mixbuffer++; - } - } + C_Convert32ToNonInterleaved(buffers, mixbuffer, channels, count); } // convert to 32 bit floats and do NOT clip to [-1,1] -void Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD lSampleCount) -//------------------------------------------------------------------------ +void Convert32ToInterleaved(float *dest, const int *mixbuffer, std::size_t count) +//------------------------------------------------------------------------------- { const float factor = (1.0f/(float)MIXING_CLIPMAX); - float *out = (float*)lpBuffer; - for(DWORD i=0; i<lSampleCount; i++) + for(std::size_t i=0; i<count; i++) { - out[i] = pBuffer[i] * factor; + dest[i] = mixbuffer[i] * factor; } } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-06-08 18:11:19 UTC (rev 2328) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-06-08 19:03:21 UTC (rev 2329) @@ -191,7 +191,19 @@ void MonoMixToFloat(const int *pSrc, float *pOut, UINT nCount, const float _i2fc); void FloatToMonoMix(const float *pIn, int *pOut, UINT nCount, const float _f2ic); +void Convert32ToInterleaved(uint8 *dest, const int *mixbuffer, std::size_t count); +void Convert32ToInterleaved(int16 *dest, const int *mixbuffer, std::size_t count); +void Convert32ToInterleaved(int24 *dest, const int *mixbuffer, std::size_t count); +void Convert32ToInterleaved(int32 *dest, const int *mixbuffer, std::size_t count); +void Convert32ToInterleaved(float *dest, const int *mixbuffer, std::size_t count); +void Convert32ToNonInterleaved(uint8 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); +void Convert32ToNonInterleaved(int16 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); +void Convert32ToNonInterleaved(int24 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); +void Convert32ToNonInterleaved(int32 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); +void Convert32ToNonInterleaved(float * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); + + #if MPT_COMPILER_MSVC #pragma warning(disable:4324) //structure was padded due to __declspec(align()) #endif Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-08 18:11:19 UTC (rev 2328) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-08 19:03:21 UTC (rev 2329) @@ -35,18 +35,12 @@ typedef void (* LPCONVERTPROC)(LPVOID, int *, DWORD); -extern void Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32To32(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD lSampleCount); +static void Convert32To8( LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((uint8*)lpBuffer, pBuffer, nSamples); } +static void Convert32To16(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int16*)lpBuffer, pBuffer, nSamples); } +static void Convert32To24(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int24*)lpBuffer, pBuffer, nSamples); } +static void Convert32To32(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int32*)lpBuffer, pBuffer, nSamples); } +static void Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((float*)lpBuffer, pBuffer, nSamples); } -extern void Convert32ToNonInterleaved(uint8 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); -extern void Convert32ToNonInterleaved(int16 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); -extern void Convert32ToNonInterleaved(int24 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); -extern void Convert32ToNonInterleaved(int32 * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); -extern void Convert32ToNonInterleaved(float * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count); - template<typename Tsample> void Convert32ToNonInterleaved(void * const *outputBuffers, std::size_t offset, const int *mixbuffer, std::size_t channels, std::size_t count) { Modified: trunk/OpenMPT/soundlib/Waveform.cpp =================================================================== --- trunk/OpenMPT/soundlib/Waveform.cpp 2013-06-08 18:11:19 UTC (rev 2328) +++ trunk/OpenMPT/soundlib/Waveform.cpp 2013-06-08 19:03:21 UTC (rev 2329) @@ -54,9 +54,6 @@ #endif extern void Dither(int *pBuffer, UINT nSamples, UINT nBits); -extern void Convert32To8(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32To16(LPVOID lpBuffer, int *, DWORD nSamples); -extern void Convert32To24(LPVOID lpBuffer, int *, DWORD nSamples); UINT CSoundFile::Normalize24BitBuffer(LPBYTE pbuffer, UINT dwSize, DWORD lmax24, DWORD dwByteInc) //----------------------------------------------------------------------------------------------- @@ -71,9 +68,9 @@ Dither(tempbuf, nbuf, 8 * dwByteInc); switch(dwByteInc) { - case 2: Convert32To16(pbuffer, tempbuf, nbuf); break; - case 3: Convert32To24(pbuffer, tempbuf, nbuf); break; - default: Convert32To8(pbuffer, tempbuf, nbuf); break; + case 1: Convert32ToInterleaved((uint8*)pbuffer, tempbuf, nbuf); break; + case 2: Convert32ToInterleaved((int16*)pbuffer, tempbuf, nbuf); break; + case 3: Convert32ToInterleaved((int24*)pbuffer, tempbuf, nbuf); break; } n -= nbuf; pbuffer += dwByteInc * nbuf; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-08 23:47:00
|
Revision: 2335 http://sourceforge.net/p/modplug/code/2335 Author: saga-games Date: 2013-06-08 23:46:51 +0000 (Sat, 08 Jun 2013) Log Message: ----------- [Fix] Sample editor: Fractional sample frequency display didn't always show the correct fraction. [Fix] MOD playback: Frequency limiting was not always correct in PT1x mode (Fixes black_queen.mod) [Mod] OpenMPT: Version is now 1.22.03.03 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-08 20:01:49 UTC (rev 2334) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-08 23:46:51 UTC (rev 2335) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 02 +#define VER_MINORMINOR 03 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2013-06-08 20:01:49 UTC (rev 2334) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2013-06-08 23:46:51 UTC (rev 2335) @@ -2246,7 +2246,7 @@ uint32 freq = sndFile.GetFreqFromPeriod(sndFile.GetPeriodFromNote(note + (sndFile.GetType() == MOD_TYPE_XM ? sample.RelativeTone : 0), sample.nFineTune, sample.nC5Speed), sample.nC5Speed, 0); CHAR s[32]; - wsprintf(s, "%s (%d.%d Hz)", szDefaultNoteNames[note - 1], freq >> FREQ_FRACBITS, Util::muldiv(freq & ((1 << FREQ_FRACBITS) - 1), 100, 1 << FREQ_FRACBITS)); + wsprintf(s, "%s (%d.%02d Hz)", szDefaultNoteNames[note - 1], freq >> FREQ_FRACBITS, Util::muldiv(freq & ((1 << FREQ_FRACBITS) - 1), 100, 1 << FREQ_FRACBITS)); pMainFrm->SetInfoText(s); } } Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-08 20:01:49 UTC (rev 2334) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-08 23:46:51 UTC (rev 2335) @@ -1871,9 +1871,15 @@ // Test case: AmigaLimits.s3m, AmigaLimitsFinetune.mod if(m_SongFlags[SONG_AMIGALIMITS | SONG_PT1XMODE]) { - ASSERT(pChn->nFineTune == 0 || GetType() != MOD_TYPE_S3M); - Limit(period, 113 * 4 - pChn->nFineTune, 856 * 4 - pChn->nFineTune); - Limit(pChn->nPeriod, 113 * 4 - pChn->nFineTune, 856 * 4 - pChn->nFineTune); + int limitLow = 113 * 4, limitHigh = 856 * 4; + if(m_SongFlags[SONG_PT1XMODE]) + { + const int tableOffset = XM2MODFineTune(pChn->nFineTune) * 12; + limitLow = ProTrackerTunedPeriods[tableOffset + 11] / 2; + limitHigh = ProTrackerTunedPeriods[tableOffset] * 2; + } + Limit(period, limitLow, limitHigh); + Limit(pChn->nPeriod, limitLow, limitHigh); } ProcessPanbrello(pChn); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-11 22:49:36
|
Revision: 2339 http://sourceforge.net/p/modplug/code/2339 Author: manxorist Date: 2013-06-11 22:49:30 +0000 (Tue, 11 Jun 2013) Log Message: ----------- [Imp] Actually build the libopenpmt examples (at least on unix). [Ref] Simplify dynamic linking in unix makefile. [Ref] Add basic support for building with unknown compilers without using any compiler-specific extensions. This does not really work yet because we depend on a way to tell the compiler that a specific structure should be tightly packed (for which there is no standard way to do it). Modified Paths: -------------- trunk/OpenMPT/common/CompilerDetect.h trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp trunk/OpenMPT/libopenmpt/libopenmpt_internal.h trunk/OpenMPT/openmpt123/Makefile trunk/OpenMPT/openmpt123/openmpt123.cpp Property Changed: ---------------- trunk/OpenMPT/libopenmpt/examples/ Modified: trunk/OpenMPT/common/CompilerDetect.h =================================================================== --- trunk/OpenMPT/common/CompilerDetect.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/common/CompilerDetect.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -17,8 +17,13 @@ -#if defined(__clang__) +#if defined(MPT_COMPILER_GENERIC) +#undef MPT_COMPILER_GENERIC +#define MPT_COMPILER_GENERIC 1 + +#elif defined(__clang__) + #define MPT_COMPILER_CLANG 1 #define MPT_COMPILER_CLANG_VERSION MPT_COMPILER_MAKE_VERSION3(__clang_major__,__clang_minor__,__clang_patchlevel__) #define MPT_CLANG_AT_LEAST(major,minor,patch) (MPT_COMPILER_CLANG_VERSION >= MPT_COMPILER_MAKE_VERSION3((major),(minor),(patch))) @@ -64,6 +69,9 @@ +#ifndef MPT_COMPILER_GENERIC +#define MPT_COMPILER_GENERIC 0 +#endif #ifndef MPT_COMPILER_CLANG #define MPT_COMPILER_CLANG 0 #define MPT_CLANG_AT_LEAST(major,minor,patch) 0 Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/common/typedefs.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -60,6 +60,8 @@ #define NEEDS_PRAGMA_PACK #elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define PACKED __attribute__((packed)) __attribute__((aligned(1))) +#else +#define PACKED alignas(1) #endif @@ -68,6 +70,8 @@ #define ALIGN(n) __declspec(align(n)) #elif MPT_COMPILER_GCC || MPT_COMPILER_CLANG #define ALIGN(n) __attribute__((aligned(n))) +#else +#define ALIGN(n) alignas(n) #endif Index: trunk/OpenMPT/libopenmpt/examples =================================================================== --- trunk/OpenMPT/libopenmpt/examples 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/examples 2013-06-11 22:49:30 UTC (rev 2339) Property changes on: trunk/OpenMPT/libopenmpt/examples ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,2 ## +*.d +*.o Modified: trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/examples/libopenmpt_example_cxx.cpp 2013-06-11 22:49:30 UTC (rev 2339) @@ -10,6 +10,8 @@ #include <fstream> #include <vector> +#include <cstring> + #include <libopenmpt/libopenmpt.hpp> #include <portaudio.h> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_internal.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-06-11 22:49:30 UTC (rev 2339) @@ -11,7 +11,9 @@ #define LIBOPENMPT_INTERNAL_H /* disable alpha version warning in internal builds */ +#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING +#endif #include "libopenmpt_config.h" Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/openmpt123/Makefile 2013-06-11 22:49:30 UTC (rev 2339) @@ -52,8 +52,13 @@ ifeq ($(DYNLINK),1) LDFLAGS += -Wl,-rpath,./bin -Wl,-rpath,../bin +LDFLAGS_LIBOPENMPT += -Lbin +LDLIBS_LIBOPENMPT += -lopenmpt endif +#CPPFLAGS += -DMPT_COMPILER_GENERIC +CPPFLAGS += -DLIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING + #CXXFLAGS += -mtune=generic #CFLAGS += -mtune=generic @@ -147,7 +152,13 @@ ALL_OBJECTS += $(LIBOPENMPT_OBJECTS) ALL_DEPENDS += $(LIBOPENMPT_DEPENDS) +ifeq ($(DYNLINK),1) +OUTPUT_LIBOPENMPT += bin/libopenmpt.so +else +OBJECTS_LIBOPENMPT += $(LIBOPENMPT_OBJECTS) +endif + LIBOPENMPT_MODPLUG_C_SOURCES += \ ../libopenmpt/libopenmpt_modplug.c \ @@ -179,11 +190,14 @@ -include $(ALL_DEPENDS) +OUTPUTS += bin/openmpt.a OUTPUTS += bin/libopenmpt.so -OUTPUTS += bin/openmpt.a OUTPUTS += bin/openmpt123 -#OUTPUTS += bin/libopenmpt_modplug.so -#OUTPUTS += bin/modplug123 +OUTPUTS += bin/libopenmpt_example_c +OUTPUTS += bin/libopenmpt_example_c_mem +OUTPUTS += bin/libopenmpt_example_cxx +OUTPUTS += bin/libopenmpt_modplug.so +OUTPUTS += bin/modplug123 all: $(OUTPUTS) @@ -191,33 +205,33 @@ test: all bin/openmpt123 --runtests +bin/openmpt.a: $(LIBOPENMPT_OBJECTS) + $(INFO) [AR ] $@ + $(SILENT)$(AR) $(ARFLAGS) $@ $^ + bin/libopenmpt.so: $(LIBOPENMPT_OBJECTS) $(INFO) [LD ] $@ $(SILENT)$(LINK.cc) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ -ifeq ($(DYNLINK),1) -bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) +bin/libopenmpt_modplug.so: $(LIBOPENMPT_MODPLUG_OBJECTS) $(OBJECTS_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -shared -Lbin $^ $(LOADLIBES) $(LDLIBS) -o $@ -else -bin/libopenmpt_modplug.so: $(LIBOPENMPT_OBJECTS) $(LIBOPENMPT_MODPLUG_OBJECTS) + $(SILENT)$(LINK.cc) -shared $(LDFLAGS_LIBOPENMPT) $^ $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ + +bin/openmpt123: $(OPENMPT123_OBJECTS) $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ -endif + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ -bin/openmpt.a: $(LIBOPENMPT_OBJECTS) - $(INFO) [AR ] $@ - $(SILENT)$(AR) $(ARFLAGS) $@ $^ +bin/libopenmpt_example_c: ../libopenmpt/examples/libopenmpt_example_c.o $(OUTPUT_LIBOPENMPT) + $(INFO) [LD ] $@ + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_c.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ -ifeq ($(DYNLINK),1) -bin/openmpt123: $(OPENMPT123_OBJECTS) bin/libopenmpt.so +bin/libopenmpt_example_c_mem: ../libopenmpt/examples/libopenmpt_example_c_mem.o $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) -Lbin $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) -lopenmpt -o $@ -else -bin/openmpt123: $(OPENMPT123_OBJECTS) + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_c_mem.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ + +bin/libopenmpt_example_cxx: ../libopenmpt/examples/libopenmpt_example_cxx.o $(OUTPUT_LIBOPENMPT) $(INFO) [LD ] $@ - $(SILENT)$(LINK.cc) $(OPENMPT123_OBJECTS) $(LOADLIBES) $(LDLIBS) -o $@ -endif + $(SILENT)$(LINK.cc) $(LDFLAGS_LIBOPENMPT) ../libopenmpt/examples/libopenmpt_example_cxx.o $(LOADLIBES) $(LDLIBS) $(LDLIBS_LIBOPENMPT) -o $@ bin/modplug123: bin/openmpt123 cp $^ $@ Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-06-11 22:44:45 UTC (rev 2338) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2013-06-11 22:49:30 UTC (rev 2339) @@ -7,7 +7,9 @@ * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ +#ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING #define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING +#endif #if defined(_MSC_VER) #define MPT_WITH_PORTAUDIO This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-12 19:24:17
|
Revision: 2340 http://sourceforge.net/p/modplug/code/2340 Author: manxorist Date: 2013-06-12 19:24:08 +0000 (Wed, 12 Jun 2013) Log Message: ----------- [Ref] Do not pass around an endOfStream flag between AudioRead and AudioDone. The sound device has no need to know that (and none of the devices does even look at the flag at all). The only place where this is needed is the playback notification generation. We are reading most of the state from m_pSndFile there anyway, so we can just look at m_pSndFile->m_SongFlags[SONG_ENDREACHED] to determine endofStream state. [Ref] Make ISoundDevice::m_Source private and add appropriate wrappers. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-11 22:49:30 UTC (rev 2339) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-12 19:24:08 UTC (rev 2340) @@ -771,8 +771,8 @@ } -void CMainFrame::FillAudioBufferLocked(const ISoundDevice &, IFillAudioBuffer &callback) -//-------------------------------------------------------------------------------------- +void CMainFrame::FillAudioBufferLocked(IFillAudioBuffer &callback) +//---------------------------------------------------------------- { CriticalSection cs; ALWAYS_ASSERT(m_pSndFile != nullptr); @@ -780,22 +780,30 @@ } -ULONG CMainFrame::AudioRead(const ISoundDevice &, PVOID pvData, ULONG MaxSamples) -//------------------------------------------------------------------------------- +void CMainFrame::AudioRead(PVOID pvData, ULONG NumSamples) +//-------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::Audio); - return m_pSndFile->ReadInterleaved(pvData, MaxSamples); + m_pSndFile->ReadInterleaved(pvData, NumSamples); } -void CMainFrame::AudioDone(const ISoundDevice &device, ULONG SamplesWritten, ULONG SamplesLatency, bool endOfStream) -//------------------------------------------------------------------------------------------------------------------ +void CMainFrame::AudioDone(ULONG NumSamples, ULONG SamplesLatency) +//---------------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::Notify); - DoNotification(SamplesWritten, SamplesLatency, endOfStream, device.HasGetStreamPosition()); + DoNotification(NumSamples, SamplesLatency, false); } +void CMainFrame::AudioDone(ULONG NumSamples) +//------------------------------------------ +{ + OPENMPT_PROFILE_FUNCTION(Profiler::Notify); + DoNotification(NumSamples, 0, true); +} + + bool CMainFrame::audioTryOpeningDevice(UINT channels, UINT bits, UINT samplespersec) //---------------------------------------------------------------------------------- { @@ -949,8 +957,8 @@ } -BOOL CMainFrame::DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool endOfStream, bool hasSoundDeviceGetStreamPosition) -//-------------------------------------------------------------------------------------------------------------------------------- +BOOL CMainFrame::DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool hasSoundDeviceGetStreamPosition) +//-------------------------------------------------------------------------------------------------------------- { if(dwSamplesRead == 0) return FALSE; int64 notificationtimestamp = 0; @@ -984,7 +992,7 @@ Notification notification(notifyType, notifyItem, notificationtimestamp, m_pSndFile->m_nRow, m_pSndFile->m_nTickCount, m_pSndFile->m_nCurrentOrder, m_pSndFile->m_nPattern, m_pSndFile->m_nMixStat); - if(endOfStream) notification.type.set(Notification::EOS); + if(m_pSndFile->m_SongFlags[SONG_ENDREACHED]) notification.type.set(Notification::EOS); if(notifyType[Notification::Sample]) { Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-06-11 22:49:30 UTC (rev 2339) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-06-12 19:24:08 UTC (rev 2340) @@ -323,16 +323,17 @@ DWORD NotifyThread(); // from ISoundSource - void FillAudioBufferLocked(const ISoundDevice &device, IFillAudioBuffer &callback); - ULONG AudioRead(const ISoundDevice &device, PVOID pData, ULONG MaxSamples); - void AudioDone(const ISoundDevice &device, ULONG SamplesWritten, ULONG SamplesLatency, bool endOfStream); + void FillAudioBufferLocked(IFillAudioBuffer &callback); + void AudioRead(PVOID pData, ULONG NumSamples); + void AudioDone(ULONG NumSamples, ULONG SamplesLatency); + void AudioDone(ULONG NumSamples); bool audioTryOpeningDevice(UINT channels, UINT bits, UINT samplespersec); bool audioOpenDevice(); bool audioReopenDevice(); void audioCloseDevice(); bool IsAudioDeviceOpen() const; - BOOL DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool endOfStream, bool hasSoundDeviceGetStreamPosition); + BOOL DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool hasSoundDeviceGetStreamPosition); // Midi Input Functions public: Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-11 22:49:30 UTC (rev 2339) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-12 19:24:08 UTC (rev 2340) @@ -65,7 +65,36 @@ } +void ISoundDevice::SourceFillAudioBufferLocked() +//---------------------------------------------- +{ + if(m_Source) + { + m_Source->FillAudioBufferLocked(*this); + } +} + +void ISoundDevice::SourceAudioRead(PVOID pData, ULONG NumSamples) +//--------------------------------------------------------------- +{ + m_Source->AudioRead(pData, NumSamples); +} + + +void ISoundDevice::SourceAudioDone(ULONG NumSamples, ULONG SamplesLatency) +//------------------------------------------------------------------------ +{ + if(HasGetStreamPosition()) + { + m_Source->AudioDone(NumSamples); + } else + { + m_Source->AudioDone(NumSamples, SamplesLatency); + } +} + + void ISoundDevice::Start() //------------------------ { @@ -466,7 +495,7 @@ void CSoundDeviceWithThread::FillAudioBufferLocked() //-------------------------------------------------- { - m_Source->FillAudioBufferLocked(*this, *this); + SourceFillAudioBufferLocked(); } @@ -622,7 +651,6 @@ void CWaveDevice::FillAudioBuffer() //--------------------------------- { - ISoundSource *pSource = m_Source; ULONG nBytesWritten; ULONG nLatency; LONG oldBuffersPending; @@ -631,7 +659,6 @@ oldBuffersPending = InterlockedExchangeAdd(&m_nBuffersPending, 0); // read nLatency = oldBuffersPending * m_nWaveBufferSize; - bool eos = false; bool wasempty = false; if(oldBuffersPending == 0) wasempty = true; // When there were no pending buffers at all, pause the output, fill the buffers completely and then restart the output. @@ -640,11 +667,7 @@ while((ULONG)oldBuffersPending < m_nPreparedHeaders) { - ULONG len = m_BytesPerSample * pSource->AudioRead(*this, m_WaveBuffers[m_nWriteBuffer].lpData, m_nWaveBufferSize/m_BytesPerSample); - if(len < m_nWaveBufferSize) - { - eos = true; - } + SourceAudioRead(m_WaveBuffers[m_nWriteBuffer].lpData, m_nWaveBufferSize/m_BytesPerSample); nLatency += m_nWaveBufferSize; nBytesWritten += m_nWaveBufferSize; m_WaveBuffers[m_nWriteBuffer].dwBufferLength = m_nWaveBufferSize; @@ -653,7 +676,7 @@ waveOutWrite(m_hWaveOut, &m_WaveBuffers[m_nWriteBuffer], sizeof(WAVEHDR)); m_nWriteBuffer++; m_nWriteBuffer %= m_nPreparedHeaders; - pSource->AudioDone(*this, m_nWaveBufferSize/m_BytesPerSample, nLatency/m_BytesPerSample, eos); + SourceAudioDone(m_nWaveBufferSize/m_BytesPerSample, nLatency/m_BytesPerSample); } if(wasempty) waveOutRestart(m_hWaveOut); @@ -1002,25 +1025,17 @@ void CDSoundDevice::FillAudioBuffer() //----------------------------------- { - ISoundSource *pSource = m_Source; LPVOID lpBuf1=NULL, lpBuf2=NULL; DWORD dwSize1=0, dwSize2=0; DWORD dwBytes; - bool eos = false; if (!m_pMixBuffer) return; dwBytes = LockBuffer(m_nDSoundBufferSize, &lpBuf1, &dwSize1, &lpBuf2, &dwSize2); if (dwBytes) { - DWORD nRead1=0, nRead2=0; - - if ((lpBuf1) && (dwSize1)) nRead1 = m_BytesPerSample * pSource->AudioRead(*this, lpBuf1, dwSize1/m_BytesPerSample); - if ((lpBuf2) && (dwSize2)) nRead2 = m_BytesPerSample * pSource->AudioRead(*this, lpBuf2, dwSize2/m_BytesPerSample); + if ((lpBuf1) && (dwSize1)) SourceAudioRead(lpBuf1, dwSize1/m_BytesPerSample); + if ((lpBuf2) && (dwSize2)) SourceAudioRead(lpBuf2, dwSize2/m_BytesPerSample); UnlockBuffer(lpBuf1, dwSize1, lpBuf2, dwSize2); - if(nRead1+nRead2 < dwSize1+dwSize2) - { - eos = true; - } DWORD dwStatus = 0; m_pMixBuffer->GetStatus(&dwStatus); if(!m_bMixRunning || !(dwStatus & DSBSTATUS_PLAYING)) @@ -1046,7 +1061,7 @@ } m_bMixRunning = TRUE; } - pSource->AudioDone(*this, (dwSize1+dwSize2)/m_BytesPerSample, m_dwLatency/m_BytesPerSample, eos); + SourceAudioDone((dwSize1+dwSize2)/m_BytesPerSample, m_dwLatency/m_BytesPerSample); } } @@ -1504,7 +1519,6 @@ void CASIODevice::FillAudioBuffer() //--------------------------------- { - ISoundSource *pSource = m_Source; bool rendersilence = (InterlockedExchangeAdd(&m_RenderSilence, 0) == 1); DWORD dwSampleSize = m_nChannels*(m_nBitsPerSample>>3); @@ -1512,7 +1526,6 @@ DWORD dwFrameLen = (ASIO_BLOCK_LEN*sizeof(int)) / dwSampleSize; DWORD dwBufferOffset = 0; - bool eos = false; g_dwBuffer &= 1; //Log("FillAudioBuffer(%d): dwSampleSize=%d dwSamplesLeft=%d dwFrameLen=%d\n", g_dwBuffer, dwSampleSize, dwSamplesLeft, dwFrameLen); while ((LONG)dwSamplesLeft > 0) @@ -1523,11 +1536,7 @@ memset(m_FrameBuffer, 0, n*dwSampleSize); } else { - UINT readn = pSource->AudioRead(*this, m_FrameBuffer, n); - if(readn < n) - { - eos = true; - } + SourceAudioRead(m_FrameBuffer, n); } dwSamplesLeft -= n; for (UINT ich=0; ich<m_nChannels; ich++) @@ -1605,7 +1614,7 @@ if (m_bPostOutput) m_pAsioDrv->outputReady(); if(!rendersilence) { - pSource->AudioDone(*this, dwBufferOffset, m_nAsioBufferLen, eos); + SourceAudioDone(dwBufferOffset, m_nAsioBufferLen); } return; } @@ -1620,9 +1629,9 @@ if(rendersilence) { FillAudioBuffer(); - } else if(m_Source) + } else { - m_Source->FillAudioBufferLocked(*this, *this); + SourceFillAudioBufferLocked(); } } @@ -2114,15 +2123,9 @@ void CPortaudioDevice::FillAudioBuffer() //-------------------------------------- { - ISoundSource *pSource = m_Source; if(m_CurrentFrameCount == 0) return; - bool eos = false; - ULONG read = pSource->AudioRead(*this, m_CurrentFrameBuffer, m_CurrentFrameCount); - if(read < m_CurrentFrameCount) - { - eos = true; - } - pSource->AudioDone(*this, m_CurrentFrameCount, static_cast<ULONG>(m_CurrentRealLatencyMS * Pa_GetStreamInfo(m_Stream)->sampleRate / 1000.0f), eos); + SourceAudioRead(m_CurrentFrameBuffer, m_CurrentFrameCount); + SourceAudioDone(m_CurrentFrameCount, static_cast<ULONG>(m_CurrentRealLatencyMS * Pa_GetStreamInfo(m_Stream)->sampleRate / 1000.0f)); } @@ -2190,7 +2193,7 @@ m_CurrentRealLatencyMS = static_cast<float>( timeInfo->outputBufferDacTime - timeInfo->currentTime ) * 1000.0f; m_CurrentFrameBuffer = output; m_CurrentFrameCount = frameCount; - m_Source->FillAudioBufferLocked(*this, *this); + SourceFillAudioBufferLocked(); m_CurrentFrameCount = 0; m_CurrentFrameBuffer = 0; return paContinue; Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-06-11 22:49:30 UTC (rev 2339) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-06-12 19:24:08 UTC (rev 2340) @@ -39,10 +39,10 @@ //================ { public: - virtual void FillAudioBufferLocked(const ISoundDevice &device, IFillAudioBuffer &callback) = 0; // take any locks needed while rendering audio and then call FillAudioBuffer - virtual ULONG AudioRead(const ISoundDevice &device, PVOID pData, ULONG MaxSamples) = 0; // returns number of valid samples read, the remaining space has to be filled with zeroes by the callee, - // if return value != MaxSamples then end_of_stream = true - virtual void AudioDone(const ISoundDevice &device, ULONG SamplesWritten, ULONG SamplesLatency, bool end_of_stream) = 0; // all in samples + virtual void FillAudioBufferLocked(IFillAudioBuffer &callback) = 0; // take any locks needed while rendering audio and then call FillAudioBuffer + virtual void AudioRead(PVOID pData, ULONG NumSamples) = 0; + virtual void AudioDone(ULONG NumSamples, ULONG SamplesLatency) = 0; // all in samples + virtual void AudioDone(ULONG NumSamples) = 0; // all in samples }; @@ -89,9 +89,10 @@ class ISoundDevice : protected IFillAudioBuffer //============================================= { -protected: +private: ISoundSource *m_Source; +protected: ULONG m_LatencyMS; ULONG m_UpdateIntervalMS; ULONG m_fulCfgOptions; @@ -104,6 +105,9 @@ protected: virtual void FillAudioBuffer() = 0; + void SourceFillAudioBufferLocked(); + void SourceAudioRead(PVOID pData, ULONG NumSamples); + void SourceAudioDone(ULONG NumSamples, ULONG SamplesLatency); public: ISoundDevice(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-12 20:08:28
|
Revision: 2341 http://sourceforge.net/p/modplug/code/2341 Author: manxorist Date: 2013-06-12 20:08:21 +0000 (Wed, 12 Jun 2013) Log Message: ----------- [Ref] CSoundFile::Read has gotten somewhat unreadable over the years. Rewrite and reformat it completely to be hopefully more readable and maintainable. [Ref] Change CAGC::Process so that it works with seperate MixBuffer and RearMixBuffer so that all DSP effects can be processed in one go. [Ref] Move clearing the remaining unfilled output buffer to the only user that requires this behaviour: CMainFrame::AudioRead, because ISoundDevice requires to always get fully filled buffers. [Fix] Apply AGC volume changes to all channels at once instead of potentially decrementing volume in between processing different output channges. Also, limit ramp down speed to 1 step per sample (as it was for mono output). [Fix] Make the remaining global AGC state non-global. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/sounddsp/AGC.cpp trunk/OpenMPT/sounddsp/AGC.h trunk/OpenMPT/sounddsp/DSP.cpp trunk/OpenMPT/sounddsp/DSP.h trunk/OpenMPT/soundlib/MixerSettings.h trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/Sndmix.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-12 20:08:21 UTC (rev 2341) @@ -780,11 +780,26 @@ } -void CMainFrame::AudioRead(PVOID pvData, ULONG NumSamples) -//-------------------------------------------------------- +void CMainFrame::AudioRead(PVOID pvData, ULONG NumFrames) +//------------------------------------------------------- { OPENMPT_PROFILE_FUNCTION(Profiler::Audio); - m_pSndFile->ReadInterleaved(pvData, NumSamples); + CSoundFile::samplecount_t renderedFrames = m_pSndFile->ReadInterleaved(pvData, NumFrames); + ASSERT(renderedFrames <= NumFrames); + CSoundFile::samplecount_t remainingFrames = NumFrames - renderedFrames; + if(remainingFrames > 0) + { + // The sound device interface expects the whole buffer to be filled, always. + // Clear remaining buffer if not enough samples got rendered. + std::size_t frameSize = m_pSndFile->m_MixerSettings.gnChannels * (m_pSndFile->m_MixerSettings.GetBitsPerSample()/8); + if(m_pSndFile->m_MixerSettings.IsUnsignedSampleFormat()) + { + std::memset((char*)(pvData) + renderedFrames * frameSize, 0x80, remainingFrames * frameSize); + } else + { + std::memset((char*)(pvData) + renderedFrames * frameSize, 0, remainingFrames * frameSize); + } + } } @@ -931,10 +946,10 @@ int lmax = gnLVuMeter, rmax = gnRVuMeter; if (nChannels > 1) { - for (UINT i=0; i<nSamples; i+=nChannels) + for (UINT i=0; i<nSamples; i++) { - int vl = p[i]; - int vr = p[i+1]; + int vl = p[i*nChannels]; + int vr = p[i*nChannels+1]; if (vl < 0) vl = -vl; if (vr < 0) vr = -vr; if (vl > lmax) lmax = vl; @@ -944,7 +959,7 @@ { for (UINT i=0; i<nSamples; i++) { - int vl = p[i]; + int vl = p[i*nChannels]; if (vl < 0) vl = -vl; if (vl > lmax) lmax = vl; } Modified: trunk/OpenMPT/sounddsp/AGC.cpp =================================================================== --- trunk/OpenMPT/sounddsp/AGC.cpp 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/sounddsp/AGC.cpp 2013-06-12 20:08:21 UTC (rev 2341) @@ -27,49 +27,87 @@ #define MIXING_LIMITMIN (-MIXING_LIMITMAX) -static UINT AGC(int *pBuffer, UINT nSamples, UINT nAGC) -//----------------------------------------------------- +static UINT ProcessAGC(int *pBuffer, int *pRearBuffer, UINT nSamples, UINT nChannels, int nAGC) +//--------------------------------------------------------------------------------------------- { - while(nSamples--) + if(nChannels == 1) { - int val = (int)(((int64)*pBuffer * (int32)nAGC) >> AGC_PRECISION); - if(val < MIXING_LIMITMIN || val > MIXING_LIMITMAX) nAGC--; - *pBuffer = val; - pBuffer++; + while(nSamples--) + { + int val = (int)(((int64)*pBuffer * (int32)nAGC) >> AGC_PRECISION); + if(val < MIXING_LIMITMIN || val > MIXING_LIMITMAX) nAGC--; + *pBuffer = val; + pBuffer++; + } + } else + { + if(nChannels == 2) + { + while(nSamples--) + { + int fl = (int)(((int64)pBuffer[0] * (int32)nAGC) >> AGC_PRECISION); + int fr = (int)(((int64)pBuffer[1] * (int32)nAGC) >> AGC_PRECISION); + bool dec = false; + dec = dec || (fl < MIXING_LIMITMIN || fl > MIXING_LIMITMAX); + dec = dec || (fr < MIXING_LIMITMIN || fr > MIXING_LIMITMAX); + if(dec) nAGC--; + pBuffer[0] = fl; + pBuffer[1] = fr; + pBuffer += 2; + } + } else if(nChannels == 4) + { + while(nSamples--) + { + int fl = (int)(((int64)pBuffer[0] * (int32)nAGC) >> AGC_PRECISION); + int fr = (int)(((int64)pBuffer[1] * (int32)nAGC) >> AGC_PRECISION); + int rl = (int)(((int64)pRearBuffer[0] * (int32)nAGC) >> AGC_PRECISION); + int rr = (int)(((int64)pRearBuffer[1] * (int32)nAGC) >> AGC_PRECISION); + bool dec = false; + dec = dec || (fl < MIXING_LIMITMIN || fl > MIXING_LIMITMAX); + dec = dec || (fr < MIXING_LIMITMIN || fr > MIXING_LIMITMAX); + dec = dec || (rl < MIXING_LIMITMIN || rl > MIXING_LIMITMAX); + dec = dec || (rr < MIXING_LIMITMIN || rr > MIXING_LIMITMAX); + if(dec) nAGC--; + pBuffer[0] = fl; + pBuffer[1] = fr; + pRearBuffer[0] = rl; + pRearBuffer[1] = rr; + pBuffer += 2; + pRearBuffer += 2; + } + } } return nAGC; } -CAGC::CAGC() +CAGC::CAGC() //---------- { - m_nAGC = AGC_UNITY; + Initialize(TRUE, 44100); } -void CAGC::Process(int * MixSoundBuffer, int count, DWORD MixingFreq, UINT nChannels) -//----------------------------------------------------------------------------------- +void CAGC::Process(int *MixSoundBuffer, int *RearSoundBuffer, int count, UINT nChannels) +//-------------------------------------------------------------------------------------- { - static DWORD gAGCRecoverCount = 0; - UINT agc = AGC(MixSoundBuffer, count, m_nAGC); + UINT agc = ProcessAGC(MixSoundBuffer, RearSoundBuffer, count, nChannels, m_nAGC); // Some kind custom law, so that the AGC stays quite stable, but slowly // goes back up if the sound level stays below a level inversely proportional // to the AGC level. (J'me comprends) - if ((agc >= m_nAGC) && (m_nAGC < AGC_UNITY)) + if((agc >= m_nAGC) && (m_nAGC < AGC_UNITY)) { - gAGCRecoverCount += count; - UINT agctimeout = MixingFreq >> (AGC_PRECISION-8); - if (nChannels < 2) agctimeout >>= 1; - if (gAGCRecoverCount >= agctimeout) + m_nAGCRecoverCount += count; + if(m_nAGCRecoverCount >= m_Timeout) { - gAGCRecoverCount = 0; + m_nAGCRecoverCount = 0; m_nAGC++; } } else { m_nAGC = agc; - gAGCRecoverCount = 0; + m_nAGCRecoverCount = 0; } } @@ -82,10 +120,15 @@ } -void CAGC::Reset() -//---------------- +void CAGC::Initialize(BOOL bReset, DWORD MixingFreq) +//-------------------------------------------------- { - m_nAGC = AGC_UNITY; + if(bReset) + { + m_nAGC = AGC_UNITY; + m_nAGCRecoverCount = 0; + } + m_Timeout = (MixingFreq >> (AGC_PRECISION-8)) >> 1; } Modified: trunk/OpenMPT/sounddsp/AGC.h =================================================================== --- trunk/OpenMPT/sounddsp/AGC.h 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/sounddsp/AGC.h 2013-06-12 20:08:21 UTC (rev 2341) @@ -19,14 +19,14 @@ { private: UINT m_nAGC; + DWORD m_nAGCRecoverCount; + UINT m_Timeout; public: CAGC(); - ~CAGC() {} + void Initialize(BOOL bReset, DWORD MixingFreq); public: - void Process(int * MixSoundBuffer, int count, DWORD MixingFreq, UINT nChannels); + void Process(int *MixSoundBuffer, int *RearSoundBuffer, int count, UINT nChannels); void Adjust(UINT oldVol, UINT newVol); - void Reset(); -private: }; #endif // NO_AGC Modified: trunk/OpenMPT/sounddsp/DSP.cpp =================================================================== --- trunk/OpenMPT/sounddsp/DSP.cpp 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/sounddsp/DSP.cpp 2013-06-12 20:08:21 UTC (rev 2341) @@ -281,7 +281,7 @@ } -void CDSP::Process(int * MixSoundBuffer, int * MixRearBuffer, int count, DWORD DSPMask, UINT nChannels) +void CDSP::Process(int * MixSoundBuffer, int * MixRearBuffer, int count, UINT nChannels, DWORD DSPMask) //----------------------------------------------------------------------------------------------------- { @@ -296,14 +296,10 @@ if (nChannels > 2) ProcessQuadSurround(MixSoundBuffer, MixRearBuffer, count); else ProcessStereoSurround(MixSoundBuffer, count); } - // DC Removal + // Bass Expansion if (DSPMask & SNDDSP_MEGABASS) { X86_StereoDCRemoval(MixSoundBuffer, count, &nDCRFlt_Y1l, &nDCRFlt_X1l, &nDCRFlt_Y1r, &nDCRFlt_X1r); - } - // Bass Expansion - if (DSPMask & SNDDSP_MEGABASS) - { int *px = MixSoundBuffer; int x1 = nXBassFlt_X1; int y1 = nXBassFlt_Y1; @@ -344,15 +340,11 @@ } else { - - // DC Removal + + // Bass Expansion if (DSPMask & SNDDSP_MEGABASS) { X86_MonoDCRemoval(MixSoundBuffer, count, &nDCRFlt_Y1l, &nDCRFlt_X1l); - } - // Bass Expansion - if (DSPMask & SNDDSP_MEGABASS) - { int *px = MixSoundBuffer; int x1 = nXBassFlt_X1; int y1 = nXBassFlt_Y1; Modified: trunk/OpenMPT/sounddsp/DSP.h =================================================================== --- trunk/OpenMPT/sounddsp/DSP.h 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/sounddsp/DSP.h 2013-06-12 20:08:21 UTC (rev 2341) @@ -77,7 +77,6 @@ public: CDSP(); - ~CDSP() {} public: void SetSettings(const CDSPSettings &settings) { m_Settings = settings; } // [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] @@ -85,7 +84,7 @@ // [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] BOOL SetSurroundParameters(UINT nDepth, UINT nDelay); void Initialize(BOOL bReset, DWORD MixingFreq, DWORD DSPMask); - void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, DWORD DSPMask, UINT nChannels); + void Process(int * MixSoundBuffer, int * MixRearBuffer, int count, UINT nChannels, DWORD DSPMask); private: void ProcessStereoSurround(int * MixSoundBuffer, int count); void ProcessQuadSurround(int * MixSoundBuffer, int * MixRearBuffer, int count); Modified: trunk/OpenMPT/soundlib/MixerSettings.h =================================================================== --- trunk/OpenMPT/soundlib/MixerSettings.h 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/soundlib/MixerSettings.h 2013-06-12 20:08:21 UTC (rev 2341) @@ -45,14 +45,31 @@ DWORD m_FinalOutputGain; // factor multiplied to the final mixer output just before clipping and dithering, fixed point 16.16 #endif + bool IsValid() const + { + return true + && (gnChannels == 1 || gnChannels == 2 || gnChannels == 4) + && (m_SampleFormat != SampleFormatInvalid) + && (gdwMixingFreq > 0) + && (GetBitsPerSample() % 8 == 0) + && (GetBitsPerSample() > 0) + ; + } bool IsUnsignedSampleFormat() const { + if(m_SampleFormat == SampleFormatInvalid) return false; return m_SampleFormat == SampleFormatUnsigned8; } bool IsFloatSampleFormat() const { + if(m_SampleFormat == SampleFormatInvalid) return false; return m_SampleFormat == SampleFormatFloat32; } + bool IsIntSampleFormat() const + { + if(m_SampleFormat == SampleFormatInvalid) return false; + return m_SampleFormat != SampleFormatFloat32; + } uint8 GetBitsPerSample() const { switch(m_SampleFormat) @@ -72,7 +89,9 @@ case SampleFormatFloat32: return 32; break; - default: return 8; break; + default: + return 0; + break; } } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-06-12 20:08:21 UTC (rev 2341) @@ -640,12 +640,15 @@ samplecount_t ReadInterleaved(void *outputBuffer, samplecount_t count); samplecount_t ReadNonInterleaved(void * const *outputBuffers, samplecount_t count); private: - UINT Read(UINT cbBuffer, LPVOID lpBuffer, void * const *outputBuffers = nullptr); + samplecount_t Read(samplecount_t count, void *outputBuffer, void * const *outputBuffers); void CreateStereoMix(int count); public: BOOL FadeSong(UINT msec); BOOL GlobalFadeSong(UINT msec); +private: + void ProcessDSP(std::size_t countChunk); void ProcessPlugins(UINT nCount); +public: samplecount_t GetTotalSampleCount() const { return m_lTotalSampleCount; } bool HasPositionChanged() { bool b = m_bPositionChanged; m_bPositionChanged = false; return b; } bool IsRenderingToDisc() const { return m_bIsRendering; } @@ -830,13 +833,15 @@ #ifdef MODPLUG_TRACKER void ProcessMidiOut(CHANNELINDEX nChn); #endif // MODPLUG_TRACKER - void ApplyGlobalVolume(int *SoundBuffer, int *RearBuffer, long lCount); + void ApplyGlobalVolume(int *SoundBuffer, int *RearBuffer, long countChunk); #ifndef MODPLUG_TRACKER - void ApplyFinalOutputGain(int SoundBuffer[], int RearBuffer[], long lCount); // lCount meaning the number of frames, totally independet from the numer of channels - void ApplyFinalOutputGainFloat(float *beg, float *end); -#endif + void ApplyFinalOutputGain(int *soundBuffer, std::size_t countChunk); + void ApplyFinalOutputGainFloat(float *outputBuffer, float * const *outputBuffers, std::size_t offset, std::size_t channels, std::size_t countChunk); +#endif // !MODPLUG_TRACKER + void ConvertMixBufferToOutput(void *outputBuffer, void * const *outputBuffers, std::size_t countRendered, std::size_t countChunk); + // System-Dependant functions public: static void *AllocateSample(UINT nbytes); Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-12 19:24:08 UTC (rev 2340) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-06-12 20:08:21 UTC (rev 2341) @@ -33,33 +33,12 @@ PMIXPLUGINCREATEPROC CSoundFile::gpMixPluginCreateProc = NULL; #endif -typedef void (* LPCONVERTPROC)(LPVOID, int *, DWORD); -static void Convert32To8( LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((uint8*)lpBuffer, pBuffer, nSamples); } -static void Convert32To16(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int16*)lpBuffer, pBuffer, nSamples); } -static void Convert32To24(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int24*)lpBuffer, pBuffer, nSamples); } -static void Convert32To32(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((int32*)lpBuffer, pBuffer, nSamples); } -static void Convert32ToFloat32(LPVOID lpBuffer, int *pBuffer, DWORD nSamples) { return Convert32ToInterleaved((float*)lpBuffer, pBuffer, nSamples); } +void InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames); +void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); +void MonoFromStereo(int *pMixBuf, UINT nSamples); -template<typename Tsample> -void Convert32ToNonInterleaved(void * const *outputBuffers, std::size_t offset, const int *mixbuffer, std::size_t channels, std::size_t count) -{ - Tsample *buffers[4]; - MemsetZero(buffers); - for(std::size_t channel = 0; channel < channels; ++channel) - { - buffers[channel] = reinterpret_cast<Tsample*>(outputBuffers[channel]); - buffers[channel] += offset; // skip to output position - } - Convert32ToNonInterleaved(buffers, mixbuffer, channels, count); -} - - -extern void InterleaveFrontRear(int *pFrontBuf, int *pRearBuf, DWORD nFrames); -extern void StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); -extern void MonoFromStereo(int *pMixBuf, UINT nSamples); - // Log tables for pre-amp // Pre-amp (or more precisely: Pre-attenuation) depends on the number of channels, // Which this table takes care of. @@ -144,7 +123,7 @@ m_EQ.Initialize(bReset, m_MixerSettings.gdwMixingFreq); #endif #ifndef NO_AGC - if(bReset) m_AGC.Reset(); + m_AGC.Initialize(bReset, m_MixerSettings.gdwMixingFreq); #endif m_Dither.Reset(); } @@ -171,7 +150,6 @@ pramp->nRampLength = nRampLength; pramp->dwFlags.set(CHN_VOLUMERAMP); } - m_SongFlags.set(SONG_FADINGSONG); return TRUE; } @@ -201,239 +179,246 @@ } -UINT CSoundFile::Read(UINT count, LPVOID lpDestBuffer, void * const *outputBuffers) -//--------------------------------------------------------------------------------- +CSoundFile::samplecount_t CSoundFile::Read(samplecount_t count, void *outputBuffer, void * const *outputBuffers) +//-------------------------------------------------------------------------------------------------------------- { - LPBYTE lpBuffer = (LPBYTE)lpDestBuffer; - LPCONVERTPROC pCvt = nullptr; - samplecount_t lMax, lCount, lSampleCount; - size_t lSampleSize; - UINT nMaxPlugins; - std::size_t renderedCount = 0; + ALWAYS_ASSERT(m_MixerSettings.IsValid()); - nMaxPlugins = MAX_MIXPLUGINS; - while ((nMaxPlugins > 0) && (!m_MixPlugins[nMaxPlugins-1].pMixPlugin)) nMaxPlugins--; - - UINT nMixStatCount = 0; + int mixStatCount = 0; - lSampleSize = m_MixerSettings.gnChannels; - switch(m_MixerSettings.m_SampleFormat) + bool mixPlugins = false; + for(PLUGINDEX i = 0; i < MAX_MIXPLUGINS; ++i) { - case SampleFormatUnsigned8: pCvt = Convert32To8 ; break; - case SampleFormatInt16: pCvt = Convert32To16; break; - case SampleFormatInt24: pCvt = Convert32To24; break; - case SampleFormatInt32: pCvt = Convert32To32; break; - case SampleFormatFloat32: pCvt = Convert32ToFloat32; break; - default: return 0; break; + if(m_MixPlugins[i].pMixPlugin) + { + mixPlugins = true; + break; + } } - lSampleSize *= m_MixerSettings.GetBitsPerSample()/8; - lMax = count; - if((!lMax) || ((!lpBuffer) && (!outputBuffers)) || (!m_nChannels)) return 0; - samplecount_t lRead = lMax; - if(m_SongFlags[SONG_ENDREACHED]) - goto MixDone; + const samplecount_t countGoal = count; + samplecount_t countRendered = 0; + samplecount_t countToRender = countGoal; - while (lRead > 0) + while(!m_SongFlags[SONG_ENDREACHED] && countToRender > 0) { + // Update Channel Data - if (!m_nBufferCount) - { + if(!m_nBufferCount) + { // last tick or fade completely processed, find out what to do next if(m_SongFlags[SONG_FADINGSONG]) - { + { // song was faded out m_SongFlags.set(SONG_ENDREACHED); - m_nBufferCount = lRead; + } else if(ReadNote()) + { // render next tick (normal progress) + ASSERT(m_nBufferCount > 0); + #ifdef MODPLUG_TRACKER + // Save pattern cue points for WAV rendering here (if we reached a new pattern, that is.) + if(IsRenderingToDisc() && (m_PatternCuePoints.empty() || m_nCurrentOrder != m_PatternCuePoints.back().order)) + { + PatternCuePoint cue; + cue.offset = countRendered; + cue.order = m_nCurrentOrder; + cue.processed = false; // We don't know the base offset in the file here. It has to be added in the main conversion loop. + m_PatternCuePoints.push_back(cue); + } + #endif } else - - if (ReadNote()) - { -#ifdef MODPLUG_TRACKER - // Save pattern cue points for WAV rendering here (if we reached a new pattern, that is.) - if(IsRenderingToDisc() && (m_PatternCuePoints.empty() || m_nCurrentOrder != m_PatternCuePoints.back().order)) - { - PatternCuePoint cue; - cue.offset = lMax - lRead; - cue.order = m_nCurrentOrder; - cue.processed = false; // We don't know the base offset in the file here. It has to be added in the main conversion loop. - m_PatternCuePoints.push_back(cue); - } -#endif - } else - { -#ifdef MODPLUG_TRACKER - if ((m_nMaxOrderPosition) && (m_nCurrentOrder >= m_nMaxOrderPosition)) - { + { // no new pattern data + #ifdef MODPLUG_TRACKER + if((m_nMaxOrderPosition) && (m_nCurrentOrder >= m_nMaxOrderPosition)) + { + m_SongFlags.set(SONG_ENDREACHED); + } + #endif // MODPLUG_TRACKER + if(IsRenderingToDisc()) + { // rewbs: disable song fade when rendering. m_SongFlags.set(SONG_ENDREACHED); - break; + } else + { // end of song reached, fade it out + if(FadeSong(FADESONGDELAY)) // sets m_nBufferCount xor returns false + { // FadeSong sets m_nBufferCount here + ASSERT(m_nBufferCount > 0); + m_SongFlags.set(SONG_FADINGSONG); + } else + { + m_SongFlags.set(SONG_ENDREACHED); + } } -#endif // MODPLUG_TRACKER + } - if (!FadeSong(FADESONGDELAY) || IsRenderingToDisc()) //rewbs: disable song fade when rendering. - { - m_SongFlags.set(SONG_ENDREACHED); - if (lRead == lMax || IsRenderingToDisc()) //rewbs: don't complete buffer when rendering - goto MixDone; - m_nBufferCount = lRead; - } - } } - lCount = m_nBufferCount; - if (lCount > MIXBUFFERSIZE) lCount = MIXBUFFERSIZE; - if (lCount > lRead) lCount = lRead; - if (!lCount) - break; + if(m_SongFlags[SONG_ENDREACHED]) + { + break; // mix done + } - ASSERT(lCount <= MIXBUFFERSIZE); // ensure MIXBUFFERSIZE really is our max buffer size + ASSERT(m_nBufferCount > 0); // assert that we have actually something to do - lSampleCount = lCount; + const samplecount_t countChunk = std::min<samplecount_t>(MIXBUFFERSIZE, std::min<samplecount_t>(m_nBufferCount, countToRender)); - if(nMixStatCount == 0) - { - // reset mixer channel count before we are calling CreateStereoMix the first time this round, if we are not updating the mixer state, we do not reset statistics + if(mixStatCount == 0) + { // reset mixer channel count before we are calling CreateStereoMix the first time this round, if we are not updating the mixer state, we do not reset statistics m_nMixStat = 0; } - nMixStatCount++; - - if (m_MixerSettings.gnChannels >= 2) - { - lSampleCount *= 2; - CreateStereoMix(lCount); + mixStatCount++; -#ifndef NO_REVERB - m_Reverb.Process(MixSoundBuffer, lCount); -#endif // NO_REVERB + CreateStereoMix(countChunk); - if (nMaxPlugins) ProcessPlugins(lCount); + #ifndef NO_REVERB + m_Reverb.Process(MixSoundBuffer, countChunk); + #endif // NO_REVERB - // Apply global volume - if (m_PlayConfig.getGlobalVolumeAppliesToMaster()) - { - ApplyGlobalVolume(MixSoundBuffer, MixRearBuffer, lCount); - } - } else + if(mixPlugins) { - CreateStereoMix(lCount); + ProcessPlugins(countChunk); + } -#ifndef NO_REVERB - m_Reverb.Process(MixSoundBuffer, lCount); -#endif // NO_REVERB + if(m_MixerSettings.gnChannels == 1) + { + MonoFromStereo(MixSoundBuffer, countChunk); + } - if (nMaxPlugins) ProcessPlugins(lCount); - MonoFromStereo(MixSoundBuffer, lCount); - - // Apply global volume - if (m_PlayConfig.getGlobalVolumeAppliesToMaster()) - { - ApplyGlobalVolume(MixSoundBuffer, MixRearBuffer, lCount); - } + if(m_PlayConfig.getGlobalVolumeAppliesToMaster()) + { + ApplyGlobalVolume(MixSoundBuffer, MixRearBuffer, countChunk); } -#ifndef NO_DSP - m_DSP.Process(MixSoundBuffer, MixRearBuffer, lCount, m_MixerSettings.DSPMask, m_MixerSettings.gnChannels); -#endif - -#ifndef NO_EQ - // Graphic Equalizer - if (m_MixerSettings.DSPMask & SNDDSP_EQ) + if(m_MixerSettings.DSPMask) { - m_EQ.Process(MixSoundBuffer, MixRearBuffer, lCount, m_MixerSettings.gnChannels); + ProcessDSP(countChunk); } -#endif // NO_EQ -#ifndef MODPLUG_TRACKER - if(!m_MixerSettings.IsFloatSampleFormat()) + if(m_MixerSettings.gnChannels == 4) { - // Apply final output gain for non floating point output - ApplyFinalOutputGain(MixSoundBuffer, MixRearBuffer, lCount); + InterleaveFrontRear(MixSoundBuffer, MixRearBuffer, countChunk); } -#endif -#ifndef NO_AGC - // Automatic Gain Control - if (m_MixerSettings.DSPMask & SNDDSP_AGC) m_AGC.Process(MixSoundBuffer, lSampleCount, m_MixerSettings.gdwMixingFreq, m_MixerSettings.gnChannels); -#endif // NO_AGC + #ifdef MODPLUG_TRACKER + if(gpSndMixHook) + { // Currently only used for VU Meter + gpSndMixHook(MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + } + #endif // MODPLUG_TRACKER - UINT lTotalSampleCount = lSampleCount; // Including rear channels + // Convert to output sample format and optionally perform dithering and clipping if needed + ConvertMixBufferToOutput(outputBuffer, outputBuffers, countRendered, countChunk); - // Multichannel - if (m_MixerSettings.gnChannels > 2) + // Buffer ready + countRendered += countChunk; + countToRender -= countChunk; + m_nBufferCount -= countChunk; + m_lTotalSampleCount += countChunk; // increase sample count for VSTTimeInfo. + + } + + // mix done + + if(mixStatCount > 0) + { + m_nMixStat = (m_nMixStat + mixStatCount - 1) / mixStatCount; // round up + } + + return countRendered; + +} + + +void CSoundFile::ProcessDSP(std::size_t countChunk) +//------------------------------------------------- +{ + #ifndef NO_DSP + if(m_MixerSettings.DSPMask & (SNDDSP_SURROUND|SNDDSP_MEGABASS|SNDDSP_NOISEREDUCTION)) { - InterleaveFrontRear(MixSoundBuffer, MixRearBuffer, lCount); - lTotalSampleCount *= 2; + m_DSP.Process(MixSoundBuffer, MixRearBuffer, countChunk, m_MixerSettings.gnChannels, m_MixerSettings.DSPMask); } + #endif // NO_DSP - // Noise Shaping - if(m_Resampler.IsHQ()) - m_Dither.Process(MixSoundBuffer, lCount, m_MixerSettings.gnChannels, m_MixerSettings.GetBitsPerSample()); - -#ifdef MODPLUG_TRACKER - // Hook Function - if (gpSndMixHook) + #ifndef NO_EQ + if(m_MixerSettings.DSPMask & SNDDSP_EQ) { - //Currently only used for VU Meter, so it's OK to do it after global Vol. - gpSndMixHook(MixSoundBuffer, lTotalSampleCount, m_MixerSettings.gnChannels); + m_EQ.Process(MixSoundBuffer, MixRearBuffer, countChunk, m_MixerSettings.gnChannels); } -#endif + #endif // NO_EQ - if(lpBuffer) // old style interleaved output buffer + #ifndef NO_AGC + if(m_MixerSettings.DSPMask & SNDDSP_AGC) { - #ifndef MODPLUG_TRACKER - LPBYTE buf_beg = lpBuffer; - #endif + m_AGC.Process(MixSoundBuffer, MixRearBuffer, countChunk, m_MixerSettings.gnChannels); + } + #endif // NO_AGC +} - // Convert to output sample format and optionally perform clipping if needed - pCvt(lpBuffer, MixSoundBuffer, lTotalSampleCount); - lpBuffer += lTotalSampleCount * (m_MixerSettings.GetBitsPerSample()/8); - #ifndef MODPLUG_TRACKER - LPBYTE buf_end = lpBuffer; - // Apply final output gain for floating point output after conversion so we do not suffer underflow or clipping - if(m_MixerSettings.IsFloatSampleFormat()) - { - ApplyFinalOutputGainFloat(reinterpret_cast<float*>(buf_beg), reinterpret_cast<float*>(buf_end)); - } - #endif +template<typename Tsample> +void ConvertToOutput(void *outputBuffer, void * const *outputBuffers, std::size_t countRendered, int *mixbuffer, std::size_t countChunk, std::size_t channels) +//------------------------------------------------------------------------------------------------------------------------------------------------------------ +{ + if(outputBuffer) + { + Convert32ToInterleaved(reinterpret_cast<Tsample*>(outputBuffer) + (channels * countRendered), mixbuffer, channels * countChunk); + } + if(outputBuffers) + { + Tsample *buffers[4] = { nullptr, nullptr, nullptr, nullptr }; + for(std::size_t channel = 0; channel < channels; ++channel) + { + buffers[channel] = reinterpret_cast<Tsample*>(outputBuffers[channel]) + countRendered; } + Convert32ToNonInterleaved(buffers, mixbuffer, channels, countChunk); + } +} - if(outputBuffers) // non-interleaved one output buffer per channel + +void CSoundFile::ConvertMixBufferToOutput(void *outputBuffer, void * const *outputBuffers, std::size_t countRendered, std::size_t countChunk) +//------------------------------------------------------------------------------------------------------------------------------------------- +{ + // Convert to output sample format and optionally perform dithering and clipping if needed + + #ifndef MODPLUG_TRACKER + if(m_MixerSettings.IsIntSampleFormat()) { - switch(m_MixerSettings.m_SampleFormat) - { - case SampleFormatUnsigned8: Convert32ToNonInterleaved<uint8>(outputBuffers, renderedCount, MixSoundBuffer, m_MixerSettings.gnChannels, lCount); break; - case SampleFormatInt16: Convert32ToNonInterleaved<int16>(outputBuffers, renderedCount, MixSoundBuffer, m_MixerSettings.gnChannels, lCount); break; - case SampleFormatInt24: Convert32ToNonInterleaved<int24>(outputBuffers, renderedCount, MixSoundBuffer, m_MixerSettings.gnChannels, lCount); break; - case SampleFormatInt32: Convert32ToNonInterleaved<int32>(outputBuffers, renderedCount, MixSoundBuffer, m_MixerSettings.gnChannels, lCount); break; - case SampleFormatFloat32: Convert32ToNonInterleaved<float>(outputBuffers, renderedCount, MixSoundBuffer, m_MixerSettings.gnChannels, lCount); break; - default: - break; - } - #ifndef MODPLUG_TRACKER - if(m_MixerSettings.IsFloatSampleFormat()) - { - // Apply final output gain for floating point output after conversion so we do not suffer underflow or clipping - for(std::size_t channel = 0; channel < m_MixerSettings.gnChannels; ++channel) - { - ApplyFinalOutputGainFloat(reinterpret_cast<float*>(outputBuffers[channel]) + renderedCount, reinterpret_cast<float*>(outputBuffers[channel]) + renderedCount + lCount); - } - } - #endif // !MODPLUG_TRACKER + // Apply final output gain for non floating point output + ApplyFinalOutputGain(MixSoundBuffer, countChunk); } + #endif // !MODPLUG_TRACKER - // Buffer ready - renderedCount += lCount; - lRead -= lCount; - m_nBufferCount -= lCount; - m_lTotalSampleCount += lCount; // increase sample count for VSTTimeInfo. + if(m_MixerSettings.IsIntSampleFormat()) + { + m_Dither.Process(MixSoundBuffer, countChunk, m_MixerSettings.gnChannels, m_MixerSettings.GetBitsPerSample()); } -MixDone: - if (lRead && lpBuffer) memset(lpBuffer, (m_MixerSettings.m_SampleFormat == SampleFormatUnsigned8) ? 0x80 : 0, lRead * lSampleSize); // clear remaining interleaved output buffer - if(nMixStatCount > 0) + + switch(m_MixerSettings.m_SampleFormat) { - m_nMixStat = (m_nMixStat + nMixStatCount - 1) / nMixStatCount; // round up + case SampleFormatUnsigned8: + ConvertToOutput<uint8>(outputBuffer, outputBuffers, countRendered, MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + break; + case SampleFormatInt16: + ConvertToOutput<int16>(outputBuffer, outputBuffers, countRendered, MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + break; + case SampleFormatInt24: + ConvertToOutput<int24>(outputBuffer, outputBuffers, countRendered, MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + break; + case SampleFormatInt32: + ConvertToOutput<int32>(outputBuffer, outputBuffers, countRendered, MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + break; + case SampleFormatFloat32: + ConvertToOutput<float>(outputBuffer, outputBuffers, countRendered, MixSoundBuffer, countChunk, m_MixerSettings.gnChannels); + break; + case SampleFormatInvalid: + break; } - return renderedCount; + + #ifndef MODPLUG_TRACKER + if(m_MixerSettings.IsFloatSampleFormat()) + { + // Apply final output gain for floating point output after conversion so we do not suffer underflow or clipping + ApplyFinalOutputGainFloat(reinterpret_cast<float*>(outputBuffer), reinterpret_cast<float*const*>(outputBuffers), countRendered, m_MixerSettings.gnChannels, countChunk); + } + #endif // !MODPLUG_TRACKER + } @@ -1700,7 +1685,8 @@ //////////////////////////////////////////////////////////////////////////////////// if (!m_nMusicTempo) return FALSE; - m_nSamplesPerTick = m_nBufferCount = GetTickDuration(m_nMusicTempo, m_nMusicSpeed, m_nCurrentRowsPerBeat); + m_nSamplesPerTick = GetTickDuration(m_nMusicTempo, m_nMusicSpeed, m_nCurrentRowsPerBeat); + m_nBufferCount = m_nSamplesPerTick; // Master Volume + Pre-Amplification / Attenuation setup DWORD nMasterVol; @@ -2362,7 +2348,10 @@ #ifndef MODPLUG_TRACKER -void CSoundFile::ApplyFinalOutputGain(int SoundBuffer[], int RearBuffer[], long lCount) { + +void CSoundFile::ApplyFinalOutputGain(int *soundBuffer, std::size_t countChunk) +//----------------------------------------------------------------------------- +{ if(m_MixerSettings.m_FinalOutputGain == (1<<16)) { // nothing to do, gain == +/- 0dB @@ -2370,45 +2359,51 @@ } // no clipping prevention is done here int32 factor = m_MixerSettings.m_FinalOutputGain; - int * buf = SoundBuffer; - int * rbuf = RearBuffer; - if(m_MixerSettings.gnChannels == 1) + int * buf = soundBuffer; + for(std::size_t i=0; i<countChunk*m_MixerSettings.gnChannels; ++i) { - for(int i=0; i<lCount; ++i) - { - *buf = Util::muldiv(*buf, factor, 1<<16); - buf++; - } - } else if(m_MixerSettings.gnChannels == 2) + *buf = Util::muldiv(*buf, factor, 1<<16); + buf++; + } +} + +static void ApplyFinalOutputGainFloatBuffer(float *beg, float *end, float factor) +//------------------------------------------------------------------------------- +{ + // no clipping is done here + for(float *i = beg; i != end; ++i) { - for(int i=0; i<lCount*2; ++i) - { - *buf = Util::muldiv(*buf, factor, 1<<16); - buf++; - } - } else if(m_MixerSettings.gnChannels == 4) - { - for(int i=0; i<lCount*2; ++i) - { - *buf = Util::muldiv(*buf, factor, 1<<16); - *rbuf = Util::muldiv(*rbuf, factor, 1<<16); - buf++; - rbuf++; - } + *i *= factor; } } -void CSoundFile::ApplyFinalOutputGainFloat(float *beg, float *end) { + +void CSoundFile::ApplyFinalOutputGainFloat(float * outputBuffer, float * const *outputBuffers, std::size_t offset, std::size_t channels, std::size_t countChunk) +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- +{ if(m_MixerSettings.m_FinalOutputGain == (1<<16)) { // nothing to do, gain == +/- 0dB - return; + return; } - // no clipping prevention is done here - float factor = static_cast<float>(m_MixerSettings.m_FinalOutputGain) * (1.0f / static_cast<float>(1<<16)); - for(float *i = beg; i != end; ++i) + const float factor = static_cast<float>(m_MixerSettings.m_FinalOutputGain) * (1.0f / static_cast<float>(1<<16)); + if(outputBuffer) { - *i *= factor; + ApplyFinalOutputGainFloatBuffer( + outputBuffer + (channels * offset), + outputBuffer + (channels * (offset + countChunk)), + factor); } + if(outputBuffers) + { + for(std::size_t channel = 0; channel < channels; ++channel) + { + ApplyFinalOutputGainFloatBuffer( + outputBuffers[channel] + offset, + outputBuffers[channel] + offset + countChunk, + factor); + } + } } -#endif +#endif // !MODPLUG_TRACKER + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-12 21:29:10
|
Revision: 2347 http://sourceforge.net/p/modplug/code/2347 Author: manxorist Date: 2013-06-12 21:29:03 +0000 (Wed, 12 Jun 2013) Log Message: ----------- [Fix] Avoid tiny int->float->int roundtrip rounding errors by converting with power-of-2 factors instead of power-of-2 minus 1. Modified Paths: -------------- trunk/OpenMPT/sounddsp/EQ.cpp trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp Modified: trunk/OpenMPT/sounddsp/EQ.cpp =================================================================== --- trunk/OpenMPT/sounddsp/EQ.cpp 2013-06-12 20:43:11 UTC (rev 2346) +++ trunk/OpenMPT/sounddsp/EQ.cpp 2013-06-12 21:29:03 UTC (rev 2347) @@ -316,12 +316,12 @@ void CEQ::ProcessMono(int *pbuffer, float *MixFloatBuffer, UINT nCount) //--------------------------------------------------------------------- { - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, 1.0f/static_cast<float>(MIXING_CLIPMAX)); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount, 1.0f/MIXING_SCALEF); for (UINT b=0; b<MAX_EQ_BANDS; b++) { if ((gEQ[b].bEnable) && (gEQ[b].Gain != 1.0f)) EQFilter(&gEQ[b], MixFloatBuffer, nCount); } - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, static_cast<float>(MIXING_CLIPMAX)); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount, MIXING_SCALEF); } @@ -334,7 +334,7 @@ if(GetProcSupport() & PROCSUPPORT_SSE) { int sse_state, sse_eqstate; - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/static_cast<float>(MIXING_CLIPMAX)); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/MIXING_SCALEF); _asm stmxcsr sse_state; sse_eqstate = sse_state | 0xFF80; // set flush-to-zero, denormals-are-zero, round-to-zero, mask all exception, leave flags alone @@ -346,7 +346,7 @@ } _asm ldmxcsr sse_state; - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, static_cast<float>(MIXING_CLIPMAX)); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, MIXING_SCALEF); } else @@ -356,7 +356,7 @@ if(GetProcSupport() & PROCSUPPORT_AMD_3DNOW) { - MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/static_cast<float>(MIXING_CLIPMAX)); + MonoMixToFloat(pbuffer, MixFloatBuffer, nCount*2, 1.0f/MIXING_SCALEF); for (UINT b=0; b<MAX_EQ_BANDS; b++) { @@ -365,14 +365,14 @@ AMD_StereoEQ(&gEQ[b], &gEQ[b+MAX_EQ_BANDS], MixFloatBuffer, nCount); } - FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, static_cast<float>(MIXING_CLIPMAX)); + FloatToMonoMix(MixFloatBuffer, pbuffer, nCount*2, MIXING_SCALEF); } else #endif // ENABLE_X86_AMD { - StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, 1.0f/static_cast<float>(MIXING_CLIPMAX)); + StereoMixToFloat(pbuffer, MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, nCount, 1.0f/MIXING_SCALEF); for (UINT bl=0; bl<MAX_EQ_BANDS; bl++) { @@ -383,7 +383,7 @@ if ((gEQ[br].bEnable) && (gEQ[br].Gain != 1.0f)) EQFilter(&gEQ[br], MixFloatBuffer+MIXBUFFERSIZE, nCount); } - FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, static_cast<float>(MIXING_CLIPMAX)); + FloatToStereoMix(MixFloatBuffer, MixFloatBuffer+MIXBUFFERSIZE, pbuffer, nCount, MIXING_SCALEF); } } Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-12 20:43:11 UTC (rev 2346) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-12 21:29:03 UTC (rev 2347) @@ -1997,7 +1997,7 @@ void Convert32ToInterleaved(float *dest, const int *mixbuffer, std::size_t count) //------------------------------------------------------------------------------- { - const float factor = (1.0f/(float)MIXING_CLIPMAX); + const float factor = (1.0f/MIXING_SCALEF); for(std::size_t i=0; i<count; i++) { dest[i] = mixbuffer[i] * factor; @@ -2007,7 +2007,7 @@ void Convert32ToNonInterleaved(float * const * const buffers, const int *mixbuffer, std::size_t channels, std::size_t count) //-------------------------------------------------------------------------------------------------------------------------- { - const float factor = (1.0f/(float)MIXING_CLIPMAX); + const float factor = (1.0f/MIXING_SCALEF); for(std::size_t i = 0; i < count; ++i) { for(std::size_t channel = 0; channel < channels; ++channel) Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2013-06-12 20:43:11 UTC (rev 2346) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2013-06-12 21:29:03 UTC (rev 2347) @@ -310,7 +310,9 @@ MIXING_CLIPMIN = -(MIXING_CLIPMAX), }; +const float MIXING_SCALEF = static_cast<float>(1 << (32 - MIXING_ATTENUATION - 1)); + #define MAX_GLOBAL_VOLUME 256u // Resampling modes Modified: trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp =================================================================== --- trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp 2013-06-12 20:43:11 UTC (rev 2346) +++ trunk/OpenMPT/soundlib/SoundFilePlayConfig.cpp 2013-06-12 21:29:03 UTC (rev 2347) @@ -66,8 +66,8 @@ case mixLevels_117RC2: setVSTiAttenuation(2.0f); - setIntToFloat(1.0f/static_cast<float>(MIXING_CLIPMAX)); - setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); + setIntToFloat(1.0f/MIXING_SCALEF); + setFloatToInt(MIXING_SCALEF); setGlobalVolumeAppliesToMaster(true); setUseGlobalPreAmp(true); setForcePanningMode(dontForcePanningMode); @@ -84,8 +84,8 @@ default: case mixLevels_117RC3: setVSTiAttenuation(1.0f); - setIntToFloat(1.0f/static_cast<float>(MIXING_CLIPMAX)); - setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); + setIntToFloat(1.0f/MIXING_SCALEF); + setFloatToInt(MIXING_SCALEF); setGlobalVolumeAppliesToMaster(true); setUseGlobalPreAmp(false); setForcePanningMode(forceSoftPanning); @@ -101,8 +101,8 @@ // Sample attenuation is the same as in Schism Tracker (more attenuation than with RC3, thus VSTi attenuation is also higher). case mixLevels_compatible: setVSTiAttenuation(0.75f); - setIntToFloat(1.0f/static_cast<float>(MIXING_CLIPMAX)); - setFloatToInt(static_cast<float>(MIXING_CLIPMAX)); + setIntToFloat(1.0f/MIXING_SCALEF); + setFloatToInt(MIXING_SCALEF); setGlobalVolumeAppliesToMaster(true); setUseGlobalPreAmp(false); setForcePanningMode(forceNoSoftPanning); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-12 21:37:48
|
Revision: 2349 http://sourceforge.net/p/modplug/code/2349 Author: saga-games Date: 2013-06-12 21:37:41 +0000 (Wed, 12 Jun 2013) Log Message: ----------- [Fix] XM Loader: A default speed/tempo of 0 should be ignored in XM headers (fixes transwave by jazz & motion) [Mod] OpenMPT: Version is now 1.22.03.04 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Load_xm.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-12 21:34:41 UTC (rev 2348) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-12 21:37:41 UTC (rev 2349) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2013-06-12 21:34:41 UTC (rev 2348) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2013-06-12 21:37:41 UTC (rev 2349) @@ -315,8 +315,10 @@ m_nRestartPos = fileHeader.restartPos; m_nChannels = fileHeader.channels; m_nInstruments = std::min(fileHeader.instruments, uint16(MAX_INSTRUMENTS - 1)); - m_nDefaultSpeed = Clamp(fileHeader.speed, uint16(1), uint16(31)); - m_nDefaultTempo = Clamp(fileHeader.tempo, uint16(32), uint16(512)); + if(fileHeader.speed) + m_nDefaultSpeed = fileHeader.speed; + if(fileHeader.tempo) + m_nDefaultTempo = Clamp(fileHeader.tempo, uint16(32), uint16(512)); m_SongFlags.reset(); m_SongFlags.set(SONG_LINEARSLIDES, (fileHeader.flags & XMFileHeader::linearSlides) != 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-14 10:18:25
|
Revision: 2366 http://sourceforge.net/p/modplug/code/2366 Author: manxorist Date: 2013-06-14 10:18:18 +0000 (Fri, 14 Jun 2013) Log Message: ----------- [Ref] Add DecodeFloat?E and EncodeFloat?E to aid conversion between float and its endianess dependend bit pattern. [Ref] Add test cases that check for general float bit pattern sanity. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/mptrack/VstPresets.cpp trunk/OpenMPT/soundlib/Endianness.h trunk/OpenMPT/soundlib/FileReader.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-14 07:21:12 UTC (rev 2365) +++ trunk/OpenMPT/common/typedefs.h 2013-06-14 10:18:18 UTC (rev 2366) @@ -241,6 +241,18 @@ #define int24_min (0-0x00800000) #define int24_max (0+0x007fffff) +struct uint8_4 +{ + uint8 x[4]; + uint8_4() { } + uint8_4(uint8 a, uint8 b, uint8 c, uint8 d) { x[0] = a; x[1] = b; x[2] = c; x[3] = d; } + uint32 GetBE() const { return (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3] << 0); } + uint32 GetLE() const { return (x[0] << 0) | (x[1] << 8) | (x[2] << 16) | (x[3] << 24); } + uint8_4 & SetBE(uint32 y) { x[0] = (y >> 24)&0xff; x[1] = (y >> 16)&0xff; x[2] = (y >> 8)&0xff; x[3] = (y >> 0)&0xff; return *this; } + uint8_4 & SetLE(uint32 y) { x[0] = (y >> 0)&0xff; x[1] = (y >> 8)&0xff; x[2] = (y >> 16)&0xff; x[3] = (y >> 24)&0xff; return *this; } +}; +STATIC_ASSERT(sizeof(uint8_4) == 4); + typedef float float32; STATIC_ASSERT(sizeof(float32) == 4); Modified: trunk/OpenMPT/mptrack/VstPresets.cpp =================================================================== --- trunk/OpenMPT/mptrack/VstPresets.cpp 2013-06-14 07:21:12 UTC (rev 2365) +++ trunk/OpenMPT/mptrack/VstPresets.cpp 2013-06-14 10:18:18 UTC (rev 2366) @@ -245,9 +245,7 @@ void VSTPresets::WriteBE(float v, std::ostream &f) //------------------------------------------------ { - FloatInt32 u; - u.f = v; - WriteBE(u.i, f); + Write(EncodeFloatBE(v), f); } Modified: trunk/OpenMPT/soundlib/Endianness.h =================================================================== --- trunk/OpenMPT/soundlib/Endianness.h 2013-06-14 07:21:12 UTC (rev 2365) +++ trunk/OpenMPT/soundlib/Endianness.h 2013-06-14 10:18:18 UTC (rev 2366) @@ -96,3 +96,48 @@ #undef bswap16 #undef bswap32 + +static forceinline float DecodeFloatNE(uint32 i) +{ + FloatInt32 conv; + conv.i = i; + return conv.f; +} +static forceinline uint32 EncodeFloatNE(float f) +{ + FloatInt32 conv; + conv.f = f; + return conv.i; +} +static forceinline float DecodeFloatBE(uint8_4 x) +{ + #if defined(MPT_PLATFORM_FLIPPED_FLOAT_ENDIAN) + return DecodeFloatNE(x.GetLE()); + #else + return DecodeFloatNE(x.GetBE()); + #endif +} +static forceinline uint8_4 EncodeFloatBE(float f) +{ + #if defined(MPT_PLATFORM_FLIPPED_FLOAT_ENDIAN) + return uint8_4().SetLE(EncodeFloatNE(f)); + #else + return uint8_4().SetBE(EncodeFloatNE(f)); + #endif +} +static forceinline float DecodeFloatLE(uint8_4 x) +{ + #if defined(MPT_PLATFORM_FLIPPED_FLOAT_ENDIAN) + return DecodeFloatNE(x.GetBE()); + #else + return DecodeFloatNE(x.GetLE()); + #endif +} +static forceinline uint8_4 EncodeFloatLE(float f) +{ + #if defined(MPT_PLATFORM_FLIPPED_FLOAT_ENDIAN) + return uint8_4().SetBE(EncodeFloatNE(f)); + #else + return uint8_4().SetLE(EncodeFloatNE(f)); + #endif +} Modified: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2013-06-14 07:21:12 UTC (rev 2365) +++ trunk/OpenMPT/soundlib/FileReader.h 2013-06-14 10:18:18 UTC (rev 2366) @@ -728,11 +728,10 @@ // If successful, the file cursor is advanced by the size of the float. float ReadFloatLE() { - FloatInt32 target; + uint8_4 target; if(Read(target)) { - SwapBytesLE(target.i); - return target.f; + return DecodeFloatLE(target); } else { return 0.0f; @@ -743,11 +742,10 @@ // If successful, the file cursor is advanced by the size of the float. float ReadFloatBE() { - FloatInt32 target; + uint8_4 target; if(Read(target)) { - SwapBytesBE(target.i); - return target.f; + return DecodeFloatBE(target); } else { return 0.0f; Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-06-14 07:21:12 UTC (rev 2365) +++ trunk/OpenMPT/test/test.cpp 2013-06-14 10:18:18 UTC (rev 2366) @@ -423,9 +423,38 @@ } +static float AsFloat(uint32 x) +//---------------------------- +{ + FloatInt32 conv; + conv.i = x; + return conv.f; +} + +static uint32 AsInt(float x) +//-------------------------- +{ + FloatInt32 conv; + conv.f = x; + return conv.i; +} + void TestMisc() //------------- { + + VERIFY_EQUAL(AsFloat(0x3f800000u), 1.0f); + VERIFY_EQUAL(AsFloat(0x00000000u), 0.0f); + VERIFY_EQUAL(AsFloat(0xbf800000u), -1.0f); + VERIFY_EQUAL(DecodeFloatNE(0x3f800000u), 1.0f); + VERIFY_EQUAL(DecodeFloatLE(uint8_4(0x00,0x00,0x80,0x3f)), 1.0f); + VERIFY_EQUAL(DecodeFloatBE(uint8_4(0x3f,0x80,0x00,0x00)), 1.0f); + VERIFY_EQUAL(EncodeFloatNE(1.0f), 0x3f800000u); + VERIFY_EQUAL(EncodeFloatBE(1.0f).GetBE(), 0x3f800000u); + VERIFY_EQUAL(EncodeFloatLE(1.0f).GetBE(), 0x0000803fu); + VERIFY_EQUAL(EncodeFloatLE(1.0f).GetLE(), 0x3f800000u); + VERIFY_EQUAL(EncodeFloatBE(1.0f).GetLE(), 0x0000803fu); + VERIFY_EQUAL(ConvertStrTo<uint32>("586"), 586); VERIFY_EQUAL(ConvertStrTo<uint32>("2147483647"), (uint32)int32_max); VERIFY_EQUAL(ConvertStrTo<uint32>("4294967295"), uint32_max); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-14 11:13:54
|
Revision: 2367 http://sourceforge.net/p/modplug/code/2367 Author: manxorist Date: 2013-06-14 11:13:43 +0000 (Fri, 14 Jun 2013) Log Message: ----------- [Fix] Reduce quantization noise by correcting the rounding and scaling in floating point conversion and float or bigint normalization in SampleFormatConverters.h. [Fix] Do not tolerate off-by-one in the least significant bit in sample normalization test cases. [Ref] Do integer normalization without floating point code. [Ref] Avoid per-sample division in floating point normalization. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/soundlib/SampleFormatConverters.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-06-14 10:18:18 UTC (rev 2366) +++ trunk/OpenMPT/common/misc_util.h 2013-06-14 11:13:43 UTC (rev 2367) @@ -373,6 +373,13 @@ return static_cast<int32>( ( static_cast<int64>(a) * b + ( c / 2 ) ) / c ); } + inline int32 muldivrfloor(int64 a, uint32 b, uint32 c) + { + a *= b; + a += c/2; + return (a >= 0) ? (int32)(a / c) : (int32)((a - (c - 1)) / c); + } + template<typename T, std::size_t n> class fixed_size_queue { private: Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2013-06-14 10:18:18 UTC (rev 2366) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2013-06-14 11:13:43 UTC (rev 2367) @@ -187,12 +187,12 @@ forceinline int16 operator() (const void *sourceBuffer) { const uint8 *inBuf = static_cast<const uint8 *>(sourceBuffer); - const uint32 in32 = inBuf[loLoByteIndex] | (inBuf[loHiByteIndex] << 8) | (inBuf[hiLoByteIndex] << 16) | (inBuf[hiHiByteIndex] << 24); - const bool negative = (in32 & 0x80000000) != 0; - - float val = *reinterpret_cast<const float *>(&in32); + float val = DecodeFloatLE(uint8_4(inBuf[loLoByteIndex], inBuf[loHiByteIndex], inBuf[hiLoByteIndex], inBuf[hiHiByteIndex])); Limit(val, -1.0f, 1.0f); - return static_cast<int16>(val * (negative ? -int16_min : int16_max)); + val *= 32768.0f; + // MSVC with x87 floating point math calls floor for the more intuitive version + // return mpt::saturate_cast<int16>(static_cast<int>(std::floor(val + 0.5f))); + return mpt::saturate_cast<int16>(static_cast<int>(val * 2.0f + 1.0f) >> 1); } }; @@ -200,15 +200,14 @@ ////////////////////////////////////////////////////// // Sample normalization + conversion functors -// Signed integer PCM (up to 32-Bit) to 16-Big signed sample conversion with normalization. A second sample conversion functor is used for actual sample reading. +// Signed integer PCM (up to 32-Bit) to 16-Bit signed sample conversion with normalization. A second sample conversion functor is used for actual sample reading. template <typename SampleConversion> struct ReadBigIntToInt16PCMandNormalize : SampleConversionFunctor<typename SampleConversion::input_t, int16, conversionHasNoState> { - uint32 maxCandidate; - double maxVal; + uint32 maxVal; SampleConversion sampleConv; - ReadBigIntToInt16PCMandNormalize() : maxCandidate(0) + ReadBigIntToInt16PCMandNormalize() : maxVal(0) { static_assert(SampleConversion::hasState == false, "Implementation of this conversion functor is stateless"); static_assert(sizeof(typename SampleConversion::output_t) <= 4, "Implementation of this conversion functor is only suitable for 32-Bit integers or smaller"); @@ -222,30 +221,28 @@ { if(val == int32_min) { - maxCandidate = static_cast<uint32>(-int32_min); + maxVal = static_cast<uint32>(-int32_min); return; } val = -val; } - if(static_cast<uint32>(val) > maxCandidate) + if(static_cast<uint32>(val) > maxVal) { - maxCandidate = static_cast<uint32>(val); + maxVal = static_cast<uint32>(val); } } - bool IsSilent() + bool IsSilent() const { - maxVal = static_cast<double>(maxCandidate); - return (maxCandidate == 0); + return maxVal == 0; } forceinline int16 operator() (const void *sourceBuffer) { int32 val = sampleConv(sourceBuffer); - const double NC = (val < 0) ? 32768.0 : 32767.0; // Normalization Constant - const double roundBias = (val < 0) ? -0.5 : 0.5; - return static_cast<int16>((static_cast<double>(val) / maxVal * NC) + roundBias); + val = Util::muldivrfloor(val, 32768, maxVal); + return mpt::saturate_cast<int16>(val); } }; @@ -254,9 +251,14 @@ template <size_t loLoByteIndex, size_t loHiByteIndex, size_t hiLoByteIndex, size_t hiHiByteIndex> struct ReadFloat32to16PCMandNormalize : SampleConversionFunctor<float, int16, conversionHasNoState> { - FloatInt32 maxVal; + uint32 intMaxVal; + float maxValInv; - ReadFloat32to16PCMandNormalize() { maxVal.i = 0; } + ReadFloat32to16PCMandNormalize() + { + intMaxVal = 0; + maxValInv = 0.0f; + } forceinline void FindMax(const void *sourceBuffer) { @@ -266,27 +268,34 @@ // IEEE float values are lexicographically ordered and can be compared when interpreted as integers. // So we won't bother with loading the float into a floating point register here if we already have it in an integer register. - if(val > maxVal.i) + if(val > intMaxVal) { - ASSERT(*reinterpret_cast<float *>(&val) > maxVal.f); - maxVal.i = val; + ASSERT(*reinterpret_cast<float *>(&val) > DecodeFloatLE(uint8_4().SetLE(intMaxVal))); + intMaxVal = val; } } - bool IsSilent() const + bool IsSilent() { - return (maxVal.i == 0); + if(intMaxVal == 0) + { + return true; + } else + { + maxValInv = 1.0f / DecodeFloatLE(uint8_4().SetLE(intMaxVal)); + return false; + } } forceinline int16 operator() (const void *sourceBuffer) { const uint8 *inBuf = static_cast<const uint8 *>(sourceBuffer); - const uint32 in32 = inBuf[loLoByteIndex] | (inBuf[loHiByteIndex] << 8) | (inBuf[hiLoByteIndex] << 16) | (inBuf[hiHiByteIndex] << 24); - const bool negative = (in32 & 0x80000000) != 0; - - const float val = (*reinterpret_cast<const float *>(&in32) / maxVal.f) * (negative ? 32768.0f : 32767.0f); - ASSERT(val >= -32768.0f && val <= 32767.0f); - return static_cast<int16>(val); + float val = DecodeFloatLE(uint8_4(inBuf[loLoByteIndex], inBuf[loHiByteIndex], inBuf[hiLoByteIndex], inBuf[hiHiByteIndex])); + val *= maxValInv; + val *= 32768.0f; + // MSVC with x87 floating point math calls floor for the more intuitive version + // return mpt::saturate_cast<int16>(static_cast<int>(std::floor(val + 0.5f))); + return mpt::saturate_cast<int16>(static_cast<int>(val * 2.0f + 1.0f) >> 1); } }; Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-06-14 10:18:18 UTC (rev 2366) +++ trunk/OpenMPT/test/test.cpp 2013-06-14 11:13:43 UTC (rev 2367) @@ -1855,11 +1855,7 @@ for(size_t i = 0; i < 65536; i++) { - int16 normValue = static_cast<const int16 *>(sample.pSample)[i]; - if(abs(normValue - static_cast<int16>(i)) > 1) - { - VERIFY_EQUAL_QUIET_NONCONT(true, false); - } + VERIFY_EQUAL_QUIET_NONCONT(static_cast<const int16 *>(sample.pSample)[i], static_cast<int16>(i)); VERIFY_EQUAL_QUIET_NONCONT(truncated16[i], static_cast<int16>(i)); } } @@ -1869,13 +1865,11 @@ uint8 *source32 = sourceBuf; for(size_t i = 0; i < 65536; i++) { - FloatInt32 val; - - val.f = (static_cast<float>(i) / 65536.0f) - 0.5f; - source32[i * 4 + 0] = static_cast<uint8>(val.i >> 24); - source32[i * 4 + 1] = static_cast<uint8>(val.i >> 16); - source32[i * 4 + 2] = static_cast<uint8>(val.i >> 8); - source32[i * 4 + 3] = static_cast<uint8>(val.i >> 0); + uint8_4 floatbits = EncodeFloatBE((static_cast<float>(i) / 65536.0f) - 0.5f); + source32[i * 4 + 0] = floatbits.x[0]; + source32[i * 4 + 1] = floatbits.x[1]; + source32[i * 4 + 2] = floatbits.x[2]; + source32[i * 4 + 3] = floatbits.x[3]; } int16 *truncated16 = static_cast<int16 *>(targetBuf); @@ -1889,11 +1883,7 @@ for(size_t i = 0; i < 65536; i++) { - int16 normValue = static_cast<const int16 *>(sample.pSample)[i]; - if(abs(normValue - static_cast<int16>(i- 0x8000u)) > 1) - { - VERIFY_EQUAL_QUIET_NONCONT(true, false); - } + VERIFY_EQUAL_QUIET_NONCONT(static_cast<const int16 *>(sample.pSample)[i], static_cast<int16>(i - 0x8000u)); if(abs(truncated16[i] - static_cast<int16>((i - 0x8000u) / 2)) > 1) { VERIFY_EQUAL_QUIET_NONCONT(true, false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-16 11:53:27
|
Revision: 2387 http://sourceforge.net/p/modplug/code/2387 Author: manxorist Date: 2013-06-16 11:53:17 +0000 (Sun, 16 Jun 2013) Log Message: ----------- [Ref] Replace 'VOID' with 'void' in soundlib and sounddev. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDevices.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Mmcmp.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/common/typedefs.h 2013-06-16 11:53:17 UTC (rev 2387) @@ -278,7 +278,6 @@ // openmpt assumes these type have exact WIN32 semantics -#define VOID void typedef std::int32_t BOOL; typedef std::uint8_t BYTE; typedef std::uint16_t WORD; @@ -294,8 +293,7 @@ typedef std::uint32_t UINT; typedef std::uint32_t ULONG; typedef std::uint64_t ULONGLONG; -typedef VOID * LPVOID; -typedef VOID * PVOID; +typedef void * LPVOID; typedef BYTE * LPBYTE; typedef WORD * LPWORD; typedef DWORD * LPDWORD; Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-16 11:53:17 UTC (rev 2387) @@ -49,7 +49,7 @@ } -VOID ISoundDevice::Configure(HWND hwnd, UINT LatencyMS, UINT UpdateIntervalMS, DWORD fdwCfgOptions) +void ISoundDevice::Configure(HWND hwnd, UINT LatencyMS, UINT UpdateIntervalMS, DWORD fdwCfgOptions) //------------------------------------------------------------------------------------------------- { if(LatencyMS < SNDDEV_MINLATENCY_MS) LatencyMS = SNDDEV_MINLATENCY_MS; @@ -75,7 +75,7 @@ } -void ISoundDevice::SourceAudioRead(PVOID pData, ULONG NumSamples) +void ISoundDevice::SourceAudioRead(void* pData, ULONG NumSamples) //--------------------------------------------------------------- { m_Source->AudioRead(pData, NumSamples); @@ -702,7 +702,7 @@ } -VOID CWaveDevice::WaveOutCallBack(HWAVEOUT, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR, DWORD_PTR) +void CWaveDevice::WaveOutCallBack(HWAVEOUT, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR, DWORD_PTR) //-------------------------------------------------------------------------------------------- { if ((uMsg == MM_WOM_DONE) && (dwUser)) @@ -1487,7 +1487,7 @@ } CLSID clsid = gAsioDrivers[nDevice].clsid; - if (CoCreateInstance(clsid,0,CLSCTX_INPROC_SERVER, clsid, (VOID **)&m_pAsioDrv) == S_OK) + if (CoCreateInstance(clsid,0,CLSCTX_INPROC_SERVER, clsid, (void **)&m_pAsioDrv) == S_OK) { m_pAsioDrv->init((void *)m_hWnd); } else Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-06-16 11:53:17 UTC (rev 2387) @@ -40,7 +40,7 @@ { public: virtual void FillAudioBufferLocked(IFillAudioBuffer &callback) = 0; // take any locks needed while rendering audio and then call FillAudioBuffer - virtual void AudioRead(PVOID pData, ULONG NumSamples) = 0; + virtual void AudioRead(void* pData, ULONG NumSamples) = 0; virtual void AudioDone(ULONG NumSamples, ULONG SamplesLatency) = 0; // all in samples virtual void AudioDone(ULONG NumSamples) = 0; // all in samples }; @@ -106,7 +106,7 @@ protected: virtual void FillAudioBuffer() = 0; void SourceFillAudioBufferLocked(); - void SourceAudioRead(PVOID pData, ULONG NumSamples); + void SourceAudioRead(void* pData, ULONG NumSamples); void SourceAudioDone(ULONG NumSamples, ULONG SamplesLatency); public: @@ -116,7 +116,7 @@ ISoundSource *GetSource() const { return m_Source; } public: - VOID Configure(HWND hwnd, UINT LatencyMS, UINT UpdateIntervalMS, DWORD fdwCfgOptions); + void Configure(HWND hwnd, UINT LatencyMS, UINT UpdateIntervalMS, DWORD fdwCfgOptions); float GetRealLatencyMS() const { return m_RealLatencyMS; } float GetRealUpdateIntervalMS() const { return m_RealUpdateIntervalMS; } bool IsPlaying() const { return m_IsPlaying; } Modified: trunk/OpenMPT/sounddev/SoundDevices.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevices.h 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/sounddev/SoundDevices.h 2013-06-16 11:53:17 UTC (rev 2387) @@ -132,7 +132,7 @@ int64 GetStreamPositionSamples() const; public: - static VOID CALLBACK WaveOutCallBack(HWAVEOUT, UINT uMsg, DWORD_PTR, DWORD_PTR dw1, DWORD_PTR dw2); + static void CALLBACK WaveOutCallBack(HWAVEOUT, UINT uMsg, DWORD_PTR, DWORD_PTR dw1, DWORD_PTR dw2); static BOOL EnumerateDevices(UINT nIndex, LPSTR pszDescription, UINT cbSize); }; Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-06-16 11:53:17 UTC (rev 2387) @@ -374,10 +374,10 @@ ////////////////////////////////////////////////////////// // Interfaces -typedef VOID (* LPMIXINTERFACE)(ModChannel *, const CResampler *, int *, int *); +typedef void (* LPMIXINTERFACE)(ModChannel *, const CResampler *, int *, int *); #define BEGIN_MIX_INTERFACE(func)\ - VOID func(ModChannel *pChannel, const CResampler *pResampler, int *pbuffer, int *pbufmax)\ + void func(ModChannel *pChannel, const CResampler *pResampler, int *pbuffer, int *pbufmax)\ {\ UNREFERENCED_PARAMETER(pResampler);\ LONG nPos; Modified: trunk/OpenMPT/soundlib/Mmcmp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmcmp.cpp 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/soundlib/Mmcmp.cpp 2013-06-16 11:53:17 UTC (rev 2387) @@ -355,7 +355,7 @@ } -VOID XPK_DoUnpack(const BYTE *src, UINT, BYTE *dst, int len) +void XPK_DoUnpack(const BYTE *src, UINT, BYTE *dst, int len) { static BYTE xpk_table[] = { 2,3,4,5,6,7,8,0,3,2,4,5,6,7,8,0,4,3,5,2,6,7,8,0,5,4, 6,2,3,7,8,0,6,5,7,2,3,4,8,0,7,6,8,2,3,4,5,0,8,7,6,2,3,4,5,0 }; @@ -614,7 +614,7 @@ } -VOID PP20_DoUnpack(const BYTE *pSrc, UINT nSrcLen, BYTE *pDst, UINT nDstLen) +void PP20_DoUnpack(const BYTE *pSrc, UINT nSrcLen, BYTE *pDst, UINT nDstLen) { PPBITBUFFER BitBuffer; ULONG nBytesLeft; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-06-16 09:53:08 UTC (rev 2386) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-06-16 11:53:17 UTC (rev 2387) @@ -62,7 +62,7 @@ #endif -typedef VOID (* LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); // buffer, samples, channels +typedef void (* LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); // buffer, samples, channels #include "pattern.h" #include "patternContainer.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-16 12:05:53
|
Revision: 2388 http://sourceforge.net/p/modplug/code/2388 Author: manxorist Date: 2013-06-16 12:05:44 +0000 (Sun, 16 Jun 2013) Log Message: ----------- [Fix] Show "waiting for asio failed" warning only in debug build. Also reduce its timeout from 1s to 250ms. Modified Paths: -------------- trunk/OpenMPT/common/typedefs.h trunk/OpenMPT/sounddev/SoundDevice.cpp Modified: trunk/OpenMPT/common/typedefs.h =================================================================== --- trunk/OpenMPT/common/typedefs.h 2013-06-16 11:53:17 UTC (rev 2387) +++ trunk/OpenMPT/common/typedefs.h 2013-06-16 12:05:44 UTC (rev 2388) @@ -130,6 +130,8 @@ #endif #endif +#define ASSERT_WARN_MESSAGE(expr,msg) ASSERT(expr) + #if defined(_DEBUG) #define ALWAYS_ASSERT(expr) ASSERT(expr) #define ALWAYS_ASSERT_WARN_MESSAGE(expr,msg) ASSERT(expr) Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-16 11:53:17 UTC (rev 2387) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-06-16 12:05:44 UTC (rev 2388) @@ -1350,25 +1350,25 @@ DWORD pollingstart = GetTickCount(); while(InterlockedExchangeAdd(&m_RenderingSilence, 0) != (silence?1:0)) { - if(GetTickCount() - pollingstart > 1000) + if(GetTickCount() - pollingstart > 250) { if(silence) { if(CriticalSection::IsLocked()) { - ALWAYS_ASSERT_WARN_MESSAGE(false, "AudioCriticalSection locked while stopping ASIO"); + ASSERT_WARN_MESSAGE(false, "AudioCriticalSection locked while stopping ASIO"); } else { - ALWAYS_ASSERT_WARN_MESSAGE(false, "waiting for asio failed in Stop()"); + ASSERT_WARN_MESSAGE(false, "waiting for asio failed in Stop()"); } } else { if(CriticalSection::IsLocked()) { - ALWAYS_ASSERT_WARN_MESSAGE(false, "AudioCriticalSection locked while starting ASIO"); + ASSERT_WARN_MESSAGE(false, "AudioCriticalSection locked while starting ASIO"); } else { - ALWAYS_ASSERT_WARN_MESSAGE(false, "waiting for asio failed in Start()"); + ASSERT_WARN_MESSAGE(false, "waiting for asio failed in Start()"); } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-17 21:20:47
|
Revision: 2390 http://sourceforge.net/p/modplug/code/2390 Author: saga-games Date: 2013-06-17 21:20:40 +0000 (Mon, 17 Jun 2013) Log Message: ----------- [Fix] Don't display negative numbers or 0s as an estimated length for extremely long tracks [Fix] Better SBx loop length handling for IT files in song length estimation (http://bugs.openmpt.org/view.php?id=416) Modified Paths: -------------- trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-06-16 12:32:51 UTC (rev 2389) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-06-17 21:20:40 UTC (rev 2390) @@ -68,7 +68,7 @@ // this converts a buffer of 32-bit integer sample data to 32 bit floating point static void M2W_32ToFloat(void *pBuffer, long nCount) { -// const float _ki2f = 1.0f / (float)(ULONG)(0x80000000); //olivier +// const float _ki2f = 1.0f / (float)(ULONG)(0x80000000); //olivier const float _ki2f = 1.0f / (float)(ULONG)(0x7fffffff); //ericus' 32bit fix // const float _ki2f = 1.0f / (float)(ULONG)(0x7ffffff); //robin _asm { @@ -672,8 +672,8 @@ BYTE buffer[WAVECONVERTBUFSIZE]; CHAR s[80]; HWND progress = ::GetDlgItem(m_hWnd, IDC_PROGRESS1); - UINT ok = IDOK, pos; - ULONGLONG ullSamples, ullMaxSamples; + UINT ok = IDOK, pos = 0; + uint64 ullSamples = 0, ullMaxSamples; DWORD dwDataOffset; LONG lMax = 256; @@ -739,18 +739,17 @@ fwrite(m_pWaveFormat, 1, fmthdr.length, f); fwrite(&datahdr, 1, sizeof(datahdr), f); dwDataOffset = ftell(f); - pos = 0; ullSamples = 0; ullMaxSamples = m_dwFileLimit / (m_pWaveFormat->nChannels * m_pWaveFormat->wBitsPerSample / 8); if (m_dwSongLimit) { - ULONGLONG l = (ULONGLONG)m_dwSongLimit * m_pWaveFormat->nSamplesPerSec; + uint64 l = (uint64)m_dwSongLimit * m_pWaveFormat->nSamplesPerSec; if (l < ullMaxSamples) ullMaxSamples = l; } // calculate maximum samples - ULONGLONG max = ullMaxSamples; - ULONGLONG l = ((ULONGLONG)m_pSndFile->GetSongTime()) * m_pWaveFormat->nSamplesPerSec * (ULONGLONG)std::max(1, 1 + m_pSndFile->GetRepeatCount()); + uint64 max = ullMaxSamples; + uint64 l = static_cast<uint64>(m_pSndFile->GetSongTime() + 0.5) * m_pWaveFormat->nSamplesPerSec * std::max<uint64>(1, 1 + m_pSndFile->GetRepeatCount()); if (m_nMaxPatterns > 0) { DWORD dwOrds = m_pSndFile->Order.GetLengthFirstEmpty(); @@ -793,20 +792,6 @@ iter->processed = true; } -/* if (m_bGivePlugsIdleTime) { - LARGE_INTEGER startTime, endTime, duration,Freq; - QueryPerformanceFrequency(&Freq); - long samplesprocessed = sizeof(buffer)/(m_pWaveFormat->nChannels * m_pWaveFormat->wBitsPerSample / 8); - duration.QuadPart = samplesprocessed / static_cast<double>(m_pWaveFormat->nSamplesPerSec) * Freq.QuadPart; - if (QueryPerformanceCounter(&startTime)) { - endTime.QuadPart=0; - while ((endTime.QuadPart-startTime.QuadPart)<duration.QuadPart*4) { - theApp.GetPluginManager()->OnIdle(); - QueryPerformanceCounter(&endTime); - } - } - }*/ - if (m_bGivePlugsIdleTime) { Sleep(20); @@ -1106,7 +1091,7 @@ } DWORD oldsndcfg = m_pSndFile->m_MixerSettings.MixerFlags; oldrepeat = m_pSndFile->GetRepeatCount(); - const DWORD dwSongTime = m_pSndFile->GetSongTime(); + const uint64 dwSongTime = static_cast<uint64>(m_pSndFile->GetSongTime() + 0.5); mixersettings.gdwMixingFreq = wfxSrc.nSamplesPerSec; mixersettings.m_SampleFormat = SampleFormatInt16; mixersettings.gnChannels = wfxSrc.nChannels; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-06-16 12:32:51 UTC (rev 2389) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-06-17 21:20:40 UTC (rev 2390) @@ -234,7 +234,7 @@ std::ostringstream str; str << "File: " << lpszPathName << std::endl - << "Last saved with: " << MptVersion::ToStr(m_SndFile.m_dwLastSavedWithVersion) << ", your version is " << MptVersion::str << std::endl + << "Last saved with: " << m_SndFile.madeWithTracker << ", you are using OpenMPT " << MptVersion::str << std::endl << std::endl; logcapturer.ShowLog(str.str()); @@ -1217,7 +1217,7 @@ if(!pChn->dwFlags[mask] && pChn->nLength && (note == pChn->nNewNote || !note)) { m_SndFile.KeyOff(i); - if (!m_SndFile.m_nInstruments) pChn->dwFlags.reset(CHN_LOOP); + if (!m_SndFile.m_nInstruments) pChn->dwFlags.reset(CHN_LOOP); // FIXME: If a sample with pingpong loop is playing backwards, stuff before the loop is played again! if (fade) pChn->dwFlags.set(CHN_NOTEFADE); if (note) break; } @@ -2263,9 +2263,16 @@ void CModDoc::OnEstimateSongLength() //---------------------------------- { - CHAR s[64]; - DWORD dwSongLength = m_SndFile.GetSongTime(); - wsprintf(s, "Approximate song length: %dmn%02ds", dwSongLength / 60, dwSongLength % 60); + CString s; + double songLength = m_SndFile.GetSongTime(); + if(songLength != std::numeric_limits<double>::infinity()) + { + songLength = Util::Round(songLength); + s.Format("Approximate song length: %.0fmn%02.0fs", songLength / 60.0, fmod(songLength, 60.0)); + } else + { + s = "Song too long!"; + } Reporting::Information(s); } Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-16 12:32:51 UTC (rev 2389) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-17 21:20:40 UTC (rev 2390) @@ -724,7 +724,7 @@ // In the pattern loader above, a second condition is used: Only tempo commands // below 100 BPM are taken into account. Furthermore, only M.K. (ProTracker) // modules are checked. - const bool fixVBlank = isMdKd && hasTempoCommands && GetSongTime() >= 10 * 60; + const bool fixVBlank = isMdKd && hasTempoCommands && GetSongTime() >= 600.0; const bool fix7BitPanning = leftPanning && !extendedPanning; if(fixVBlank || fix7BitPanning) { @@ -1228,7 +1228,7 @@ uint16 period = 0; // Convert note to period - if(m.IsNote() && m.note >= 36 + NOTE_MIN && m.note < CountOf(ProTrackerPeriodTable) + 36 + NOTE_MIN) + if(m.note >= 36 + NOTE_MIN && m.note < CountOf(ProTrackerPeriodTable) + 36 + NOTE_MIN) { period = ProTrackerPeriodTable[m.note - 36 - NOTE_MIN]; } Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-16 12:32:51 UTC (rev 2389) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-17 21:20:40 UTC (rev 2390) @@ -170,6 +170,7 @@ nPattern = Order[nCurrentOrder]; bool positionJumpOnThisRow = false; bool patternBreakOnThisRow = false; + bool patternLoopEndedOnThisRow = false; while(nPattern >= Patterns.Size()) { @@ -382,6 +383,7 @@ if (param & 0x0F) { memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(param & 0x0F); + patternLoopEndedOnThisRow = true; } else { memory.chnSettings[nChn].patLoop = memory.elapsedTime; @@ -534,9 +536,22 @@ const UINT tickDuration = GetTickDuration(memory.musicTempo, memory.musicSpeed, rowsPerBeat); const UINT rowDuration = tickDuration * (memory.musicSpeed + tickDelay) * MAX(rowDelay, 1); + const double rowDurationDbl = static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); + memory.elapsedTime += rowDurationDbl; + memory.renderedSamples += rowDuration; - memory.elapsedTime += static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); - memory.renderedSamples += rowDuration; + if(GetType() == MOD_TYPE_IT && patternLoopEndedOnThisRow) + { + // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) + p = Patterns[nPattern].GetRow(nRow); + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) + { + if(p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) + { + memory.chnSettings[nChn].patLoop = memory.elapsedTime; + } + } + } } if(retval.targetReached || target.mode == GetLengthTarget::NoTarget) @@ -3963,7 +3978,7 @@ const PLUGINDEX nPlug = (plugin != 0) ? plugin : GetBestPlugin(nChn, PrioritiseChannel, EvenIfMuted); if ((nPlug) && (nPlug <= MAX_MIXPLUGINS) && param < 0x80) { - const float newRatio = 1.0 - (static_cast<float>(param & 0x7F) / 127.0f); + const float newRatio = 1.0f - (static_cast<float>(param & 0x7F) / 127.0f); if(!isSmooth) { m_MixPlugins[nPlug - 1].fDryRatio = newRatio; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-06-16 12:32:51 UTC (rev 2389) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-06-17 21:20:40 UTC (rev 2390) @@ -535,7 +535,7 @@ public: //Returns song length in seconds. - DWORD GetSongTime() { return static_cast<DWORD>(GetLength(eNoAdjust).duration + 0.5); } + double GetSongTime() { return GetLength(eNoAdjust).duration; } void RecalculateSamplesPerTick(); double GetRowDuration(UINT tempo, UINT speed) const; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-17 22:46:13
|
Revision: 2391 http://sourceforge.net/p/modplug/code/2391 Author: saga-games Date: 2013-06-17 22:46:04 +0000 (Mon, 17 Jun 2013) Log Message: ----------- [Fix] Song Length Estimation: More pattern loop fixes, and tempo slides shouldn't underflow anymore. [Mod] OpenMPT: Version is now 1.22.03.05 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-17 21:20:40 UTC (rev 2390) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-17 22:46:04 UTC (rev 2391) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 04 +#define VER_MINORMINOR 05 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-17 21:20:40 UTC (rev 2390) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-17 22:46:04 UTC (rev 2391) @@ -342,13 +342,19 @@ if (param) pChn->nOldTempo = (BYTE)param; else param = pChn->nOldTempo; } if (param >= 0x20) memory.musicTempo = param; else - // Tempo Slide - if ((param & 0xF0) == 0x10) { - memory.musicTempo += (param & 0x0F) * (memory.musicSpeed - 1); //rewbs.tempoSlideFix - } else - { - memory.musicTempo -= (param & 0x0F) * (memory.musicSpeed - 1); //rewbs.tempoSlideFix + // Tempo Slide + uint32 tempoDiff = (param & 0x0F) * (memory.musicSpeed - 1); + if ((param & 0xF0) == 0x10) + { + memory.musicTempo += tempoDiff; + } else + { + if(tempoDiff < memory.musicTempo) + memory.musicTempo -= tempoDiff; + else + memory.musicTempo = 32; + } } // -> CODE#0010 // -> DESC="add extended parameter mechanism to pattern effects" @@ -382,12 +388,21 @@ // Pattern Loop if (param & 0x0F) { - memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(param & 0x0F); patternLoopEndedOnThisRow = true; } else { - memory.chnSettings[nChn].patLoop = memory.elapsedTime; - memory.chnSettings[nChn].patLoopStart = nRow; + CHANNELINDEX firstChn = nChn, lastChn = nChn; + if(GetType() == MOD_TYPE_S3M) + { + // ST3 has only one global loop memory. + firstChn = 0; + lastChn = GetNumChannels() - 1; + } + for(CHANNELINDEX c = firstChn; c < lastChn; c++) + { + memory.chnSettings[c].patLoop = memory.elapsedTime; + memory.chnSettings[c].patLoopStart = nRow; + } } } break; @@ -402,8 +417,8 @@ // Pattern Loop if (param & 0x0F) { - memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(param & 0x0F); nNextPatStartRow = memory.chnSettings[nChn].patLoopStart; // FT2 E60 bug + patternLoopEndedOnThisRow = true; } else { memory.chnSettings[nChn].patLoop = memory.elapsedTime; @@ -534,23 +549,34 @@ rowsPerBeat = Patterns[nPattern].GetRowsPerBeat(); } - const UINT tickDuration = GetTickDuration(memory.musicTempo, memory.musicSpeed, rowsPerBeat); - const UINT rowDuration = tickDuration * (memory.musicSpeed + tickDelay) * MAX(rowDelay, 1); - const double rowDurationDbl = static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); - memory.elapsedTime += rowDurationDbl; + const uint32 tickDuration = GetTickDuration(memory.musicTempo, memory.musicSpeed, rowsPerBeat); + const uint32 rowDuration = tickDuration * (memory.musicSpeed + tickDelay) * MAX(rowDelay, 1); + memory.elapsedTime += static_cast<double>(rowDuration) / static_cast<double>(m_MixerSettings.gdwMixingFreq); memory.renderedSamples += rowDuration; - if(GetType() == MOD_TYPE_IT && patternLoopEndedOnThisRow) + if(patternLoopEndedOnThisRow) { - // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) p = Patterns[nPattern].GetRow(nRow); - for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, pChn++, nChn++) + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) { - if(p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) + if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF) + || (p->command == CMD_MODCMDEX && p->param >= 0x61 && p->param <= 0x6F)) { - memory.chnSettings[nChn].patLoop = memory.elapsedTime; + memory.elapsedTime += (memory.elapsedTime - memory.chnSettings[nChn].patLoop) * (double)(p->param & 0x0F); } } + if(GetType() == MOD_TYPE_IT) + { + // IT pattern loop start row update - at the end of a pattern loop, set pattern loop start to next row (for upcoming pattern loops with missing SB0) + p = Patterns[nPattern].GetRow(nRow); + for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); p++, nChn++) + { + if((p->command == CMD_S3MCMDEX && p->param >= 0xB1 && p->param <= 0xBF)) + { + memory.chnSettings[nChn].patLoop = memory.elapsedTime; + } + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-21 14:41:07
|
Revision: 2398 http://sourceforge.net/p/modplug/code/2398 Author: manxorist Date: 2013-06-21 14:40:59 +0000 (Fri, 21 Jun 2013) Log Message: ----------- Merged revision(s) 2382-2386, 2395 from branches/manx/serialization-utils-cleanup: [Ref] De-obfuscate iostreams types. ........ [Fix] Basic endian-safety in serialization_utils.h (at least kill reinterpret_cast). ........ [Ref] Kill void pointers in serialization_utils. [Fix] Correctly pass little endian id values on big endian. ........ [Ref] Remove unneeded reinterpret_cast. ........ [Fix] Basic endian-safety in serialization_utils.cpp (at least kill reinterpret_cast). ........ [Fix] Trivial build fix. ........ Modified Paths: -------------- trunk/OpenMPT/common/serialization_utils.cpp trunk/OpenMPT/common/serialization_utils.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/patternContainer.cpp trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuningCollection.cpp trunk/OpenMPT/soundlib/tuningbase.cpp Property Changed: ---------------- trunk/OpenMPT/ Index: trunk/OpenMPT =================================================================== --- trunk/OpenMPT 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT 2013-06-21 14:40:59 UTC (rev 2398) Property changes on: trunk/OpenMPT ___________________________________________________________________ Modified: svn:mergeinfo ## -6,5 +6,6 ## /branches/manx/nonglobal-mixer:1715-1841 /branches/manx/profiler:1813 /branches/manx/project-files-cleanups:1378-1382 +/branches/manx/serialization-utils-cleanup:2382-2386,2395 /branches/manx/snddev-fixes:1605-1713 /branches/manx/unarchiver:1887-1888 \ No newline at end of property Modified: trunk/OpenMPT/common/serialization_utils.cpp =================================================================== --- trunk/OpenMPT/common/serialization_utils.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/common/serialization_utils.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -30,10 +30,9 @@ } -bool IsPrintableId(const void* pvId, const size_t nLength) +bool IsPrintableId(const char* pId, const size_t nLength) //-------------------------------------------------------- { - const char* pId = static_cast<const char*>(pvId); for(size_t i = 0; i < nLength; i++) { if (pId[i] <= 0 || isprint(pId[i]) == 0) @@ -63,7 +62,7 @@ } -void WriteAdaptive12(OutStream& oStrm, const uint16 num) +void WriteAdaptive12(std::ostream& oStrm, const uint16 num) //------------------------------------------------------ { if(num >> 7 == 0) @@ -73,7 +72,7 @@ } -void WriteAdaptive1234(OutStream& oStrm, const uint32 num) +void WriteAdaptive1234(std::ostream& oStrm, const uint32 num) //-------------------------------------------------------- { const uint8 bc = GetByteReq1234(num); @@ -83,7 +82,7 @@ //Format: First bit tells whether the size indicator is 1 or 2 bytes. -void WriteAdaptive12String(OutStream& oStrm, const std::string& str) +void WriteAdaptive12String(std::ostream& oStrm, const std::string& str) //------------------------------------------------------------------ { uint16 s = static_cast<uint16>(str.size()); @@ -103,7 +102,7 @@ else return 3; } -void WriteAdaptive1248(OutStream& oStrm, const uint64& num) +void WriteAdaptive1248(std::ostream& oStrm, const uint64& num) //--------------------------------------------------------- { const uint8 bc = GetByteReq1248(num); @@ -112,21 +111,34 @@ } -void ReadAdaptive12(InStream& iStrm, uint16& val) +void ReadAdaptive12(std::istream& iStrm, uint16& val) //----------------------------------------------- { Binaryread<uint16>(iStrm, val, 1); - if(val & 1) iStrm.read(reinterpret_cast<char*>(&val) + 1, 1); + if(val & 1) + { + uint8 hi = 0; + Binaryread(iStrm, hi); + val &= 0xff; + val |= hi << 8; + } val >>= 1; } -void ReadAdaptive1234(InStream& iStrm, uint32& val) +void ReadAdaptive1234(std::istream& iStrm, uint32& val) //------------------------------------------------- { Binaryread<uint32>(iStrm, val, 1); const uint8 bc = 1 + static_cast<uint8>(val & 3); - if(bc > 1) iStrm.read(reinterpret_cast<char*>(&val)+1, bc-1); + uint8 v2 = 0; + uint8 v3 = 0; + uint8 v4 = 0; + if(bc >= 2) Binaryread(iStrm, v2); + if(bc >= 3) Binaryread(iStrm, v3); + if(bc >= 4) Binaryread(iStrm, v4); + val &= 0xff; + val |= (v2 << 8) | (v3 << 16) | (v4 << 24); val >>= 2; } @@ -135,17 +147,29 @@ // Returns 2^n. n must be within {0,...,7}. inline uint8 Pow2xSmall(const uint8& exp) {ASSERT(exp <= 7); return pow2xTable[exp];} -void ReadAdaptive1248(InStream& iStrm, uint64& val) +void ReadAdaptive1248(std::istream& iStrm, uint64& val) //------------------------------------------------- { Binaryread<uint64>(iStrm, val, 1); - const uint8 bc = Pow2xSmall(static_cast<uint8>(val & 3)); - if(bc > 1) iStrm.read(reinterpret_cast<char*>(&val)+1, bc-1); + uint8 bc = Pow2xSmall(static_cast<uint8>(val & 3)); + int byte = 1; + val &= 0xff; + while(bc > 1) + { + uint8 v = 0; + Binaryread(iStrm, v); + if(byte < 8) + { + val |= uint64(v) << (byte*8); + } + byte++; + bc--; + } val >>= 2; } -void WriteItemString(OutStream& oStrm, const char* const pStr, const size_t nSize) +void WriteItemString(std::ostream& oStrm, const char* const pStr, const size_t nSize) //-------------------------------------------------------------------------------- { uint32 id = std::min<size_t>(nSize, (uint32_max >> 4)) << 4; @@ -157,7 +181,7 @@ } -void ReadItemString(InStream& iStrm, std::string& str, const DataSize) +void ReadItemString(std::istream& iStrm, std::string& str, const DataSize) //-------------------------------------------------------------------- { // bits 0,1: Bytes per char type: 1,2,3,4. @@ -166,7 +190,17 @@ Binaryread(iStrm, id, 1); const uint8 nSizeBytes = (id & 12) >> 2; // 12 == 1100b if (nSizeBytes > 0) - iStrm.read(reinterpret_cast<char*>(&id) + 1, MIN(3, nSizeBytes)); + { + uint8 bytes = MIN(3, nSizeBytes); + uint8 v2 = 0; + uint8 v3 = 0; + uint8 v4 = 0; + if(bytes >= 1) Binaryread(iStrm, v2); + if(bytes >= 2) Binaryread(iStrm, v3); + if(bytes >= 3) Binaryread(iStrm, v4); + id &= 0xff; + id |= (v2 << 8) | (v3 << 16) | (v4 << 24); + } // Limit to 1 MB. str.resize(MIN(id >> 4, 1000000)); for(size_t i = 0; i < str.size(); i++) @@ -178,15 +212,15 @@ } -String IdToString(const void* const pvId, const size_t nLength) +std::string IdToString(const char* const pvId, const size_t nLength) //------------------------------------------------------------- { const char* pId = static_cast<const char*>(pvId); if (nLength == 0) return ""; - String str; + std::string str; if (IsPrintableId(pId, nLength)) - std::copy(pId, pId + nLength, std::back_inserter<String>(str)); + std::copy(pId, pId + nLength, std::back_inserter<std::string>(str)); else if (nLength <= 4) // Interpret ID as integer value. { int32 val = 0; @@ -246,21 +280,21 @@ m_posMapStart(0) \ -Ssb::Ssb(InStream* pIstrm, OutStream* pOstrm) : +Ssb::Ssb(std::istream* pIstrm, std::ostream* pOstrm) : m_pOstrm(pOstrm), m_pIstrm(pIstrm), SSB_INITIALIZATION_LIST //----------------------------------------------- {} -Ssb::Ssb(IoStream& ioStrm) : +Ssb::Ssb(std::iostream& ioStrm) : m_pOstrm(&ioStrm), m_pIstrm(&ioStrm), SSB_INITIALIZATION_LIST //------------------------------ {} -Ssb::Ssb(OutStream& oStrm) : +Ssb::Ssb(std::ostream& oStrm) : m_pOstrm(&oStrm), m_pIstrm(nullptr), SSB_INITIALIZATION_LIST @@ -268,7 +302,7 @@ {} -Ssb::Ssb(InStream& iStrm) : +Ssb::Ssb(std::istream& iStrm) : m_pOstrm(nullptr), m_pIstrm(&iStrm), SSB_INITIALIZATION_LIST @@ -308,7 +342,7 @@ // Called after writing an entry. -void Ssb::AddWriteNote(const void* pId, const size_t nIdSize, const NumType nEntryNum, const DataSize nBytecount, const RposType rposStart) +void Ssb::AddWriteNote(const char* pId, const size_t nIdSize, const NumType nEntryNum, const DataSize nBytecount, const RposType rposStart) //---------------------------------------------------------------------------- { m_Status |= SNT_PROGRESS; @@ -331,7 +365,7 @@ } -void Ssb::WriteMapItem( const void* pId, +void Ssb::WriteMapItem( const char* pId, const size_t nIdSize, const RposType& rposDataStart, const DataSize& nDatasize, @@ -353,7 +387,7 @@ WriteAdaptive12(m_MapStream, static_cast<uint16>(nIdSize)); if(nIdSize > 0) - m_MapStream.write(reinterpret_cast<const char*>(pId), static_cast<Streamsize>(nIdSize)); + m_MapStream.write(pId, nIdSize); } if (GetFlag(RwfWMapStartPosEntry)) //Startpos @@ -361,14 +395,14 @@ if (GetFlag(RwfWMapSizeEntry)) //Entrysize WriteAdaptive1248(m_MapStream, nDatasize); if (GetFlag(RwfWMapDescEntry)) //Entry descriptions - WriteAdaptive12String(m_MapStream, String(pszDesc)); + WriteAdaptive12String(m_MapStream, std::string(pszDesc)); } void Ssb::ReserveMapSize(uint32 nSize) //------------------------------------ { - OutStream& oStrm = *m_pOstrm; + std::ostream& oStrm = *m_pOstrm; m_nMapReserveSize = nSize; if (nSize > 0) { @@ -399,7 +433,7 @@ } -Ssb* Ssb::CreateReadSubEntry(const void* pId, const size_t nLength) +Ssb* Ssb::CreateReadSubEntry(const char* pId, const size_t nLength) //----------------------------------------------------------------- { const ReadEntry* pE = Find(pId, nLength); @@ -431,7 +465,7 @@ } -void Ssb::ReleaseWriteSubEntry(const void* pId, const size_t nIdLength) +void Ssb::ReleaseWriteSubEntry(const char* pId, const size_t nIdLength) //--------------------------------------------------------------------- { if ((m_pSubEntry->m_Status & SNT_FAILURE) != 0) @@ -443,10 +477,10 @@ } -void Ssb::BeginWrite(const void* pId, const size_t nIdSize, const uint64& nVersion) +void Ssb::BeginWrite(const char* pId, const size_t nIdSize, const uint64& nVersion) //--------------------------------------------------------------------------------- { - OutStream& oStrm = *m_pOstrm; + std::ostream& oStrm = *m_pOstrm; if (m_fpLogFunc) m_fpLogFunc(tstrWriteHeader, IdToString(pId, nIdSize).c_str()); @@ -465,7 +499,7 @@ { uint8 idsize = static_cast<uint8>(nIdSize); Binarywrite<uint8>(oStrm, idsize); - if(idsize > 0) oStrm.write(reinterpret_cast<const char*>(pId), nIdSize); + if(idsize > 0) oStrm.write(pId, nIdSize); } // Form header. @@ -522,7 +556,7 @@ } -Ssb::ReadRv Ssb::OnReadEntry(const ReadEntry* pE, const void* pId, const size_t nIdSize, const Postype& posReadBegin) +Ssb::ReadRv Ssb::OnReadEntry(const ReadEntry* pE, const char* pId, const size_t nIdSize, const Postype& posReadBegin) //------------------------------------------------------------------------------------------------------------------- { if (pE != nullptr) @@ -545,7 +579,7 @@ } -void Ssb::OnWroteItem(const void* pId, const size_t nIdSize, const Postype& posBeforeWrite) +void Ssb::OnWroteItem(const char* pId, const size_t nIdSize, const Postype& posBeforeWrite) //----------------------------------------------------------------------------------------- { const Offtype nRawEntrySize = m_pOstrm->tellp() - posBeforeWrite; @@ -579,7 +613,7 @@ } -void Ssb::CompareId(InStream& iStrm, const void* pId, const size_t nIdlength) +void Ssb::CompareId(std::istream& iStrm, const char* pId, const size_t nIdlength) //--------------------------------------------------------------------------- { uint8 tempU8 = 0; @@ -598,10 +632,10 @@ } -void Ssb::BeginRead(const void* pId, const size_t nLength, const uint64& nVersion) +void Ssb::BeginRead(const char* pId, const size_t nLength, const uint64& nVersion) //--------------------------------------------------------------------------------- { - InStream& iStrm = *m_pIstrm; + std::istream& iStrm = *m_pIstrm; if (m_fpLogFunc) m_fpLogFunc(tstrReadingHeader, IdToString(pId, nLength).c_str()); @@ -616,7 +650,7 @@ // Start bytes. { char temp[sizeof(s_EntryID)]; - Binaryread<char[sizeof(s_EntryID)]>(iStrm, temp); + ArrayReader<char>(sizeof(s_EntryID))(iStrm, temp, sizeof(s_EntryID)); if (memcmp(temp, s_EntryID, sizeof(s_EntryID))) { AddReadNote(SNR_STARTBYTE_MISMATCH); @@ -746,7 +780,7 @@ void Ssb::CacheMap() //------------------ { - InStream& iStrm = *m_pIstrm; + std::istream& iStrm = *m_pIstrm; if(GetFlag(RwfRwHasMap) || m_nFixedEntrySize > 0) { iStrm.seekg(m_posStart + m_rposMapBegin); @@ -837,7 +871,7 @@ } -const ReadEntry* Ssb::Find(const void* pId, const size_t nIdLength) +const ReadEntry* Ssb::Find(const char* pId, const size_t nIdLength) //----------------------------------------------------------------- { m_pIstrm->clear(); @@ -870,7 +904,7 @@ void Ssb::FinishWrite() //--------------------- { - OutStream& oStrm = *m_pOstrm; + std::ostream& oStrm = *m_pOstrm; const Postype posDataEnd = oStrm.tellp(); std::string mapStreamStr = m_MapStream.str(); if (m_posMapStart != Postype(0) && ((uint32)mapStreamStr.length() > m_nMapReserveSize)) Modified: trunk/OpenMPT/common/serialization_utils.h =================================================================== --- trunk/OpenMPT/common/serialization_utils.h 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/common/serialization_utils.h 2013-06-21 14:40:59 UTC (rev 2398) @@ -26,14 +26,8 @@ namespace srlztn //SeRiaLiZaTioN { -typedef std::ostream OutStream; -typedef std::istream InStream; -typedef std::iostream IoStream; -typedef std::istringstream IstrStream; -typedef std::ostringstream OstrStream; -typedef OutStream::off_type Offtype; +typedef std::ostream::off_type Offtype; typedef Offtype Postype; -typedef std::streamsize Streamsize; typedef uintptr_t DataSize; // Data size type. typedef uintptr_t RposType; // Relative position type. @@ -41,8 +35,6 @@ const DataSize invalidDatasize = DataSize(-1); -typedef std::basic_string<TCHAR> String; - enum { SNT_PROGRESS = 0x80000000, // = 1 << 31 @@ -79,9 +71,9 @@ SNW_INSUFFICIENT_DATASIZETYPE = (0x16) | SNT_FAILURE }; -bool IsPrintableId(const void* pvId, const size_t nLength); // Return true if given id is printable, false otherwise. -void ReadAdaptive1248(InStream& iStrm, uint64& val); -void WriteAdaptive1248(OutStream& oStrm, const uint64& val); +bool IsPrintableId(const char* pvId, const size_t nLength); // Return true if given id is printable, false otherwise. +void ReadAdaptive1248(std::istream& iStrm, uint64& val); +void WriteAdaptive1248(std::ostream& oStrm, const uint64& val); enum { @@ -124,22 +116,42 @@ template<class T> -inline void Binarywrite(OutStream& oStrm, const T& data) +inline void Binarywrite(std::ostream& oStrm, const T& data) //------------------------------------------------------ { - oStrm.write(reinterpret_cast<const char*>(&data), sizeof(data)); + union { + T t; + char b[sizeof(T)]; + } conv; + STATIC_ASSERT(sizeof(conv) == sizeof(T)); + STATIC_ASSERT(sizeof(conv.b) == sizeof(T)); + conv.t = data; + #ifdef PLATFORM_BIG_ENDIAN + std::reverse(conv.b, conv.b+sizeof(T)); + #endif + oStrm.write(conv.b, sizeof(data)); } //Write only given number of bytes from the beginning. template<class T> -inline void Binarywrite(OutStream& oStrm, const T& data, const Offtype bytecount) +inline void Binarywrite(std::ostream& oStrm, const T& data, const Offtype bytecount) //-------------------------------------------------------------------------- { - oStrm.write(reinterpret_cast<const char*>(&data), MIN(bytecount, sizeof(data))); + union { + T t; + char b[sizeof(T)]; + } conv; + STATIC_ASSERT(sizeof(conv) == sizeof(T)); + STATIC_ASSERT(sizeof(conv.b) == sizeof(T)); + conv.t = data; + #ifdef PLATFORM_BIG_ENDIAN + std::reverse(conv.b, conv.b+sizeof(T)); + #endif + oStrm.write(conv.b, MIN(bytecount, sizeof(data))); } template <class T> -inline void WriteItem(OutStream& oStrm, const T& data) +inline void WriteItem(std::ostream& oStrm, const T& data) //---------------------------------------------------- { #ifdef HAS_TYPE_TRAITS @@ -148,37 +160,57 @@ Binarywrite(oStrm, data); } -void WriteItemString(OutStream& oStrm, const char* const pStr, const size_t nSize); +void WriteItemString(std::ostream& oStrm, const char* const pStr, const size_t nSize); template <> -inline void WriteItem<std::string>(OutStream& oStrm, const std::string& str) {WriteItemString(oStrm, str.c_str(), str.length());} +inline void WriteItem<std::string>(std::ostream& oStrm, const std::string& str) {WriteItemString(oStrm, str.c_str(), str.length());} template <> -inline void WriteItem<LPCSTR>(OutStream& oStrm, const LPCSTR& psz) {WriteItemString(oStrm, psz, strlen(psz));} +inline void WriteItem<LPCSTR>(std::ostream& oStrm, const LPCSTR& psz) {WriteItemString(oStrm, psz, strlen(psz));} template<class T> -inline void Binaryread(InStream& iStrm, T& data) +inline void Binaryread(std::istream& iStrm, T& data) //---------------------------------------------- { - iStrm.read(reinterpret_cast<char*>(&data), sizeof(T)); + union { + T t; + char b[sizeof(T)]; + } conv; + STATIC_ASSERT(sizeof(conv) == sizeof(T)); + STATIC_ASSERT(sizeof(conv.b) == sizeof(T)); + iStrm.read(conv.b, sizeof(T)); + #ifdef PLATFORM_BIG_ENDIAN + std::reverse(conv.b, conv.b+sizeof(T)); + #endif + data = conv.t; } //Read only given number of bytes to the beginning of data; data bytes are memset to 0 before reading. template <class T> -inline void Binaryread(InStream& iStrm, T& data, const Offtype bytecount) +inline void Binaryread(std::istream& iStrm, T& data, const Offtype bytecount) //----------------------------------------------------------------------- { #ifdef HAS_TYPE_TRAITS static_assert(std::is_trivial<T>::value == true, ""); #endif - memset(&data, 0, sizeof(data)); - iStrm.read(reinterpret_cast<char*>(&data), (std::min)((size_t)bytecount, sizeof(data))); + union { + T t; + char b[sizeof(T)]; + } conv; + STATIC_ASSERT(sizeof(conv) == sizeof(T)); + STATIC_ASSERT(sizeof(conv.b) == sizeof(T)); + memset(conv.b, 0, sizeof(T)); + iStrm.read(conv.b, (std::min)((size_t)bytecount, sizeof(data))); + #ifdef PLATFORM_BIG_ENDIAN + std::reverse(conv.b, conv.b+sizeof(T)); + #endif + data = conv.t; } template <class T> -inline void ReadItem(InStream& iStrm, T& data, const DataSize nSize) +inline void ReadItem(std::istream& iStrm, T& data, const DataSize nSize) //------------------------------------------------------------------ { #ifdef HAS_TYPE_TRAITS @@ -192,7 +224,7 @@ // Read specialization for float. If data size is 8, read double and assign it to given float. template <> -inline void ReadItem<float>(InStream& iStrm, float& f, const DataSize nSize) +inline void ReadItem<float>(std::istream& iStrm, float& f, const DataSize nSize) //-------------------------------------------------------------------------- { if (nSize == 8) @@ -207,7 +239,7 @@ // Read specialization for double. If data size is 4, read float and assign it to given double. template <> -inline void ReadItem<double>(InStream& iStrm, double& d, const DataSize nSize) +inline void ReadItem<double>(std::istream& iStrm, double& d, const DataSize nSize) //---------------------------------------------------------------------------- { if (nSize == 4) @@ -220,10 +252,10 @@ Binaryread(iStrm, d); } -void ReadItemString(InStream& iStrm, std::string& str, const DataSize); +void ReadItemString(std::istream& iStrm, std::string& str, const DataSize); template <> -inline void ReadItem<std::string>(InStream& iStrm, std::string& str, const DataSize nSize) +inline void ReadItem<std::string>(std::istream& iStrm, std::string& str, const DataSize nSize) //---------------------------------------------------------------------------------------- { ReadItemString(iStrm, str, nSize); @@ -247,10 +279,10 @@ }; typedef std::vector<ReadEntry>::const_iterator ReadIterator; - Ssb(InStream* pIstrm, OutStream* pOstrm); - Ssb(IoStream& ioStrm); - Ssb(OutStream& oStrm); - Ssb(InStream& iStrm); + Ssb(std::istream* pIstrm, std::ostream* pOstrm); + Ssb(std::iostream& ioStrm); + Ssb(std::ostream& oStrm); + Ssb(std::istream& iStrm); ~Ssb() {delete m_pSubEntry;} @@ -258,12 +290,12 @@ void SetIdSize(uint16 idSize); // Write header - void BeginWrite(const void* pId, const size_t nIdSize, const uint64& nVersion); - void BeginWrite(const LPCSTR pszId, const uint64& nVersion) {BeginWrite(pszId, strlen(pszId), nVersion);} + void BeginWrite(const char* pId, const size_t nIdSize, const uint64& nVersion); + void BeginWrite(const char* pszId, const uint64& nVersion) {BeginWrite(pszId, strlen(pszId), nVersion);} // Call this to begin reading: must be called before other read functions. - void BeginRead(const void* pId, const size_t nLength, const uint64& nVersion); - void BeginRead(const LPCSTR pszId, const uint64& nVersion) {return BeginRead(pszId, strlen(pszId), nVersion);} + void BeginRead(const char* pId, const size_t nLength, const uint64& nVersion); + void BeginRead(const char* pszId, const uint64& nVersion) {return BeginRead(pszId, strlen(pszId), nVersion);} // Reserves space for map to current position. Call after BeginWrite and before writing any entries. void ReserveMapSize(uint32 nSize); @@ -278,13 +310,13 @@ Ssb& SubEntry() {return *m_pSubEntry;} // Releases write subentry and writes corresponding map information. - void ReleaseWriteSubEntry(const void* pId, const size_t nIdLength); - void ReleaseWriteSubEntry(const LPCSTR pszId) {ReleaseWriteSubEntry(pszId, strlen(pszId));} + void ReleaseWriteSubEntry(const char* pId, const size_t nIdLength); + void ReleaseWriteSubEntry(const char* pszId) {ReleaseWriteSubEntry(pszId, strlen(pszId));} // If ID was found, returns pointer to Ssb object, nullptr if not found. // Note: All reading on subentry must be done before calling ReadItem with 'this'. - Ssb* CreateReadSubEntry(const void* pId, const size_t nLength); - Ssb* CreateReadSubEntry(const LPCSTR pszId) {return CreateReadSubEntry(pszId, strlen(pszId));} + Ssb* CreateReadSubEntry(const char* pId, const size_t nLength); + Ssb* CreateReadSubEntry(const char* pszId) {return CreateReadSubEntry(pszId, strlen(pszId));} // After calling BeginRead(), this returns number of entries in the file. NumType GetNumEntries() const {return m_nReadEntrycount;} @@ -298,8 +330,8 @@ ReadIterator GetReadEnd(); // Compares given id with read entry id - IdMatchStatus CompareId(const ReadIterator& iter, LPCSTR pszId) {return CompareId(iter, pszId, strlen(pszId));} - IdMatchStatus CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize); + IdMatchStatus CompareId(const ReadIterator& iter, const char* pszId) {return CompareId(iter, pszId, strlen(pszId));} + IdMatchStatus CompareId(const ReadIterator& iter, const char* pId, const size_t nIdSize); // When writing, returns the number of entries written. // When reading, returns the number of entries read not including unrecognized entries. @@ -309,14 +341,14 @@ // Read item using default read implementation. template <class T> - ReadRv ReadItem(T& obj, const LPCSTR pszId) {return ReadItem(obj, pszId, strlen(pszId), srlztn::ReadItem<T>);} + ReadRv ReadItem(T& obj, const char* pszId) {return ReadItem(obj, pszId, strlen(pszId), srlztn::ReadItem<T>);} template <class T> - ReadRv ReadItem(T& obj, const void* pId, const size_t nIdSize) {return ReadItem(obj, pId, nIdSize, srlztn::ReadItem<T>);} + ReadRv ReadItem(T& obj, const char* pId, const size_t nIdSize) {return ReadItem(obj, pId, nIdSize, srlztn::ReadItem<T>);} // Read item using given function. template <class T, class FuncObj> - ReadRv ReadItem(T& obj, const void* pId, const size_t nIdSize, FuncObj); + ReadRv ReadItem(T& obj, const char* pId, const size_t nIdSize, FuncObj); // Read item using read iterator. template <class T> @@ -326,14 +358,14 @@ // Write item using default write implementation. template <class T> - void WriteItem(const T& obj, const LPCSTR pszId) {WriteItem(obj, pszId, strlen(pszId), &srlztn::WriteItem<T>);} + void WriteItem(const T& obj, const char* pszId) {WriteItem(obj, pszId, strlen(pszId), &srlztn::WriteItem<T>);} template <class T> - void WriteItem(const T& obj, const void* pId, const size_t nIdSize) {WriteItem(obj, pId, nIdSize, &srlztn::WriteItem<T>);} + void WriteItem(const T& obj, const char* pId, const size_t nIdSize) {WriteItem(obj, pId, nIdSize, &srlztn::WriteItem<T>);} // Write item using given function. template <class T, class FuncObj> - void WriteItem(const T& obj, const void* pId, const size_t nIdSize, FuncObj); + void WriteItem(const T& obj, const char* pId, const size_t nIdSize, FuncObj); // Writes mapping. void FinishWrite(); @@ -349,18 +381,18 @@ void CacheMap(); // Compares ID in file with expected ID. - void CompareId(InStream& iStrm, const void* pId, const size_t nLength); + void CompareId(std::istream& iStrm, const char* pId, const size_t nLength); // Searches for entry with given ID. If found, returns pointer to corresponding entry, else // returns nullptr. - const ReadEntry* Find(const void* pId, const size_t nLength); - const ReadEntry* Find(const LPCSTR pszId) {return Find(pszId, strlen(pszId));} + const ReadEntry* Find(const char* pId, const size_t nLength); + const ReadEntry* Find(const char* pszId) {return Find(pszId, strlen(pszId));} // Called after reading an object. - ReadRv OnReadEntry(const ReadEntry* pE, const void* pId, const size_t nIdSize, const Postype& posReadBegin); + ReadRv OnReadEntry(const ReadEntry* pE, const char* pId, const size_t nIdSize, const Postype& posReadBegin); // Called after writing an item. - void OnWroteItem(const void* pId, const size_t nIdSize, const Postype& posBeforeWrite); + void OnWroteItem(const char* pId, const size_t nIdSize, const Postype& posBeforeWrite); void AddNote(const SsbStatus s, const SsbStatus mask, const TCHAR* sz); @@ -370,14 +402,14 @@ void AddReadNote(const ReadEntry* const pRe, const NumType nNum); void AddWriteNote(const SsbStatus s); - void AddWriteNote(const void* pId, + void AddWriteNote(const char* pId, const size_t nIdLength, const NumType nEntryNum, const DataSize nBytecount, const RposType rposStart); // Writes mapping item to mapstream. - void WriteMapItem(const void* pId, + void WriteMapItem(const char* pId, const size_t nIdSize, const RposType& rposDataStart, const DataSize& nDatasize, @@ -390,8 +422,8 @@ private: - OutStream* m_pOstrm; // Write: Pointer to write stream. - InStream* m_pIstrm; // Read: Pointer to read stream. + std::ostream* m_pOstrm; // Write: Pointer to write stream. + std::istream* m_pIstrm; // Read: Pointer to read stream. public: @@ -427,7 +459,7 @@ Postype m_posEntrycount; // Write: Pos of entrycount field. Postype m_posMapPosField; // Write: Pos of map position field. Postype m_posMapStart; // Write: Pos of map start. - OstrStream m_MapStream; // Write: Map stream. + std::ostringstream m_MapStream; // Write: Map stream. public: static const uint8 s_DefaultFlagbyte = 0; @@ -440,9 +472,29 @@ (1 << RwfRPartialIdMatch); }; +template<typename T> +struct IdLE +{ + union { + char b[sizeof(T)]; + T t; + } conv; + IdLE(T val) + { + conv.t = val; + #ifdef PLATFORM_BIG_ENDIAN + std::reverse(conv.b, conv.b+sizeof(T)); + #endif + } + const char* GetChars() const + { + return conv.b; + } +}; + template <class T, class FuncObj> -void Ssb::WriteItem(const T& obj, const void* pId, const size_t nIdSize, FuncObj Func) +void Ssb::WriteItem(const T& obj, const char* pId, const size_t nIdSize, FuncObj Func) //------------------------------------------------------------------------------------ { const Postype pos = m_pOstrm->tellp(); @@ -451,7 +503,7 @@ } template <class T, class FuncObj> -Ssb::ReadRv Ssb::ReadItem(T& obj, const void* pId, const size_t nIdSize, FuncObj Func) +Ssb::ReadRv Ssb::ReadItem(T& obj, const char* pId, const size_t nIdSize, FuncObj Func) //------------------------------------------------------------------------------------ { const ReadEntry* pE = Find(pId, nIdSize); @@ -475,7 +527,7 @@ } -inline Ssb::IdMatchStatus Ssb::CompareId(const ReadIterator& iter, const void* pId, const size_t nIdSize) +inline Ssb::IdMatchStatus Ssb::CompareId(const ReadIterator& iter, const char* pId, const size_t nIdSize) //------------------------------------------------------------------------------------------------------- { if (nIdSize == iter->nIdLength && memcmp(&m_Idarray[iter->nIdpos], pId, iter->nIdLength) == 0) @@ -509,7 +561,12 @@ //================ { ArrayWriter(size_t nCount) : m_nCount(nCount) {} - void operator()(srlztn::OutStream& oStrm, const T* pData) {oStrm.write(reinterpret_cast<const char*>(pData), m_nCount * sizeof(T));} + void operator()(std::ostream& oStrm, const T* pData) { + for(std::size_t i=0; i<m_nCount; ++i) + { + Binarywrite(oStrm, pData[i]); + } + } size_t m_nCount; }; @@ -518,13 +575,15 @@ //================ { ArrayReader(size_t nCount) : m_nCount(nCount) {} - void operator()(srlztn::InStream& iStrm, T* pData, const size_t) {iStrm.read(reinterpret_cast<char*>(pData), m_nCount * sizeof(T));} + void operator()(std::istream& iStrm, T* pData, const size_t) { + for(std::size_t i=0; i<m_nCount; ++i) + { + Binaryread(iStrm, pData[i]); + } + } size_t m_nCount; }; -} //namespace srlztn. - - template<class SIZETYPE> bool StringToBinaryStream(std::ostream& oStrm, const std::string& str) //-------------------------------------------------------------------- @@ -532,7 +591,7 @@ if(!oStrm.good()) return true; if((std::numeric_limits<SIZETYPE>::max)() < str.size()) return true; SIZETYPE size = static_cast<SIZETYPE>(str.size()); - oStrm.write(reinterpret_cast<char*>(&size), sizeof(size)); + Binarywrite(oStrm, size); oStrm.write(str.c_str(), size); if(oStrm.good()) return false; else return true; @@ -545,7 +604,7 @@ { if(!iStrm.good()) return true; SIZETYPE strSize; - iStrm.read(reinterpret_cast<char*>(&strSize), sizeof(strSize)); + Binaryread(iStrm, strSize); if(strSize > maxSize) return true; str.resize(strSize); @@ -554,3 +613,6 @@ if(iStrm.good()) return false; else return true; } + + +} //namespace srlztn. Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -102,9 +102,9 @@ for(TNTS_MAP_ITER iter = tNameToShort_Map.begin(); iter != tNameToShort_Map.end(); iter++) { if(iter->first) - StringToBinaryStream<uint8>(oStrm, iter->first->GetName()); + srlztn::StringToBinaryStream<uint8>(oStrm, iter->first->GetName()); else //Case: Using original IT tuning. - StringToBinaryStream<uint8>(oStrm, "->MPT_ORIGINAL_IT<-"); + srlztn::StringToBinaryStream<uint8>(oStrm, "->MPT_ORIGINAL_IT<-"); srlztn::Binarywrite<uint16>(oStrm, iter->second); } @@ -143,7 +143,7 @@ { string temp; uint16 ui; - if(StringFromBinaryStream<STRSIZETYPE>(iStrm, temp, 255)) + if(srlztn::StringFromBinaryStream<STRSIZETYPE>(iStrm, temp, 255)) return true; iStrm.read(reinterpret_cast<char*>(&ui), sizeof(ui)); Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -838,9 +838,9 @@ for(uint8 i = 0; i < nSeqs; i++) { if (i == seq.GetCurrentSequenceIndex()) - ssb.WriteItem(seq, &i, sizeof(i), &WriteModSequence); + ssb.WriteItem(seq, srlztn::IdLE<uint8>(i).GetChars(), sizeof(i), &WriteModSequence); else - ssb.WriteItem(seq.m_Sequences[i], &i, sizeof(i), &WriteModSequence); + ssb.WriteItem(seq.m_Sequences[i], srlztn::IdLE<uint8>(i).GetChars(), sizeof(i), &WriteModSequence); } ssb.FinishWrite(); } @@ -864,7 +864,9 @@ seq.m_Sequences.resize(nSeqs, ModSequence(seq.m_sndFile, seq.s_nCacheSize)); for(uint8 i = 0; i < nSeqs; i++) - ssb.ReadItem(seq.m_Sequences[i], &i, sizeof(i), &ReadModSequence); + { + ssb.ReadItem(seq.m_Sequences[i], srlztn::IdLE<uint8>(i).GetChars(), sizeof(i), &ReadModSequence); + } seq.m_nCurrentSeq = (nCurrent < seq.GetNumSequences()) ? nCurrent : 0; seq.CopyStorageToCache(); } Modified: trunk/OpenMPT/soundlib/patternContainer.cpp =================================================================== --- trunk/OpenMPT/soundlib/patternContainer.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/patternContainer.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -201,7 +201,7 @@ uint16 nCount = 0; for(uint16 i = 0; i < nPatterns; i++) if (patc[i]) { - ssb.WriteItem(patc[i], &i, sizeof(i), &WriteModPattern); + ssb.WriteItem(patc[i], srlztn::IdLE<uint16>(i).GetChars(), sizeof(i), &WriteModPattern); nCount = i + 1; } ssb.WriteItem<uint16>(nCount, "num"); // Index of last pattern + 1. @@ -225,7 +225,7 @@ patc.ResizeArray(nPatterns); for(uint16 i = 0; i < nPatterns; i++) { - ssb.ReadItem(patc[i], &i, sizeof(i), &ReadModPattern); + ssb.ReadItem(patc[i], srlztn::IdLE<uint16>(i).GetChars(), sizeof(i), &ReadModPattern); } } Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/tuning.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -27,19 +27,19 @@ namespace CTuningS11n { - void ReadStr(srlztn::InStream& iStrm, std::string& str, const size_t); - void ReadNoteMap(srlztn::InStream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); - void ReadRatioTable(srlztn::InStream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t); + void ReadStr(std::istream& iStrm, std::string& str, const size_t); + void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); + void ReadRatioTable(std::istream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t); - void WriteNoteMap(srlztn::OutStream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); - void WriteStr(srlztn::OutStream& oStrm, const std::string& str); + void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); + void WriteStr(std::ostream& oStrm, const std::string& str); struct RatioWriter //================ { RatioWriter(uint16 nWriteCount = s_nDefaultWriteCount) : m_nWriteCount(nWriteCount) {} - void operator()(srlztn::OutStream& oStrm, const std::vector<float>& v); + void operator()(std::ostream& oStrm, const std::vector<float>& v); uint16 m_nWriteCount; static const uint16 s_nDefaultWriteCount = (uint16_max >> 2); }; @@ -509,7 +509,7 @@ namespace CTuningS11n { -void RatioWriter::operator()(srlztn::OutStream& oStrm, const std::vector<float>& v) +void RatioWriter::operator()(std::ostream& oStrm, const std::vector<float>& v) //--------------------------------------------------------------------------------- { const size_t nWriteCount = MIN(v.size(), m_nWriteCount); @@ -519,7 +519,7 @@ } -void ReadNoteMap(srlztn::InStream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t) +void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t) //---------------------------------------------------------------------------------- { uint64 val; @@ -530,13 +530,13 @@ int16 key; srlztn::Binaryread<int16>(iStrm, key); std::string str; - StringFromBinaryStream<uint8>(iStrm, str); + srlztn::StringFromBinaryStream<uint8>(iStrm, str); m[key] = str; } } -void ReadRatioTable(srlztn::InStream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t) +void ReadRatioTable(std::istream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t) //------------------------------------------------------------------------------------------ { uint64 val; @@ -547,7 +547,7 @@ } -void ReadStr(srlztn::InStream& iStrm, std::string& str, const size_t) +void ReadStr(std::istream& iStrm, std::string& str, const size_t) //------------------------------------------------------------------- { uint64 val; @@ -559,7 +559,7 @@ } -void WriteNoteMap(srlztn::OutStream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m) +void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m) //--------------------------------------------------------------------------- { srlztn::WriteAdaptive1248(oStrm, m.size()); @@ -568,12 +568,12 @@ for(; iter != end; iter++) { srlztn::Binarywrite<int16>(oStrm, iter->first); - StringToBinaryStream<uint8>(oStrm, iter->second); + srlztn::StringToBinaryStream<uint8>(oStrm, iter->second); } } -void WriteStr(srlztn::OutStream& oStrm, const std::string& str) +void WriteStr(std::ostream& oStrm, const std::string& str) //----------------------------------------------------------------- { srlztn::WriteAdaptive1248(oStrm, str.size()); Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -33,15 +33,15 @@ namespace CTuningS11n { - void WriteNoteMap(srlztn::OutStream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); - void ReadStr(srlztn::InStream& iStrm, std::string& str, const size_t); + void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); + void ReadStr(std::istream& iStrm, std::string& str, const size_t); - void ReadNoteMap(srlztn::InStream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); - void ReadRatioTable(srlztn::InStream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t); - void WriteStr(srlztn::OutStream& oStrm, const std::string& str); + void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); + void ReadRatioTable(std::istream& iStrm, vector<CTuningRTI::RATIOTYPE>& v, const size_t); + void WriteStr(std::ostream& oStrm, const std::string& str); void ReadTuning(istream& iStrm, CTuningCollection& Tc, const size_t) {Tc.AddTuning(iStrm, true);} - void WriteTuning(srlztn::OutStream& oStrm, const CTuning& t) {t.Serialize(oStrm);} + void WriteTuning(std::ostream& oStrm, const CTuning& t) {t.Serialize(oStrm);} } // namespace CTuningS11n using namespace CTuningS11n; @@ -215,12 +215,12 @@ //3. Name if(version < 2) { - if(StringFromBinaryStream<uint32>(inStrm, m_Name, 256)) + if(srlztn::StringFromBinaryStream<uint32>(inStrm, m_Name, 256)) return false; } else { - if(StringFromBinaryStream<uint8>(inStrm, m_Name)) + if(srlztn::StringFromBinaryStream<uint8>(inStrm, m_Name)) return false; } Modified: trunk/OpenMPT/soundlib/tuningbase.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.cpp 2013-06-21 11:26:46 UTC (rev 2397) +++ trunk/OpenMPT/soundlib/tuningbase.cpp 2013-06-21 14:40:59 UTC (rev 2398) @@ -438,7 +438,7 @@ if(version != 4) return SERIALIZATION_FAILURE; //Tuning name - if(StringFromBinaryStream<uint8>(inStrm, m_TuningName)) + if(srlztn::StringFromBinaryStream<uint8>(inStrm, m_TuningName)) return SERIALIZATION_FAILURE; //Const mask @@ -459,7 +459,7 @@ NOTEINDEXTYPE n; string str; inStrm.read(reinterpret_cast<char*>(&n), sizeof(n)); - if(StringFromBinaryStream<uint8>(inStrm, str)) + if(srlztn::StringFromBinaryStream<uint8>(inStrm, str)) return SERIALIZATION_FAILURE; m_NoteNameMap[n] = str; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-21 16:47:31
|
Revision: 2399 http://sourceforge.net/p/modplug/code/2399 Author: manxorist Date: 2013-06-21 16:47:24 +0000 (Fri, 21 Jun 2013) Log Message: ----------- [Fix] Make LoadExtendedSongProperties work on big-endian. Modified Paths: -------------- trunk/OpenMPT/common/FlagSet.h trunk/OpenMPT/soundlib/FileReader.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/common/FlagSet.h =================================================================== --- trunk/OpenMPT/common/FlagSet.h 2013-06-21 14:40:59 UTC (rev 2398) +++ trunk/OpenMPT/common/FlagSet.h 2013-06-21 16:47:24 UTC (rev 2399) @@ -148,6 +148,16 @@ return *this; } + store_t GetRaw() const + { + return flags; + } + + void SetRaw(store_t flags_) + { + flags = flags_; + } + private: store_t flags; Modified: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2013-06-21 14:40:59 UTC (rev 2398) +++ trunk/OpenMPT/soundlib/FileReader.h 2013-06-21 16:47:24 UTC (rev 2399) @@ -641,6 +641,31 @@ return SwapBytesLE(target); } + // Read a supplied-size little endian integer to a fixed size variable. + // The data is properly sign-extended when fewer bytes are stored. + // If more bytes are stored, higher order bytes are silently ignored. + // If successful, the file cursor is advanced by the given size. + template <typename T> + T ReadSizedIntLE(off_t size) + { + static_assert(std::numeric_limits<T>::is_integer == true, "Target type is a not an integer"); + if(size == 0) + { + return 0; + } + if(!CanRead(size)) + { + return 0; + } + if(size < sizeof(T)) + { + return ReadTruncatedIntLE<T>(size); + } + T retval = ReadIntLE<T>(); + Skip(size - sizeof(T)); + return retval; + } + // Read unsigned 32-Bit integer in little-endian format. // If successful, the file cursor is advanced by the size of the integer. uint32 ReadUint32LE() Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-21 14:40:59 UTC (rev 2398) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-21 16:47:24 UTC (rev 2399) @@ -2138,6 +2138,31 @@ } +template<typename T> +void ReadField(FileReader &chunk, std::size_t size, T &field) +//----------------------------------------------------------- +{ + field = chunk.ReadSizedIntLE<T>(size); +} + + +template<typename Tenum, typename Tstore> +void ReadFieldFlagSet(FileReader &chunk, std::size_t size, FlagSet<Tenum, Tstore> &field) +//--------------------------------------------------------------------------------------- +{ + field.SetRaw(chunk.ReadSizedIntLE<Tstore>(size)); +} + + +template<typename T> +void ReadFieldCast(FileReader &chunk, std::size_t size, T &field) +//--------------------------------------------------------------- +{ + STATIC_ASSERT(sizeof(T) <= sizeof(int)); + field = static_cast<T>(chunk.ReadSizedIntLE<int>(size)); +} + + void CSoundFile::LoadExtendedSongProperties(const MODTYPE modtype, FileReader &file, bool *pInterpretMptMade) //----------------------------------------------------------------------------------------------------------- { @@ -2153,12 +2178,6 @@ // HACK: Reset mod flags to default values here, as they are not always written. m_ModFlags.reset(); - // Case macros. - #define CASE(id, data) \ - case id: fadr = reinterpret_cast<char *>(&data); maxReadCount = std::min(size_t(size), sizeof(data)); break; - #define CASE_NOTXM(id, data) \ - case id: if(modtype != MOD_TYPE_XM) { fadr = reinterpret_cast<char *>(&data); maxReadCount = std::min(size_t(size), sizeof(data));} break; - while(file.CanRead(7)) { const uint32 code = file.ReadUint32LE(); @@ -2169,25 +2188,23 @@ break; } - size_t maxReadCount = 0; - char *fadr = nullptr; FileReader chunk = file.GetChunk(size); switch (code) // interpret field code { - CASE(MULTICHAR4_LE_MSVC('D','T','.','.'), m_nDefaultTempo); - CASE(MULTICHAR4_LE_MSVC('R','P','B','.'), m_nDefaultRowsPerBeat); - CASE(MULTICHAR4_LE_MSVC('R','P','M','.'), m_nDefaultRowsPerMeasure); - CASE_NOTXM(MULTICHAR4_LE_MSVC('C','.','.','.'), m_nChannels); - CASE(MULTICHAR4_LE_MSVC('T','M','.','.'), m_nTempoMode); - CASE(MULTICHAR4_LE_MSVC('P','M','M','.'), m_nMixLevels); - CASE(MULTICHAR4_LE_MSVC('C','W','V','.'), m_dwCreatedWithVersion); - CASE(MULTICHAR4_LE_MSVC('L','S','W','V'), m_dwLastSavedWithVersion); - CASE(MULTICHAR4_LE_MSVC('S','P','A','.'), m_nSamplePreAmp); - CASE(MULTICHAR4_LE_MSVC('V','S','T','V'), m_nVSTiVolume); - CASE(MULTICHAR4_LE_MSVC('D','G','V','.'), m_nDefaultGlobalVolume); - CASE_NOTXM(MULTICHAR4_LE_MSVC('R','P','.','.'), m_nRestartPos); - CASE(MULTICHAR4_LE_MSVC('M','S','F','.'), m_ModFlags); + case MULTICHAR4_LE_MSVC('D','T','.','.'): ReadField(chunk, size, m_nDefaultTempo); break; + case MULTICHAR4_LE_MSVC('R','P','B','.'): ReadField(chunk, size, m_nDefaultRowsPerBeat); break; + case MULTICHAR4_LE_MSVC('R','P','M','.'): ReadField(chunk, size, m_nDefaultRowsPerMeasure); break; + case MULTICHAR4_LE_MSVC('C','.','.','.'): if(modtype != MOD_TYPE_XM) ReadField(chunk, size, m_nChannels); break; + case MULTICHAR4_LE_MSVC('T','M','.','.'): ReadField(chunk, size, m_nTempoMode); break; + case MULTICHAR4_LE_MSVC('P','M','M','.'): ReadFieldCast(chunk, size, m_nMixLevels); break; + case MULTICHAR4_LE_MSVC('C','W','V','.'): ReadField(chunk, size, m_dwCreatedWithVersion); break; + case MULTICHAR4_LE_MSVC('L','S','W','V'): ReadField(chunk, size, m_dwLastSavedWithVersion); break; + case MULTICHAR4_LE_MSVC('S','P','A','.'): ReadField(chunk, size, m_nSamplePreAmp); break; + case MULTICHAR4_LE_MSVC('V','S','T','V'): ReadField(chunk, size, m_nVSTiVolume); break; + case MULTICHAR4_LE_MSVC('D','G','V','.'): ReadField(chunk, size, m_nDefaultGlobalVolume); break; + case MULTICHAR4_LE_MSVC('R','P','.','.'): if(modtype != MOD_TYPE_XM) ReadField(chunk, size, m_nRestartPos); break; + case MULTICHAR4_LE_MSVC('M','S','F','.'): ReadFieldFlagSet(chunk, size, m_ModFlags); break; #ifdef MODPLUG_TRACKER case MULTICHAR4_LE_MSVC('M','I','M','A'): GetMIDIMapper().Deserialize(chunk.GetRawData(), size); break; #endif @@ -2216,11 +2233,6 @@ break; } - // Read field data - if(fadr != nullptr) - { - memcpy(fadr, chunk.GetRawData(), maxReadCount); - } } // Validate read values. @@ -2238,9 +2250,6 @@ //m_nRestartPos //m_ModFlags - - #undef CASE - #undef CASE_NOTXM } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-06-21 14:40:59 UTC (rev 2398) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-06-21 16:47:24 UTC (rev 2399) @@ -426,8 +426,8 @@ char m_szNames[MAX_SAMPLES][MAX_SAMPLENAME]; // Song and sample names std::bitset<MAX_BASECHANNELS> m_bChannelMuteTogglePending; - DWORD m_dwCreatedWithVersion; - DWORD m_dwLastSavedWithVersion; + uint32 m_dwCreatedWithVersion; + uint32 m_dwLastSavedWithVersion; #ifdef MODPLUG_TRACKER std::vector<PatternCuePoint> m_PatternCuePoints; // For WAV export (writing pattern positions to file) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-23 21:38:16
|
Revision: 2402 http://sourceforge.net/p/modplug/code/2402 Author: saga-games Date: 2013-06-23 21:38:01 +0000 (Sun, 23 Jun 2013) Log Message: ----------- [Fix] M15 modules with "hidden" patterns in their order list didn't play properly anymore (probably since v1.22.03, affected e.g. Bad Dudes soundtrack) [Mod] OpenMPT: Version is now 1.22.03.06 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Load_mod.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-23 06:03:07 UTC (rev 2401) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-23 21:38:01 UTC (rev 2402) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 05 +#define VER_MINORMINOR 06 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-23 06:03:07 UTC (rev 2401) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-23 21:38:01 UTC (rev 2402) @@ -791,6 +791,7 @@ } InitializeGlobals(); + m_nChannels = 4; STVersions minVersion = UST1_00; @@ -858,7 +859,7 @@ PATTERNINDEX numPatterns = GetNumPatterns(file, Order, fileHeader.numOrders, totalSampleLen, m_nChannels, false); // Let's see if the file is too small (including some overhead for broken files like sll7.mod) - if(file.BytesLeft() + 4096 < numPatterns * 64u * 4u + totalSampleLen) + if(file.BytesLeft() + 32767 < numPatterns * 64u * 4u + totalSampleLen) { return false; } @@ -870,12 +871,8 @@ // Now we can be pretty sure that this is a valid Soundtracker file. Set up default song settings. m_nType = MOD_TYPE_MOD; - m_nChannels = 4; - m_nInstruments = 0; - m_nDefaultSpeed = 6; // Sample 7 in echoing.mod won't "loop" correctly if we don't convert the VBlank tempo. m_nDefaultTempo = fileHeader.restartPos * 25 / 24; - m_nRestartPos = 0; if(fileHeader.restartPos != 0x78) { // Convert to CIA timing This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-25 18:48:27
|
Revision: 2405 http://sourceforge.net/p/modplug/code/2405 Author: manxorist Date: 2013-06-25 18:48:11 +0000 (Tue, 25 Jun 2013) Log Message: ----------- [Ref] Add msinttypes header files. [Ref] Add lhasa lha unpacker library. [Ref] Remove old unlha code. [Ref] Rewrite CLhaArchive to use lhasa. Modified Paths: -------------- trunk/OpenMPT/common/version.cpp trunk/OpenMPT/mptrack/MPTRACK_10.sln trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/FileReader.h trunk/OpenMPT/unarchiver/unarchiver.cpp trunk/OpenMPT/unarchiver/unlha.cpp trunk/OpenMPT/unarchiver/unlha.h Added Paths: ----------- trunk/OpenMPT/include/lhasa/ trunk/OpenMPT/include/lhasa/.gitignore trunk/OpenMPT/include/lhasa/AUTHORS trunk/OpenMPT/include/lhasa/COPYING trunk/OpenMPT/include/lhasa/ChangeLog trunk/OpenMPT/include/lhasa/Makefile.am trunk/OpenMPT/include/lhasa/NEWS trunk/OpenMPT/include/lhasa/OpenMPT.txt trunk/OpenMPT/include/lhasa/README trunk/OpenMPT/include/lhasa/TODO trunk/OpenMPT/include/lhasa/autogen.sh trunk/OpenMPT/include/lhasa/configure.ac trunk/OpenMPT/include/lhasa/doc/ trunk/OpenMPT/include/lhasa/doc/.gitignore trunk/OpenMPT/include/lhasa/doc/Doxyfile trunk/OpenMPT/include/lhasa/doc/Makefile.am trunk/OpenMPT/include/lhasa/doc/intro.h trunk/OpenMPT/include/lhasa/doc/lha.1 trunk/OpenMPT/include/lhasa/gencov trunk/OpenMPT/include/lhasa/lhasa.vcxproj trunk/OpenMPT/include/lhasa/lhasa.vcxproj.filters trunk/OpenMPT/include/lhasa/lib/ trunk/OpenMPT/include/lhasa/lib/Makefile.am trunk/OpenMPT/include/lhasa/lib/bit_stream_reader.c trunk/OpenMPT/include/lhasa/lib/crc16.c trunk/OpenMPT/include/lhasa/lib/crc16.h trunk/OpenMPT/include/lhasa/lib/ext_header.c trunk/OpenMPT/include/lhasa/lib/ext_header.h trunk/OpenMPT/include/lhasa/lib/lh1_decoder.c trunk/OpenMPT/include/lhasa/lib/lh5_decoder.c trunk/OpenMPT/include/lhasa/lib/lh6_decoder.c trunk/OpenMPT/include/lhasa/lib/lh7_decoder.c trunk/OpenMPT/include/lhasa/lib/lh_new_decoder.c trunk/OpenMPT/include/lhasa/lib/lha_arch.h trunk/OpenMPT/include/lhasa/lib/lha_arch_unix.c trunk/OpenMPT/include/lhasa/lib/lha_arch_win32.c trunk/OpenMPT/include/lhasa/lib/lha_basic_reader.c trunk/OpenMPT/include/lhasa/lib/lha_basic_reader.h trunk/OpenMPT/include/lhasa/lib/lha_decoder.c trunk/OpenMPT/include/lhasa/lib/lha_decoder.h trunk/OpenMPT/include/lhasa/lib/lha_endian.c trunk/OpenMPT/include/lhasa/lib/lha_endian.h trunk/OpenMPT/include/lhasa/lib/lha_file_header.c trunk/OpenMPT/include/lhasa/lib/lha_file_header.h trunk/OpenMPT/include/lhasa/lib/lha_input_stream.c trunk/OpenMPT/include/lhasa/lib/lha_input_stream.h trunk/OpenMPT/include/lhasa/lib/lha_reader.c trunk/OpenMPT/include/lhasa/lib/lz5_decoder.c trunk/OpenMPT/include/lhasa/lib/lzs_decoder.c trunk/OpenMPT/include/lhasa/lib/macbinary.c trunk/OpenMPT/include/lhasa/lib/macbinary.h trunk/OpenMPT/include/lhasa/lib/null_decoder.c trunk/OpenMPT/include/lhasa/lib/pm1_decoder.c trunk/OpenMPT/include/lhasa/lib/pm2_decoder.c trunk/OpenMPT/include/lhasa/lib/pma_common.c trunk/OpenMPT/include/lhasa/lib/public/ trunk/OpenMPT/include/lhasa/lib/public/Makefile.am trunk/OpenMPT/include/lhasa/lib/public/lha_decoder.h trunk/OpenMPT/include/lhasa/lib/public/lha_file_header.h trunk/OpenMPT/include/lhasa/lib/public/lha_input_stream.h trunk/OpenMPT/include/lhasa/lib/public/lha_reader.h trunk/OpenMPT/include/lhasa/lib/public/lhasa.h trunk/OpenMPT/include/lhasa/lib/tree_decode.c trunk/OpenMPT/include/lhasa/liblhasa.pc.in trunk/OpenMPT/include/lhasa/pkg/ trunk/OpenMPT/include/lhasa/pkg/.gitignore trunk/OpenMPT/include/lhasa/pkg/Makefile.am trunk/OpenMPT/include/lhasa/pkg/config.make.in trunk/OpenMPT/include/lhasa/pkg/win32/ trunk/OpenMPT/include/lhasa/pkg/win32/.gitignore trunk/OpenMPT/include/lhasa/pkg/win32/GNUmakefile trunk/OpenMPT/include/lhasa/pkg/win32/README trunk/OpenMPT/include/lhasa/rpm.spec.in trunk/OpenMPT/include/lhasa/src/ trunk/OpenMPT/include/lhasa/src/.gitignore trunk/OpenMPT/include/lhasa/src/Makefile.am trunk/OpenMPT/include/lhasa/src/args.txt trunk/OpenMPT/include/lhasa/src/extract.c trunk/OpenMPT/include/lhasa/src/extract.h trunk/OpenMPT/include/lhasa/src/filter.c trunk/OpenMPT/include/lhasa/src/filter.h trunk/OpenMPT/include/lhasa/src/list.c trunk/OpenMPT/include/lhasa/src/list.h trunk/OpenMPT/include/lhasa/src/main.c trunk/OpenMPT/include/lhasa/src/options.h trunk/OpenMPT/include/lhasa/src/safe.c trunk/OpenMPT/include/lhasa/src/safe.h trunk/OpenMPT/include/msinttypes/ trunk/OpenMPT/include/msinttypes/OpenMPT.txt trunk/OpenMPT/include/msinttypes/changelog.txt trunk/OpenMPT/include/msinttypes/inttypes/ trunk/OpenMPT/include/msinttypes/inttypes/inttypes.h trunk/OpenMPT/include/msinttypes/stdint/ trunk/OpenMPT/include/msinttypes/stdint/stdint.h Removed Paths: ------------- trunk/OpenMPT/unarchiver/unlha/ Modified: trunk/OpenMPT/common/version.cpp =================================================================== --- trunk/OpenMPT/common/version.cpp 2013-06-25 17:04:02 UTC (rev 2404) +++ trunk/OpenMPT/common/version.cpp 2013-06-25 18:48:11 UTC (rev 2405) @@ -325,8 +325,14 @@ #endif "Ben \"GreaseMonkey\" Russell for IT sample compression code\n" "https://github.com/iamgreaser/it2everything/\n" + "Alexander Chemeris for msinttypes\n" + "https://code.google.com/p/msinttypes/\n" "Jean-loup Gailly and Mark Adler for zlib\n" "http://zlib.net/\n" +#ifndef NO_ARCHIVE_SUPPORT + "Simon Howard for lhasa\n" + "http://fragglet.github.io/lhasa/\n" +#endif #ifndef NO_PORTAUDIO "PortAudio contributors\n" "http://www.portaudio.com/\n" Index: trunk/OpenMPT/include/lhasa =================================================================== --- trunk/OpenMPT/include/lhasa 2013-06-25 17:04:02 UTC (rev 2404) +++ trunk/OpenMPT/include/lhasa 2013-06-25 18:48:11 UTC (rev 2405) Property changes on: trunk/OpenMPT/include/lhasa ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,3 ## +Debug +Release +lhasa.vcxproj.user Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: trunk/OpenMPT/include/lhasa/.gitignore =================================================================== --- trunk/OpenMPT/include/lhasa/.gitignore (rev 0) +++ trunk/OpenMPT/include/lhasa/.gitignore 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,26 @@ +*.o +*.lo +*.la +*.a +*.gcno +*.gcda +*.c.gcov +*.exe +.deps +.libs +.gitignore +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +autotools +config.log +config.status +configure +liblhasa.pc +libtool +config.h +config.hin +rpm.spec +stamp-h1 +INSTALL Added: trunk/OpenMPT/include/lhasa/AUTHORS =================================================================== --- trunk/OpenMPT/include/lhasa/AUTHORS (rev 0) +++ trunk/OpenMPT/include/lhasa/AUTHORS 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1 @@ +Simon Howard <fr...@gm...> Added: trunk/OpenMPT/include/lhasa/COPYING =================================================================== --- trunk/OpenMPT/include/lhasa/COPYING (rev 0) +++ trunk/OpenMPT/include/lhasa/COPYING 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,17 @@ + +Copyright (c) 2011, 2012, Simon Howard + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice appear +in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + Added: trunk/OpenMPT/include/lhasa/ChangeLog =================================================================== --- trunk/OpenMPT/include/lhasa/ChangeLog (rev 0) +++ trunk/OpenMPT/include/lhasa/ChangeLog 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,13 @@ + +The full change history is maintained in git. Rather than reproduce +the change history history here, it's easier if you clone a copy of +the git repository and view it: + + git clone git://github.com/fragglet/lhasa.git lhasa + cd lhasa + git log + +Alternatively, the commit history can be viewed on github: + + https://github.com/fragglet/lhasa/commits/master + Added: trunk/OpenMPT/include/lhasa/Makefile.am =================================================================== --- trunk/OpenMPT/include/lhasa/Makefile.am (rev 0) +++ trunk/OpenMPT/include/lhasa/Makefile.am 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,11 @@ + +AUX_DIST_GEN = $(ac_aux_dir) + +EXTRA_DIST = $(AUX_DIST_GEN) gencov rpm.spec +MAINTAINERCLEANFILES = $(AUX_DIST_GEN) + +pkgconfigdir = ${libdir}/pkgconfig +pkgconfig_DATA = liblhasa.pc + +SUBDIRS=doc lib pkg src test + Property changes on: trunk/OpenMPT/include/lhasa/Makefile.am ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-makefile \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/OpenMPT/include/lhasa/NEWS =================================================================== --- trunk/OpenMPT/include/lhasa/NEWS (rev 0) +++ trunk/OpenMPT/include/lhasa/NEWS 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,127 @@ + +v0.1.0 (2013-03-16): + + * There are now test archives for OS-9 and OS-9/68k (OSK) and a + workaround for a bug in the OSK lha tool on this platform. OSK level + 0 extended areas are also supported. + * Extracted files are now written using O_EXCL, which prevents + malicious symbolic links being used to redirect output. + * Directory paths containing '..' as a directory name are now + sanitized, to prevent malicious archives being able to overwrite + arbitrary files on the filesystem. + * Symbolic links are now extracted in a safer way, being created as + dummy files that are overwritten with proper symbolic links at the + end of extraction. This is the same behavior used by GNU tar to + prevent malicious use of symbolic links. + * Automake 1.13 is now properly supported (thanks Jan Engelhardt). + Processing of archives read from IPC pipes (including stdin) has + been fixed. + +v0.0.7 (2012-06-02): + + * Extraction and listing of Unix symbolic links is now supported. + * Decompression code for the "old" PMarc archive algorithm (-pm1-) has + been added. + * Support has been added for Unix LHA level 0 header extended areas + (so level 0 archives with Unix metadata are now listed and extracted + correctly). + * The Unix permissions field in the list output for directory entries + has been fixed. + * The library header files have been fixed so that they can be included + in C++ code. + * The LHADecoder interface, for extracting raw compressed data, has been + added to the public header files. + * The Unix LHA test archives have been regenerated and improved. + * A "ghost testing" tool has been added for testing ghost compression + algorithms such as -pm1-. + * The list output tests have been fixed to be repeatable regardless of + the current date. + * Build of the fuzzer tool has been fixed. + +v0.0.6 (2012-05-17): + + * When the -w option is used during extraction, the path specified + is now first created if it does not already exist. + * The command line tool now exits with a failure return code if an + error occurs during extraction. + * A "catch-all" header file (lhasa.h) has been added. + * The public header files installed with the library can now be + included and used externally. + * A pkgconfig file is now installed as part of the library + (thanks Jan Engelhardt). + * Make targets have been added for building Doxygen documentation + and including them as part of the distribution. + +v0.0.5 (2012-05-08): + + * Architecture-specific functions for running on Windows have now been + fully implemented, and the command line tool passes all tests in the + test suite on Windows (thanks roytam1 for bug reports). + * Bug fixed where the command line tool would enter an infinite loop + when extracting a truncated archive (thanks Jon Dowland). + * Support added for archives with level 0 headers and Unix path + separators (thanks roytam1). + * The test suite now runs correctly outside of the Europe/London time + zone (thanks Thomas Klausner). + * A .spec file is now included for building rpm packages. + +v0.0.4 (2012-05-01): + + * Special handling is now included for MacBinary headers generated + by MacLHA. + * The -w command line option was broken; it has been fixed. + * A bug has been fixed where the timestamp and other metadata was + not set properly for extracted directories. + * Failures to set the UID/GID of extracted files are now ignored, + rather than being treated as a fatal error. + * Self-extracting archive files with long headers (up to 64KiB) + are now supported. This fixes the handling with some Windows + archives. + * A Unix manpage has been added. + * It is now possible to extract an archive from stdin, by using '-' + as the filename. + * The shorthand command line syntax "lha foo.lzh" to list an archive + is now supported. + * A bug with the wildcard pattern matching code has been fixed. + * Proper regression tests have now been added for command line + archive extraction. + * A set of archives generated by LHmelt (Windows) have been added to + the test suite. + * The regression tests for testing file header parsing and CRC checks + have been rewritten. + +v0.0.3 (2012-04-22): + + Third beta release. + + * A fix has been added for a bug where missing parent directories + were not being created properly. + * Regression testing archives have been added from MacLHA v2.24. + * In order to support MacLHA archives, code has been added that + heuristically detects the MacBinary headers added by MacLHA + and strips them off. + +v0.0.2 (2012-04-17): + + Second beta release. + + * This version adds support for level 2 and 3 file headers. Lhasa + should now be capable of decompressing most, if not all archives + found in the wild. + * A fuzz testing framework has been added for testing the + decompression code. A couple of bugs have been fixed as a result + of this. + +v0.0.1 (2012-04-06): + + Initial version. This should be considered beta code, although this + first version should already be capable of extracting the majority of + archive files found in the wild. The main missing features are: + + * Lack of support for level 2 and 3 file headers. + * Inability to create archives (only extract them). + + These are features that I aim to add in future releases. Other future + features can be found in the TODO file. + +# vim: tw=75 Added: trunk/OpenMPT/include/lhasa/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/lhasa/OpenMPT.txt (rev 0) +++ trunk/OpenMPT/include/lhasa/OpenMPT.txt 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,2 @@ +lhasa LHA decompression library from https://github.com/fragglet/lhasa commit 13b44ac7859aad2f2b4fa76600c186f9f7f98c63 as of 2013-06-16. +No local changes made. Property changes on: trunk/OpenMPT/include/lhasa/OpenMPT.txt ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/OpenMPT/include/lhasa/README =================================================================== --- trunk/OpenMPT/include/lhasa/README (rev 0) +++ trunk/OpenMPT/include/lhasa/README 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,17 @@ +Lhasa is a library for parsing LHA (.lzh) archives and a free +replacement for the Unix LHA tool. + +Currently it is only possible to read from (ie. decompress) archives; +generating (compressing) LHA archives may be an enhancement for future +versions. The aim is to be compatible with as many different variants +of the LHA file format as possible, including LArc (.lzs) and PMarc +(.pma). A suite of archives generated from different tools is +included for regression testing. Type 'make check' to run the tests. + +The command line tool aims to be interface-compatible with the +non-free Unix LHA tool (command line syntax and output), for backwards +compatibility with tools that expect particular output. + +Lhasa is licensed under the ISC license, which is a simplified version +of the MIT/X11 license that is functionally identical. + Added: trunk/OpenMPT/include/lhasa/TODO =================================================================== --- trunk/OpenMPT/include/lhasa/TODO (rev 0) +++ trunk/OpenMPT/include/lhasa/TODO 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,23 @@ +Library: + * Better error handling. + * Extract: + * Add options API to control whether permissions, timestamp are set. + * Creation of parent directories on extract (+optional) + * Add LHAFile convenience class. + * Compression and LHA file generation. + * Correctly handle LHmelt backwards directory ordering. + * Add test archives generated by: + * Microsoft LZH folder add-in for Windows (if possible?) + * UNLHA32 + * Decompressors for obscure algorithms: + * -lh2-, -lh3- (experimental LHA?) + * LHark -lh7- (modified -lh5-) + * -lx1-, -lhx- (unlha32 obscure/experimental?) + +Command line tool: + * Create/update/modify archives. + +Testing: + * Valgrind. + * Improve coverage. + Added: trunk/OpenMPT/include/lhasa/autogen.sh =================================================================== --- trunk/OpenMPT/include/lhasa/autogen.sh (rev 0) +++ trunk/OpenMPT/include/lhasa/autogen.sh 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,13 @@ +#!/bin/sh + +mkdir -p autotools + +aclocal +libtoolize || glibtoolize +autoheader +automake -a +autoconf +automake -a + +./configure $@ + Property changes on: trunk/OpenMPT/include/lhasa/autogen.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/x-sh \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/OpenMPT/include/lhasa/configure.ac =================================================================== --- trunk/OpenMPT/include/lhasa/configure.ac (rev 0) +++ trunk/OpenMPT/include/lhasa/configure.ac 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,88 @@ +AC_INIT(Lhasa, 0.1.0, fr...@gm..., lhasa) +AC_CONFIG_AUX_DIR(autotools) + +AM_INIT_AUTOMAKE([no-define]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AM_PROG_CC_C_O + +AC_PROG_CXX +AC_PROG_RANLIB +AC_PROG_LIBTOOL +AC_PROG_INSTALL +AC_PROG_MAKE_SET + +if [[ "$GCC" = "yes" ]]; then + is_gcc=true +else + is_gcc=false +fi + +TEST_CFLAGS="-DTEST_BUILD" + +# Turn on all warnings for gcc. Turn off optimisation for the test build. + +if $is_gcc; then + WARNINGS="-Wall -Wsign-compare" + CFLAGS="$CFLAGS $WARNINGS" + TEST_CFLAGS="$TEST_CFLAGS $WARNINGS -O0" +fi + +# Support for coverage analysis via gcov: + +coverage=false +AC_ARG_ENABLE(coverage, +[ --enable-coverage Enable coverage testing. ], +[ coverage=true ]) + +if $coverage; then + if $is_gcc; then + TEST_CFLAGS="$TEST_CFLAGS -fprofile-arcs -ftest-coverage" + else + AC_MSG_ERROR([Can only enable coverage when using gcc.]) + fi +fi + +AM_CONDITIONAL(BUILD_COVERAGE, $coverage) + +# Support for running test cases using valgrind: + +use_valgrind=false +AC_ARG_ENABLE(valgrind, +[ --enable-valgrind Use valgrind when running unit tests. ], +[ use_valgrind=true ]) + +if [[ "$use_valgrind" = "true" ]]; then + AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no) + + if [[ "$HAVE_VALGRIND" = "no" ]]; then + AC_MSG_ERROR([Valgrind not found in PATH. ]) + fi +fi + +AM_CONDITIONAL(USE_VALGRIND, $use_valgrind) + +# Save the default CFLAGS and clear them, so that the test build +# of the library doesn't get the optimisation flags. + +MAIN_CFLAGS="$CFLAGS" +CFLAGS="" + +AC_SUBST(MAIN_CFLAGS) +AC_SUBST(TEST_CFLAGS) +AC_SUBST(ac_aux_dir) + +AC_CONFIG_HEADERS([config.h:config.hin]) + +AC_OUTPUT([ + liblhasa.pc + rpm.spec + Makefile + doc/Makefile + lib/Makefile + lib/public/Makefile + pkg/Makefile + pkg/config.make + src/Makefile + test/Makefile +]) + Index: trunk/OpenMPT/include/lhasa/doc =================================================================== --- trunk/OpenMPT/include/lhasa/doc 2013-06-25 17:04:02 UTC (rev 2404) +++ trunk/OpenMPT/include/lhasa/doc 2013-06-25 18:48:11 UTC (rev 2405) Property changes on: trunk/OpenMPT/include/lhasa/doc ___________________________________________________________________ Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: trunk/OpenMPT/include/lhasa/doc/.gitignore =================================================================== --- trunk/OpenMPT/include/lhasa/doc/.gitignore (rev 0) +++ trunk/OpenMPT/include/lhasa/doc/.gitignore 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1 @@ +html Added: trunk/OpenMPT/include/lhasa/doc/Doxyfile =================================================================== --- trunk/OpenMPT/include/lhasa/doc/Doxyfile (rev 0) +++ trunk/OpenMPT/include/lhasa/doc/Doxyfile 2013-06-25 18:48:11 UTC (rev 2405) @@ -0,0 +1,1360 @@ +# Doxyfile 1.5.5 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Lhasa" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, +# and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = lib/public/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = intro.h \ + ../lib/public + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.h + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = ... [truncated message content] |
From: <man...@us...> - 2013-06-25 19:31:17
|
Revision: 2407 http://sourceforge.net/p/modplug/code/2407 Author: manxorist Date: 2013-06-25 19:31:10 +0000 (Tue, 25 Jun 2013) Log Message: ----------- [Fix] Also convert VS2008 project files to use lhasa. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTRACK_08.sln trunk/OpenMPT/mptrack/mptrack_08.vcproj Added Paths: ----------- trunk/OpenMPT/include/lhasa/lhasa.vcproj Added: trunk/OpenMPT/include/lhasa/lhasa.vcproj =================================================================== --- trunk/OpenMPT/include/lhasa/lhasa.vcproj (rev 0) +++ trunk/OpenMPT/include/lhasa/lhasa.vcproj 2013-06-25 19:31:10 UTC (rev 2407) @@ -0,0 +1,298 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="lhasa" + ProjectGUID="{3960775B-D852-4974-903D-573E54FF565D}" + RootNamespace="lhasa" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="4" + CharacterSet="0" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\msinttypes\stdint;..\msinttypes\inttypes" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + 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="0" + 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="..\msinttypes\stdint;..\msinttypes\inttypes" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + 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> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\lib\crc16.c" + > + </File> + <File + RelativePath=".\lib\ext_header.c" + > + </File> + <File + RelativePath=".\lib\lh1_decoder.c" + > + </File> + <File + RelativePath=".\lib\lh5_decoder.c" + > + </File> + <File + RelativePath=".\lib\lh6_decoder.c" + > + </File> + <File + RelativePath=".\lib\lh7_decoder.c" + > + </File> + <File + RelativePath=".\lib\lha_arch_unix.c" + > + </File> + <File + RelativePath=".\lib\lha_arch_win32.c" + > + </File> + <File + RelativePath=".\lib\lha_basic_reader.c" + > + </File> + <File + RelativePath=".\lib\lha_decoder.c" + > + </File> + <File + RelativePath=".\lib\lha_endian.c" + > + </File> + <File + RelativePath=".\lib\lha_file_header.c" + > + </File> + <File + RelativePath=".\lib\lha_input_stream.c" + > + </File> + <File + RelativePath=".\lib\lha_reader.c" + > + </File> + <File + RelativePath=".\lib\lz5_decoder.c" + > + </File> + <File + RelativePath=".\lib\lzs_decoder.c" + > + </File> + <File + RelativePath=".\lib\macbinary.c" + > + </File> + <File + RelativePath=".\lib\null_decoder.c" + > + </File> + <File + RelativePath=".\lib\pm1_decoder.c" + > + </File> + <File + RelativePath=".\lib\pm2_decoder.c" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\lib\crc16.h" + > + </File> + <File + RelativePath=".\lib\ext_header.h" + > + </File> + <File + RelativePath=".\lib\lha_arch.h" + > + </File> + <File + RelativePath=".\lib\lha_basic_reader.h" + > + </File> + <File + RelativePath=".\lib\lha_decoder.h" + > + </File> + <File + RelativePath=".\lib\lha_endian.h" + > + </File> + <File + RelativePath=".\lib\lha_file_header.h" + > + </File> + <File + RelativePath=".\lib\lha_input_stream.h" + > + </File> + <File + RelativePath=".\lib\macbinary.h" + > + </File> + <Filter + Name="public" + > + <File + RelativePath=".\lib\public\lha_decoder.h" + > + </File> + <File + RelativePath=".\lib\public\lha_file_header.h" + > + </File> + <File + RelativePath=".\lib\public\lha_input_stream.h" + > + </File> + <File + RelativePath=".\lib\public\lha_reader.h" + > + </File> + <File + RelativePath=".\lib\public\lhasa.h" + > + </File> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: trunk/OpenMPT/include/lhasa/lhasa.vcproj ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-ms-vcproj \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +CRLF \ No newline at end of property Modified: trunk/OpenMPT/mptrack/MPTRACK_08.sln =================================================================== --- trunk/OpenMPT/mptrack/MPTRACK_08.sln 2013-06-25 19:09:04 UTC (rev 2406) +++ trunk/OpenMPT/mptrack/MPTRACK_08.sln 2013-06-25 19:31:10 UTC (rev 2407) @@ -4,6 +4,7 @@ ProjectSection(ProjectDependencies) = postProject {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8} = {DCC2BB2F-6778-4FD3-9C00-D6CD8DC917B8} {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} = {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + {3960775B-D852-4974-903D-573E54FF565D} = {3960775B-D852-4974-903D-573E54FF565D} {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99} {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} {CF3C2CA5-5D45-4635-BBA4-C1F435E10896} = {CF3C2CA5-5D45-4635-BBA4-C1F435E10896} @@ -19,6 +20,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "..\include\portaudio\build\msvc\portaudio_openmpt_vs2008.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lhasa", "..\include\lhasa\lhasa.vcproj", "{3960775B-D852-4974-903D-573E54FF565D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -49,6 +52,10 @@ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32 + {3960775B-D852-4974-903D-573E54FF565D}.Debug|Win32.ActiveCfg = Debug|Win32 + {3960775B-D852-4974-903D-573E54FF565D}.Debug|Win32.Build.0 = Debug|Win32 + {3960775B-D852-4974-903D-573E54FF565D}.Release|Win32.ActiveCfg = Release|Win32 + {3960775B-D852-4974-903D-573E54FF565D}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-06-25 19:09:04 UTC (rev 2406) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-06-25 19:31:10 UTC (rev 2407) @@ -49,7 +49,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\zlib;..\;..\common\svn_version;..\common\svn_version_default" + AdditionalIncludeDirectories="..\common;..\soundlib;..\include\msinttypes\stdint;..\include\msinttypes\inttypes;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\lhasa\lib\public;..\include\zlib;..\;..\common\svn_version;..\common\svn_version_default" PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" @@ -158,7 +158,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="2" - AdditionalIncludeDirectories="..\common;..\soundlib;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\zlib;..\;..\common\svn_version;..\common\svn_version_default" + AdditionalIncludeDirectories="..\common;..\soundlib;..\include\msinttypes\stdint;..\include\msinttypes\inttypes;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\lhasa\lib\public;..\include\zlib;..\;..\common\svn_version;..\common\svn_version_default" PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" @@ -845,10 +845,6 @@ > </File> <File - RelativePath="..\common\CompilerDetect.h" - > - </File> - <File RelativePath=".\ChildFrm.h" > </File> @@ -865,6 +861,10 @@ > </File> <File + RelativePath="..\common\CompilerDetect.h" + > + </File> + <File RelativePath=".\CreditStatic.h" > </File> @@ -1521,230 +1521,6 @@ > </File> <Filter - Name="unlha" - > - <File - RelativePath="..\unarchiver\unlha\DHUF.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\EXTRACT.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\Header.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\HUF.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\LARC.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\LHARC.H" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\LHEXT.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\MAKETBL.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\SHUF.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\SLIDE.CPP" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\unarchiver\unlha\SLIDEHUF.H" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - </Filter> - <Filter Name="unrar" > <File This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-25 22:24:25
|
Revision: 2411 http://sourceforge.net/p/modplug/code/2411 Author: saga-games Date: 2013-06-25 22:24:19 +0000 (Tue, 25 Jun 2013) Log Message: ----------- [Fix] Fixed rare crash when switching between previewed files in treeview. [Mod] Added PMA and LZS to list of compressed file extensions (lhasa supports these variants of lha) [Mod] OpenMPT: Version is now 1.22.03.07 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2013-06-25 20:49:41 UTC (rev 2410) +++ trunk/OpenMPT/common/versionNumber.h 2013-06-25 22:24:19 UTC (rev 2411) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 03 -#define VER_MINORMINOR 06 +#define VER_MINORMINOR 07 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR)"."VER_STRINGIZE(VER_MAJOR)"."VER_STRINGIZE(VER_MINOR)"."VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-25 20:49:41 UTC (rev 2410) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-06-25 22:24:19 UTC (rev 2411) @@ -1576,6 +1576,7 @@ // so it's safe to replace the sample / instrument now. cs.Leave(); ok = m_WaveFile.ReadInstrumentFromFile(1, p, dwLen); + cs.Enter(); if(!ok) { // Try reading as sample if reading as instrument fails @@ -1930,8 +1931,6 @@ } -// -> CODE#0002 -// -> DESC="list box to choose VST plugin presets (programs)" void CMainFrame::OnPluginManager() //-------------------------------- { @@ -1965,7 +1964,6 @@ } #endif // NO_VST } -// -! NEW_FEATURE#0002 void CMainFrame::OnChannelManager() Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-06-25 20:49:41 UTC (rev 2410) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-06-25 22:24:19 UTC (rev 2411) @@ -1140,7 +1140,7 @@ #ifndef NO_MO3 ";*.mo3" #endif - ")|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha;*.gz" + ")|*.mdz;*.s3z;*.xmz;*.itz;*.mdr;*.zip;*.rar;*.lha;*.pma;*.lzs;*.gz" #ifndef NO_MO3 ";*.mo3" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-27 13:03:32
|
Revision: 2413 http://sourceforge.net/p/modplug/code/2413 Author: manxorist Date: 2013-06-27 13:03:26 +0000 (Thu, 27 Jun 2013) Log Message: ----------- [Ref] Name standard library namespace explicitely instead of relying on types being imported into global namespace. Modified Paths: -------------- trunk/OpenMPT/mptrack/TuningDialog.h trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Sndfile.cpp Modified: trunk/OpenMPT/mptrack/TuningDialog.h =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.h 2013-06-26 21:13:28 UTC (rev 2412) +++ trunk/OpenMPT/mptrack/TuningDialog.h 2013-06-27 13:03:26 UTC (rev 2413) @@ -311,7 +311,7 @@ //m_CommandItemDest is used when the command really need only //one argument. - typedef map<const CTuningCollection* const, bool> MODIFIED_MAP; + typedef std::map<const CTuningCollection* const, bool> MODIFIED_MAP; MODIFIED_MAP m_ModifiedTCs; //If tuning collection seems to have been modified, its address //is added to this map. Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-26 21:13:28 UTC (rev 2412) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-27 13:03:26 UTC (rev 2413) @@ -64,10 +64,10 @@ return false; } -static void WriteTuningCollection(ostream& oStrm, const CTuningCollection& tc) {tc.Serialize(oStrm);} +static void WriteTuningCollection(std::ostream& oStrm, const CTuningCollection& tc) {tc.Serialize(oStrm);} -static void WriteTuningMap(ostream& oStrm, const CSoundFile& sf) -//-------------------------------------------------------------- +static void WriteTuningMap(std::ostream& oStrm, const CSoundFile& sf) +//------------------------------------------------------------------- { if(sf.GetNumInstruments() > 0) { @@ -80,7 +80,7 @@ //T1 1 T2 2 1 1 1 2 2 2 //Creating the tuning address <-> tuning id number map. - typedef map<CTuning*, uint16> TNTS_MAP; + typedef std::map<CTuning*, uint16> TNTS_MAP; typedef TNTS_MAP::iterator TNTS_MAP_ITER; TNTS_MAP tNameToShort_Map; @@ -126,13 +126,13 @@ #endif // MODPLUG_NO_FILESAVE -static void ReadTuningCollection(istream& iStrm, CTuningCollection& tc, const size_t) {tc.Deserialize(iStrm);} +static void ReadTuningCollection(std::istream& iStrm, CTuningCollection& tc, const size_t) {tc.Deserialize(iStrm);} template<class TUNNUMTYPE, class STRSIZETYPE> -static bool ReadTuningMapTemplate(istream& iStrm, map<uint16, string>& shortToTNameMap, const size_t maxNum = 500) -//---------------------------------------------------------------------------------------------------------------- +static bool ReadTuningMapTemplate(std::istream& iStrm, std::map<uint16, std::string>& shortToTNameMap, const size_t maxNum = 500) +//------------------------------------------------------------------------------------------------------------------------------- { - typedef map<uint16, string> MAP; + typedef std::map<uint16, std::string> MAP; typedef MAP::iterator MAP_ITER; TUNNUMTYPE numTuning = 0; iStrm.read(reinterpret_cast<char*>(&numTuning), sizeof(numTuning)); @@ -141,7 +141,7 @@ for(size_t i = 0; i<numTuning; i++) { - string temp; + std::string temp; uint16 ui; if(srlztn::StringFromBinaryStream<STRSIZETYPE>(iStrm, temp, 255)) return true; @@ -156,16 +156,16 @@ } -static void ReadTuningMap(istream& iStrm, CSoundFile& csf, const size_t = 0) -//-------------------------------------------------------------------------- +static void ReadTuningMap(std::istream& iStrm, CSoundFile& csf, const size_t = 0) +//------------------------------------------------------------------------------- { - typedef map<WORD, string> MAP; + typedef std::map<WORD, std::string> MAP; typedef MAP::iterator MAP_ITER; MAP shortToTNameMap; ReadTuningMapTemplate<uint16, uint8>(iStrm, shortToTNameMap); //Read & set tunings for instruments - std::list<string> notFoundTunings; + std::list<std::string> notFoundTunings; for(UINT i = 1; i<=csf.GetNumInstruments(); i++) { uint16 ui; @@ -173,9 +173,9 @@ MAP_ITER iter = shortToTNameMap.find(ui); if(csf.Instruments[i] && iter != shortToTNameMap.end()) { - const string str = iter->second; + const std::string str = iter->second; - if(str == string("->MPT_ORIGINAL_IT<-")) + if(str == std::string("->MPT_ORIGINAL_IT<-")) { csf.Instruments[i]->pTuning = nullptr; continue; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-06-26 21:13:28 UTC (rev 2412) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-06-27 13:03:26 UTC (rev 2413) @@ -828,7 +828,7 @@ } // plugin loader - string notFoundText; + std::string notFoundText; std::vector<PLUGINDEX> notFoundIDs; #ifndef NO_VST @@ -1710,8 +1710,8 @@ #endif -string CSoundFile::GetNoteName(const CTuning::NOTEINDEXTYPE& note, const INSTRUMENTINDEX inst) const -//-------------------------------------------------------------------------------------------------- +std::string CSoundFile::GetNoteName(const CTuning::NOTEINDEXTYPE& note, const INSTRUMENTINDEX inst) const +//------------------------------------------------------------------------------------------------------- { if((inst >= MAX_INSTRUMENTS && inst != INSTRUMENTINDEX_INVALID) || note < NOTE_MIN || note > NOTE_MAX) return "BUG"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-27 14:21:50
|
Revision: 2415 http://sourceforge.net/p/modplug/code/2415 Author: manxorist Date: 2013-06-27 14:21:41 +0000 (Thu, 27 Jun 2013) Log Message: ----------- [Fix] libopenmpt compilation broke in r2414 because it was still using vector instead of std::vector in a lot of places which was unnoticed because, in tracker build, 'using std::vector;' is still done in some headers in global namespace. Always use std::vector in soundlib/. Revision Links: -------------- http://sourceforge.net/p/modplug/code/2414 Modified Paths: -------------- trunk/OpenMPT/soundlib/LOAD_AMF.CPP trunk/OpenMPT/soundlib/LOAD_DMF.CPP trunk/OpenMPT/soundlib/Load_669.cpp trunk/OpenMPT/soundlib/Load_ams.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_mdl.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Load_okt.cpp trunk/OpenMPT/soundlib/Load_psm.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Load_ult.cpp trunk/OpenMPT/soundlib/ModSequence.cpp trunk/OpenMPT/soundlib/RowVisitor.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/XMTools.cpp trunk/OpenMPT/soundlib/XMTools.h trunk/OpenMPT/soundlib/load_j2b.cpp trunk/OpenMPT/soundlib/pattern.cpp trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/soundlib/LOAD_AMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/LOAD_AMF.CPP 2013-06-27 14:21:41 UTC (rev 2415) @@ -439,7 +439,7 @@ // Setup Order List Order.resize(fileHeader.numOrders); - vector<ROWINDEX> patternLength(fileHeader.numOrders, 64); + std::vector<ROWINDEX> patternLength(fileHeader.numOrders, 64); const FileReader::off_t trackStartPos = file.GetPosition() + (fileHeader.version >= 14 ? 2 : 0); for(ORDERINDEX ord = 0; ord < fileHeader.numOrders; ord++) @@ -454,7 +454,7 @@ } // Read Sample Headers - vector<uint32> samplePos(GetNumSamples(), 0); + std::vector<uint32> samplePos(GetNumSamples(), 0); uint32 maxSamplePos = 0; for(SAMPLEINDEX smp = 1; smp <= GetNumSamples(); smp++) @@ -512,16 +512,16 @@ } // Read Track Mapping Table - vector<uint16> trackMap; + std::vector<uint16> trackMap; file.ReadVector(trackMap, fileHeader.numTracks); uint16 trackCount = 0; - for(vector<uint16>::const_iterator i = trackMap.begin(); i != trackMap.end(); i++) + for(std::vector<uint16>::const_iterator i = trackMap.begin(); i != trackMap.end(); i++) { trackCount = std::max(trackCount, *i); } // Store Tracks Positions - vector<FileReader> trackData(trackCount); + std::vector<FileReader> trackData(trackCount); for(uint16 i = 0; i < trackCount; i++) { // Track size is a 24-Bit value describing the number of byte triplets in this track. @@ -572,7 +572,7 @@ // Get table with per-channel track assignments file.Seek(trackStartPos + pat * (GetNumChannels() * 2 + (fileHeader.version >= 14 ? 2 : 0))); - vector<uint16> tracks; + std::vector<uint16> tracks; file.ReadVector(tracks, GetNumChannels()); for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) Modified: trunk/OpenMPT/soundlib/LOAD_DMF.CPP =================================================================== --- trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/LOAD_DMF.CPP 2013-06-27 14:21:41 UTC (rev 2415) @@ -230,7 +230,7 @@ } }; - vector<ChannelState> channels; // Memory for each channel's state + std::vector<ChannelState> channels; // Memory for each channel's state bool realBPMmode; // true = BPM mode uint8 beat; // Rows per beat uint8 tempoTicks; // Tick mode param @@ -423,7 +423,7 @@ uint8 writeDelay = 0; // Counters for channel packing (including global track) - vector<uint8> channelCounter(numChannels + 1, 0); + std::vector<uint8> channelCounter(numChannels + 1, 0); for(ROWINDEX row = 0; row < numRows; row++) { @@ -1018,7 +1018,7 @@ chunk.ReadConvertEndianness(patHeader); m_nChannels = Clamp(patHeader.numTracks, uint8(1), uint8(32)) + 1; // + 1 for global track (used for tempo stuff) - vector<FileReader> patternChunks; + std::vector<FileReader> patternChunks; patternChunks.reserve(patHeader.numPatterns); // First, find out where all of our patterns are... Modified: trunk/OpenMPT/soundlib/Load_669.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_669.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_669.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -159,7 +159,7 @@ continue; } - vector<uint8> effect(8, 0xFF); + std::vector<uint8> effect(8, 0xFF); for(ROWINDEX row = 0; row < 64; row++) { PatternRow m = Patterns[pat].GetRow(row); Modified: trunk/OpenMPT/soundlib/Load_ams.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ams.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_ams.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -405,7 +405,7 @@ SetupMODPanning(true); madeWithTracker = mpt::String::Format("Extreme's tracker %d.%d", fileHeader.versionHigh, fileHeader.versionLow); - vector<bool> packSample(fileHeader.numSamps); + std::vector<bool> packSample(fileHeader.numSamps); STATIC_ASSERT(MAX_SAMPLES > 255); for(SAMPLEINDEX smp = 1; smp <= GetNumSamples(); smp++) @@ -448,11 +448,11 @@ const uint16 packedLength = file.ReadUint16LE(); if(packedLength) { - vector<uint8> textIn, textOut; + std::vector<uint8> textIn, textOut; file.ReadVector(textIn, packedLength); textOut.reserve(packedLength); - for(vector<uint8>::iterator c = textIn.begin(); c != textIn.end(); c++) + for(std::vector<uint8>::iterator c = textIn.begin(); c != textIn.end(); c++) { if(*c & 0x80) { @@ -468,7 +468,7 @@ } // Read Order List - vector<uint16> orders; + std::vector<uint16> orders; if(file.ReadVector(orders, fileHeader.numOrds)) { Order.resize(fileHeader.numOrds); @@ -781,8 +781,8 @@ madeWithTracker = mpt::String::Format("Velvet Studio %d.%d", fileHeader.format >> 4, fileHeader.format & 0x0F); // Instruments - vector<SAMPLEINDEX> firstSample; // First sample of instrument - vector<uint16> sampleSettings; // Shadow sample map... Lo byte = Instrument, Hi byte, lo nibble = Sample index in instrument, Hi byte, hi nibble = Sample pack status + std::vector<SAMPLEINDEX> firstSample; // First sample of instrument + std::vector<uint16> sampleSettings; // Shadow sample map... Lo byte = Instrument, Hi byte, lo nibble = Sample index in instrument, Hi byte, hi nibble = Sample pack status enum { instrIndexMask = 0xFF, // Shadow instrument @@ -887,7 +887,7 @@ if(descriptionHeader.packedLen) { const size_t textLength = descriptionHeader.packedLen - sizeof(descriptionHeader); - vector<uint8> textIn, textOut(descriptionHeader.unpackedLen); + std::vector<uint8> textIn, textOut(descriptionHeader.unpackedLen); file.ReadVector(textIn, textLength); size_t readLen = 0, writeLen = 0; @@ -912,7 +912,7 @@ } // Read Order List - vector<uint16> orders; + std::vector<uint16> orders; if(file.ReadVector(orders, fileHeader.numOrds)) { Order.resize(fileHeader.numOrds); Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -481,7 +481,7 @@ } // Reading instrument, sample and pattern offsets - vector<uint32> insPos, smpPos, patPos; + std::vector<uint32> insPos, smpPos, patPos; file.ReadVector(insPos, fileHeader.insnum); file.ReadVector(smpPos, fileHeader.smpnum); file.ReadVector(patPos, fileHeader.patnum); @@ -717,7 +717,7 @@ FileReader patternData = file.GetChunk(len); ROWINDEX row = 0; - vector<uint8> chnMask(GetNumChannels()); + std::vector<uint8> chnMask(GetNumChannels()); while(row < numRows && patternData.AreBytesLeft()) { @@ -793,8 +793,8 @@ // Now (after the Insert() call), we can read the pattern name. CopyPatternName(Patterns[pat], patNames); - vector<uint8> chnMask(GetNumChannels()); - vector<ModCommand> lastValue(GetNumChannels(), ModCommand::Empty()); + std::vector<uint8> chnMask(GetNumChannels()); + std::vector<ModCommand> lastValue(GetNumChannels(), ModCommand::Empty()); ModCommand *m = Patterns[pat]; ROWINDEX row = 0; @@ -1146,9 +1146,9 @@ itHeader.patnum = std::min(Patterns.GetNumPatterns(), specs.patternsMax); // Parapointers - vector<uint32> patpos(itHeader.patnum, 0); - vector<uint32> smppos(itHeader.smpnum, 0); - vector<uint32> inspos(itHeader.insnum, 0); + std::vector<uint32> patpos(itHeader.patnum, 0); + std::vector<uint32> smppos(itHeader.smpnum, 0); + std::vector<uint32> inspos(itHeader.insnum, 0); //VERSION if(GetType() == MOD_TYPE_MPT) @@ -1398,8 +1398,8 @@ dwPos += 8; const CHANNELINDEX maxChannels = MIN(specs.channelsMax, GetNumChannels()); - vector<BYTE> chnmask(maxChannels, 0xFF); - vector<ModCommand> lastvalue(maxChannels, ModCommand::Empty()); + std::vector<BYTE> chnmask(maxChannels, 0xFF); + std::vector<ModCommand> lastvalue(maxChannels, ModCommand::Empty()); for(ROWINDEX row = 0; row < writeRows; row++) { Modified: trunk/OpenMPT/soundlib/Load_mdl.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_mdl.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -301,7 +301,7 @@ BYTE inspanenv[MAX_INSTRUMENTS]; LPCBYTE pvolenv, ppanenv, ppitchenv; UINT nvolenv, npanenv, npitchenv; - vector<ROWINDEX> patternLength; + std::vector<ROWINDEX> patternLength; if ((!lpStream) || (dwMemLength < 1024)) return false; if ((pmsh->id != 0x4C444D44) || ((pmsh->version & 0xF0) > 0x10)) return false; Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -657,8 +657,8 @@ } // For detecting PT1x mode - vector<ModCommand::INSTR> lastInstrument(GetNumChannels(), 0); - vector<int> instrWithoutNoteCount(GetNumChannels(), 0); + std::vector<ModCommand::INSTR> lastInstrument(GetNumChannels(), 0); + std::vector<int> instrWithoutNoteCount(GetNumChannels(), 0); for(ROWINDEX row = 0; row < 64; row++) { @@ -1107,8 +1107,8 @@ fwrite(name, 20, 1, f); } - vector<SmpLength> sampleLength(32, 0); - vector<SAMPLEINDEX> sampleSource(32, 0); + std::vector<SmpLength> sampleLength(32, 0); + std::vector<SAMPLEINDEX> sampleSource(32, 0); if(GetNumInstruments()) { @@ -1186,7 +1186,7 @@ fwrite(&modMagic, 4, 1, f); // Write patterns - vector<uint8> events; + std::vector<uint8> events; for(PATTERNINDEX pat = 0; pat < writePatterns; pat++) { if(!Patterns.IsValidPat(pat)) Modified: trunk/OpenMPT/soundlib/Load_okt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_okt.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -71,8 +71,8 @@ #endif // Parse the sample header block -void ReadOKTSamples(FileReader &chunk, vector<bool> &sample7bit, CSoundFile *pSndFile) -//------------------------------------------------------------------------------------ +void ReadOKTSamples(FileReader &chunk, std::vector<bool> &sample7bit, CSoundFile *pSndFile) +//----------------------------------------------------------------------------------------- { pSndFile->m_nSamples = MIN((SAMPLEINDEX)(chunk.BytesLeft() / sizeof(OktSample)), MAX_SAMPLES - 1); // typically 36 sample7bit.resize(pSndFile->GetNumSamples()); @@ -289,9 +289,9 @@ } // prepare some arrays to store offsets etc. - vector<FileReader> patternChunks; - vector<FileReader> sampleChunks; - vector<bool> sample7bit; // 7-/8-bit sample + std::vector<FileReader> patternChunks; + std::vector<FileReader> sampleChunks; + std::vector<bool> sample7bit; // 7-/8-bit sample ORDERINDEX nOrders = 0; InitializeGlobals(); Modified: trunk/OpenMPT/soundlib/Load_psm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_psm.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -235,8 +235,8 @@ struct PSMSubSong // For internal use (pattern conversion) { - vector<uint8> channelPanning, channelVolume; - vector<bool> channelSurround; + std::vector<uint8> channelPanning, channelVolume; + std::vector<bool> channelSurround; uint8 defaultTempo, defaultSpeed; char songName[10]; ORDERINDEX startOrder, endOrder, restartPos; @@ -297,12 +297,12 @@ // pattern offset and identifier PATTERNINDEX numPatterns = 0; // used for setting up the orderlist - final pattern count - vector<FileReader> patternChunks; // pattern offsets (sorted as they occour in the file) - vector<uint32> patternIDs; // pattern IDs (sorted as they occour in the file) - vector<FileReader *> orderOffsets; // combine the upper two vectors to get the offsets for each order item + std::vector<FileReader> patternChunks; // pattern offsets (sorted as they occour in the file) + std::vector<uint32> patternIDs; // pattern IDs (sorted as they occour in the file) + std::vector<FileReader *> orderOffsets; // combine the upper two vectors to get the offsets for each order item Order.clear(); // subsong setup - vector<PSMSubSong> subsongs; + std::vector<PSMSubSong> subsongs; bool subsongPanningDiffers = false; // do we have subsongs with different panning positions? ChunkReader chunkFile(file); @@ -319,8 +319,8 @@ } // "PBOD" - Pattern data of a single pattern - vector<FileReader> pattChunks = chunks.GetAllChunks(PSMChunk::idPBOD); - for(vector<FileReader>::iterator patternIter = pattChunks.begin(); patternIter != pattChunks.end(); patternIter++) + std::vector<FileReader> pattChunks = chunks.GetAllChunks(PSMChunk::idPBOD); + for(std::vector<FileReader>::iterator patternIter = pattChunks.begin(); patternIter != pattChunks.end(); patternIter++) { ChunkReader chunk(*patternIter); if(chunk.GetLength() != chunk.ReadUint32LE() // Same value twice @@ -349,13 +349,13 @@ } // "SONG" - Subsong information (channel count etc) - vector<FileReader> songChunks = chunks.GetAllChunks(PSMChunk::idSONG); + std::vector<FileReader> songChunks = chunks.GetAllChunks(PSMChunk::idSONG); if(songChunks.empty()) { return false; } - for(vector<FileReader>::iterator subsongIter = songChunks.begin(); subsongIter != songChunks.end(); subsongIter++) + for(std::vector<FileReader>::iterator subsongIter = songChunks.begin(); subsongIter != songChunks.end(); subsongIter++) { ChunkReader chunk(*subsongIter); PSMSongHeader songHeader; @@ -595,8 +595,8 @@ // DSMP - Samples if(loadFlags & loadSampleData) { - vector<FileReader> sampleChunks = chunks.GetAllChunks(PSMChunk::idDSMP); - for(vector<FileReader>::iterator sampleIter = sampleChunks.begin(); sampleIter != sampleChunks.end(); sampleIter++) + std::vector<FileReader> sampleChunks = chunks.GetAllChunks(PSMChunk::idDSMP); + for(std::vector<FileReader>::iterator sampleIter = sampleChunks.begin(); sampleIter != sampleChunks.end(); sampleIter++) { FileReader chunk(*sampleIter); if(!newFormat) Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -588,14 +588,14 @@ Order.ReadAsByte(file, fileHeader.ordNum); // Read sample header offsets - vector<uint16> sampleOffsets(fileHeader.smpNum); + std::vector<uint16> sampleOffsets(fileHeader.smpNum); for(size_t i = 0; i < fileHeader.smpNum; i++) { sampleOffsets[i] = file.ReadUint16LE(); } // Read pattern offsets - vector<uint16> patternOffsets(fileHeader.patNum); + std::vector<uint16> patternOffsets(fileHeader.patNum); for(size_t i = 0; i < fileHeader.patNum; i++) { patternOffsets[i] = file.ReadUint16LE(); @@ -903,7 +903,7 @@ // ...which must be a multiple of 16, because parapointers omit the lowest 4 bits. sampleHeaderOffset = (sampleHeaderOffset + 15) & ~15; - vector<uint16> sampleOffsets(writeSamples); + std::vector<uint16> sampleOffsets(writeSamples); for(SAMPLEINDEX smp = 0; smp < writeSamples; smp++) { STATIC_ASSERT((sizeof(S3MSampleHeader) % 16) == 0); @@ -918,7 +918,7 @@ size_t patternPointerOffset = ftell(f); size_t firstPatternOffset = sampleHeaderOffset + writeSamples * sizeof(S3MSampleHeader); - vector<uint16> patternOffsets(writePatterns); + std::vector<uint16> patternOffsets(writePatterns); // Need to calculate the real offsets later. if(writePatterns != 0) @@ -964,7 +964,7 @@ patternOffsets[pat] = static_cast<uint16>(ftell(f) / 16); SwapBytesLE(patternOffsets[pat]); - vector<uint8> buffer; + std::vector<uint8> buffer; buffer.reserve(5 * 1024); // Reserve space for length bytes buffer.resize(2, 0); @@ -1086,7 +1086,7 @@ size_t sampleDataOffset = ftell(f); // Write samples - vector<S3MSampleHeader> sampleHeader(writeSamples); + std::vector<S3MSampleHeader> sampleHeader(writeSamples); for(SAMPLEINDEX smp = 0; smp < writeSamples; smp++) { Modified: trunk/OpenMPT/soundlib/Load_ult.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ult.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Load_ult.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -368,7 +368,7 @@ curChannel = (curChannel + 1) % numChannels; } - vector<bool> isPortaActive; + std::vector<bool> isPortaActive; bool writeT125; CHANNELINDEX numChannels, curChannel; }; Modified: trunk/OpenMPT/soundlib/ModSequence.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModSequence.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/ModSequence.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -586,7 +586,7 @@ SetSequence(0); resize(GetLengthTailTrimmed()); SEQUENCEINDEX removedSequences = 0; // sequence count - vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already? + std::vector <SEQUENCEINDEX> patternsFixed; // pattern fixed by other sequence already? patternsFixed.resize(m_sndFile.Patterns.Size(), SEQUENCEINDEX_INVALID); // Set up vector for(ORDERINDEX nOrd = 0; nOrd < GetLengthTailTrimmed(); nOrd++) Modified: trunk/OpenMPT/soundlib/RowVisitor.cpp =================================================================== --- trunk/OpenMPT/soundlib/RowVisitor.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/RowVisitor.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -177,7 +177,7 @@ // Unvisit all rows that are in the visited row buffer, until we hit the start row for this pattern loop. ROWINDEX row = ROWINDEX_INVALID; - vector<ROWINDEX>::reverse_iterator iter = visitOrder.rbegin(); + std::vector<ROWINDEX>::reverse_iterator iter = visitOrder.rbegin(); while(iter != visitOrder.rend() && row != startRow) { row = *(iter++); Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -186,7 +186,7 @@ return false; } - vector<bool> keepSamples(GetNumSamples() + 1, true); + std::vector<bool> keepSamples(GetNumSamples() + 1, true); // Check which samples are used by the instrument we are going to nuke. std::set<SAMPLEINDEX> referencedSamples = Instruments[nInstr]->GetSamples(); @@ -237,8 +237,8 @@ Instruments[targetInstr] = pIns; *pIns = *srcSong.Instruments[sourceInstr]; - vector<SAMPLEINDEX> sourceSample; // Sample index in source song - vector<SAMPLEINDEX> targetSample; // Sample index in target song + std::vector<SAMPLEINDEX> sourceSample; // Sample index in source song + std::vector<SAMPLEINDEX> targetSample; // Sample index in target song SAMPLEINDEX targetIndex = 0; // Next index for inserting sample for(size_t i = 0; i < CountOf(pIns->Keyboard); i++) @@ -246,7 +246,7 @@ const SAMPLEINDEX sourceIndex = pIns->Keyboard[i]; if(sourceIndex > 0 && sourceIndex <= srcSong.GetNumSamples()) { - const vector<SAMPLEINDEX>::const_iterator entry = std::find(sourceSample.begin(), sourceSample.end(), sourceIndex); + const std::vector<SAMPLEINDEX>::const_iterator entry = std::find(sourceSample.begin(), sourceSample.end(), sourceIndex); if(entry == sourceSample.end()) { // Didn't consider this sample yet, so add it to our map. @@ -987,7 +987,7 @@ fileHeader.ConvertToMPT(*pIns); // Translate sample map and find available sample slots - vector<SAMPLEINDEX> sampleMap(fileHeader.numSamples); + std::vector<SAMPLEINDEX> sampleMap(fileHeader.numSamples); SAMPLEINDEX maxSmp = 0; for(size_t i = 0 + 12; i < 96 + 12; i++) @@ -1014,7 +1014,7 @@ m_nSamples = maxSmp; } - vector<SampleIO> sampleFlags(fileHeader.numSamples); + std::vector<SampleIO> sampleFlags(fileHeader.numSamples); // Read sample headers for(SAMPLEINDEX i = 0; i < fileHeader.numSamples; i++) @@ -1080,7 +1080,7 @@ XIInstrumentHeader header; header.ConvertToXM(*pIns, false); - const vector<SAMPLEINDEX> samples = header.instrument.GetSampleList(*pIns, false); + const std::vector<SAMPLEINDEX> samples = header.instrument.GetSampleList(*pIns, false); if(samples.size() > 0 && samples[0] <= GetNumSamples()) { // Copy over auto-vibrato settings of first sample @@ -1090,7 +1090,7 @@ header.ConvertEndianness(); fwrite(&header, 1, sizeof(XIInstrumentHeader), f); - vector<SampleIO> sampleFlags(samples.size()); + std::vector<SampleIO> sampleFlags(samples.size()); // XI Sample Headers for(SAMPLEINDEX i = 0; i < samples.size(); i++) @@ -1460,7 +1460,7 @@ { size_t numMarkers = markerChunk.ReadUint16BE(); - vector<AIFFMarker> markers; + std::vector<AIFFMarker> markers; for(size_t i = 0; i < numMarkers; i++) { AIFFMarker marker; @@ -1485,7 +1485,7 @@ } // Read markers - for(vector<AIFFMarker>::iterator iter = markers.begin(); iter != markers.end(); iter++) + for(std::vector<AIFFMarker>::iterator iter = markers.begin(); iter != markers.end(); iter++) { if(iter->id == instrHeader.sustainLoop.beginLoop) { @@ -1609,7 +1609,7 @@ FileReader::off_t extraOffset = file.GetPosition(); // Reading Samples - vector<SAMPLEINDEX> samplemap(nsamples, 0); + std::vector<SAMPLEINDEX> samplemap(nsamples, 0); for(SAMPLEINDEX i = 0; i < nsamples; i++) { smp = GetNextFreeSample(nInstr, smp + 1); @@ -1657,8 +1657,8 @@ size_t instSize = iti.ConvertToIT(*pIns, false, *this); // Create sample assignment table - vector<SAMPLEINDEX> smptable; - vector<SAMPLEINDEX> smpmap(GetNumSamples(), 0); + std::vector<SAMPLEINDEX> smptable; + std::vector<SAMPLEINDEX> smpmap(GetNumSamples(), 0); for(size_t i = 0; i < NOTE_MAX; i++) { const SAMPLEINDEX smp = pIns->Keyboard[i]; @@ -1685,8 +1685,8 @@ filePos += smptable.size() * sizeof(ITSample); // Writing sample headers + data - vector<SampleIO> sampleFlags; - for(vector<SAMPLEINDEX>::iterator iter = smptable.begin(); iter != smptable.end(); iter++) + std::vector<SampleIO> sampleFlags; + for(std::vector<SAMPLEINDEX>::iterator iter = smptable.begin(); iter != smptable.end(); iter++) { ITSample itss; itss.ConvertToIT(Samples[*iter], GetType(), compress, compress); Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -99,7 +99,7 @@ CSoundFile::samplecount_t renderedSamples; UINT musicSpeed, musicTempo; LONG glbVol; - vector<ChnSettings> chnSettings; + std::vector<ChnSettings> chnSettings; protected: const CSoundFile &sndFile; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -1499,8 +1499,8 @@ // Detect samples that are referenced by an instrument, but actually not used in a song. // Only works in instrument mode. Unused samples are marked as false in the vector. -SAMPLEINDEX CSoundFile::DetectUnusedSamples(vector<bool> &sampleUsed) const -//------------------------------------------------------------------------- +SAMPLEINDEX CSoundFile::DetectUnusedSamples(std::vector<bool> &sampleUsed) const +//------------------------------------------------------------------------------ { sampleUsed.assign(GetNumSamples() + 1, false); @@ -1556,8 +1556,8 @@ // Destroy samples where keepSamples index is false. First sample is keepSamples[1]! -SAMPLEINDEX CSoundFile::RemoveSelectedSamples(const vector<bool> &keepSamples) -//---------------------------------------------------------------------------- +SAMPLEINDEX CSoundFile::RemoveSelectedSamples(const std::vector<bool> &keepSamples) +//--------------------------------------------------------------------------------- { if(keepSamples.empty()) { Modified: trunk/OpenMPT/soundlib/XMTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/XMTools.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/XMTools.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -88,12 +88,12 @@ ConvertEnvelopeToXM(mptIns.PanEnv, panPoints, panFlags, panSustain, panLoopStart, panLoopEnd, panEnv); // Create sample assignment table - vector<SAMPLEINDEX> sampleList = GetSampleList(mptIns, compatibilityExport); + std::vector<SAMPLEINDEX> sampleList = GetSampleList(mptIns, compatibilityExport); for(size_t i = 0; i < CountOf(sampleMap); i++) { if(mptIns.Keyboard[i + 12] > 0) { - vector<SAMPLEINDEX>::iterator sample = std::find(sampleList.begin(), sampleList.end(), mptIns.Keyboard[i + 12]); + std::vector<SAMPLEINDEX>::iterator sample = std::find(sampleList.begin(), sampleList.end(), mptIns.Keyboard[i + 12]); if(sample != sampleList.end()) { // Yep, we want to export this sample. @@ -115,11 +115,11 @@ // Get a list of samples that should be written to the file. -vector<SAMPLEINDEX> XMInstrument::GetSampleList(const ModInstrument &mptIns, bool compatibilityExport) const -//---------------------------------------------------------------------------------------------------------- +std::vector<SAMPLEINDEX> XMInstrument::GetSampleList(const ModInstrument &mptIns, bool compatibilityExport) const +//--------------------------------------------------------------------------------------------------------------- { - vector<SAMPLEINDEX> sampleList; // List of samples associated with this instrument - vector<bool> addedToList; // Which samples did we already add to the sample list? + std::vector<SAMPLEINDEX> sampleList; // List of samples associated with this instrument + std::vector<bool> addedToList; // Which samples did we already add to the sample list? uint8 numSamples = 0; for(size_t i = 0; i < CountOf(sampleMap); i++) Modified: trunk/OpenMPT/soundlib/XMTools.h =================================================================== --- trunk/OpenMPT/soundlib/XMTools.h 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/XMTools.h 2013-06-27 14:21:41 UTC (rev 2415) @@ -100,7 +100,7 @@ void ApplyAutoVibratoToMPT(ModSample &mptSmp) const; // Get a list of samples that should be written to the file. - vector<SAMPLEINDEX> GetSampleList(const ModInstrument &mptIns, bool compatibilityExport) const; + std::vector<SAMPLEINDEX> GetSampleList(const ModInstrument &mptIns, bool compatibilityExport) const; }; STATIC_ASSERT(sizeof(XMInstrument) == 230); Modified: trunk/OpenMPT/soundlib/load_j2b.cpp =================================================================== --- trunk/OpenMPT/soundlib/load_j2b.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/load_j2b.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -824,8 +824,8 @@ // "PATT" - Pattern data for one pattern if(loadFlags & loadPatternData) { - vector<FileReader> pattChunks = chunks.GetAllChunks(AMFFRiffChunk::idPATT); - for(vector<FileReader>::iterator patternIter = pattChunks.begin(); patternIter != pattChunks.end(); patternIter++) + std::vector<FileReader> pattChunks = chunks.GetAllChunks(AMFFRiffChunk::idPATT); + for(std::vector<FileReader>::iterator patternIter = pattChunks.begin(); patternIter != pattChunks.end(); patternIter++) { FileReader chunk(*patternIter); PATTERNINDEX pat = chunk.ReadUint8(); @@ -837,8 +837,8 @@ if(!isAM) { // "INST" - Instrument (only in RIFF AMFF) - vector<FileReader> instChunks = chunks.GetAllChunks(AMFFRiffChunk::idINST); - for(vector<FileReader>::iterator instIter = instChunks.begin(); instIter != instChunks.end(); instIter++) + std::vector<FileReader> instChunks = chunks.GetAllChunks(AMFFRiffChunk::idINST); + for(std::vector<FileReader>::iterator instIter = instChunks.begin(); instIter != instChunks.end(); instIter++) { FileReader chunk(*instIter); AMFFInstrumentHeader instrHeader; @@ -886,8 +886,8 @@ } else { // "RIFF" - Instrument (only in RIFF AM) - vector<FileReader> instChunks = chunks.GetAllChunks(AMFFRiffChunk::idRIFF); - for(vector<FileReader>::iterator instIter = instChunks.begin(); instIter != instChunks.end(); instIter++) + std::vector<FileReader> instChunks = chunks.GetAllChunks(AMFFRiffChunk::idRIFF); + for(std::vector<FileReader>::iterator instIter = instChunks.begin(); instIter != instChunks.end(); instIter++) { ChunkReader chunk(*instIter); if(chunk.ReadUint32LE() != AMFFRiffChunk::idAI__) @@ -923,10 +923,10 @@ // Read sample sub-chunks (RIFF nesting ftw) ChunkReader::ChunkList<AMFFRiffChunk> sampleChunkFile = chunk.ReadChunks<AMFFRiffChunk>(2); - vector<FileReader> sampleChunks = sampleChunkFile.GetAllChunks(AMFFRiffChunk::idRIFF); + std::vector<FileReader> sampleChunks = sampleChunkFile.GetAllChunks(AMFFRiffChunk::idRIFF); ASSERT(sampleChunks.size() == instrHeader.numSamples); - for(vector<FileReader>::iterator smpIter = sampleChunks.begin(); smpIter != sampleChunks.end(); smpIter++) + for(std::vector<FileReader>::iterator smpIter = sampleChunks.begin(); smpIter != sampleChunks.end(); smpIter++) { ChunkReader sampleChunk(*smpIter); Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/soundlib/pattern.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -533,7 +533,7 @@ const ROWINDEX rows = pat.GetNumRows(); const CHANNELINDEX chns = pat.GetNumChannels(); - vector<ModCommand> lastChnMC(chns); + std::vector<ModCommand> lastChnMC(chns); for(ROWINDEX r = 0; r<rows; r++) { @@ -588,7 +588,7 @@ const CHANNELINDEX chns = pat.GetNumChannels(); const ROWINDEX rows = pat.GetNumRows(); - vector<ModCommand> lastChnMC(chns); + std::vector<ModCommand> lastChnMC(chns); ROWINDEX row = 0; while(row < rows && iStrm.good()) Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-06-27 13:41:04 UTC (rev 2414) +++ trunk/OpenMPT/test/test.cpp 2013-06-27 14:21:41 UTC (rev 2415) @@ -1455,7 +1455,7 @@ GenerateCommands(sndFile.Patterns[2], 0.5, 0.5); // - vector<ModCommand> pat[3]; + std::vector<ModCommand> pat[3]; const size_t numCommands[] = { sndFile.GetNumChannels() * sndFile.Patterns[0].GetNumRows(), sndFile.GetNumChannels() * sndFile.Patterns[1].GetNumRows(), sndFile.GetNumChannels() * sndFile.Patterns[2].GetNumRows() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-27 15:00:15
|
Revision: 2416 http://sourceforge.net/p/modplug/code/2416 Author: manxorist Date: 2013-06-27 15:00:03 +0000 (Thu, 27 Jun 2013) Log Message: ----------- [Ref] Remove all using namespace std; and using std::*; Modified Paths: -------------- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/Autotune.cpp trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp trunk/OpenMPT/mptrack/CloseMainDialog.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/ExceptionHandler.cpp trunk/OpenMPT/mptrack/HyperEdit.h trunk/OpenMPT/mptrack/MIDIMapping.h trunk/OpenMPT/mptrack/MPTHacks.cpp trunk/OpenMPT/mptrack/Mod2wave.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.h trunk/OpenMPT/mptrack/Undo.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/View_gen.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/dlg_misc.h trunk/OpenMPT/mptrack/mod2midi.cpp trunk/OpenMPT/mptrack/tagging.cpp trunk/OpenMPT/mptrack/tagging.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp trunk/OpenMPT/soundlib/Load_itp.cpp trunk/OpenMPT/soundlib/Load_mid.cpp trunk/OpenMPT/soundlib/tuningCollection.cpp Modified: trunk/OpenMPT/mptrack/AbstractVstEditor.cpp =================================================================== --- trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/AbstractVstEditor.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -577,7 +577,7 @@ CString name; - vector<CVstPlugin *> inputPlugs; + std::vector<CVstPlugin *> inputPlugs; m_VstPlugin.GetInputPlugList(inputPlugs); for(size_t nPlug=0; nPlug < inputPlugs.size(); nPlug++) { @@ -585,7 +585,7 @@ m_InputMenu.AppendMenu(MF_STRING, ID_PLUGSELECT + inputPlugs[nPlug]->m_nSlot, name); } - vector<CHANNELINDEX> inputChannels; + std::vector<CHANNELINDEX> inputChannels; m_VstPlugin.GetInputChannelList(inputChannels); for(size_t nChn=0; nChn<inputChannels.size(); nChn++) { @@ -597,7 +597,7 @@ m_InputMenu.AppendMenu(MF_STRING, NULL, name); } - vector<INSTRUMENTINDEX> inputInstruments; + std::vector<INSTRUMENTINDEX> inputInstruments; m_VstPlugin.GetInputInstrumentList(inputInstruments); for(size_t nIns = 0; nIns<inputInstruments.size(); nIns++) { Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -310,7 +310,7 @@ CFileFind finder; BOOL bResult = finder.FindFile(searchPattern); - vector<CString> foundfiles; + std::vector<CString> foundfiles; while(bResult) { Modified: trunk/OpenMPT/mptrack/Autotune.cpp =================================================================== --- trunk/OpenMPT/mptrack/Autotune.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Autotune.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -164,7 +164,7 @@ const SmpLength processLength = sampleLength - maxShift; // Histogram for all notes. - vector<uint64> autocorrHistogram(historyBins, 0); + std::vector<uint64> autocorrHistogram(historyBins, 0); // Do autocorrelation and save results in a note histogram (restriced to one octave). for(int note = autocorrStartNote, noteBin = note; note < autocorrEndNote; note++, noteBin++) @@ -190,7 +190,7 @@ } // Interpolate the histogram... - vector<uint64> interpolatedHistogram(historyBins, 0); + std::vector<uint64> interpolatedHistogram(historyBins, 0); for(int i = 0; i < historyBins; i++) { interpolatedHistogram[i] = autocorrHistogram[i]; Modified: trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/ChannelManagerDlg.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -198,7 +198,7 @@ CriticalSection cs; //Creating new order-vector for ReArrangeChannels. - vector<CHANNELINDEX> newChnOrder; + std::vector<CHANNELINDEX> newChnOrder; for(CHANNELINDEX nChn = 0; nChn < nChannels; nChn++) { newChnOrder.push_back(newpat[nChn]); Modified: trunk/OpenMPT/mptrack/CloseMainDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/CloseMainDialog.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -51,8 +51,8 @@ CheckDlgButton(IDC_CHECK1, BST_CHECKED); - vector<CModDoc *> documents = theApp.GetOpenDocuments(); - for(vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) + std::vector<CModDoc *> documents = theApp.GetOpenDocuments(); + for(std::vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) { CModDoc *pModDoc = *doc; if(pModDoc->IsModified()) Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -192,7 +192,7 @@ // Note s[0] = 0; - string temp = sndFile.GetNoteName(nPos+1, m_nInstrument); + std::string temp = sndFile.GetNoteName(nPos+1, m_nInstrument); temp.resize(4); if ((nPos >= 0) && (nPos < NOTE_MAX)) wsprintf(s, "%s", temp.c_str()); rect.SetRect(0, ypaint, m_cxFont, ypaint+m_cyFont); @@ -207,7 +207,7 @@ UINT n = pIns->NoteMap[nPos]; if(ModCommand::IsNote(n)) { - string temp = sndFile.GetNoteName(n, m_nInstrument); + std::string temp = sndFile.GetNoteName(n, m_nInstrument); temp.resize(4); wsprintf(s, "%s", temp.c_str()); } else @@ -1530,7 +1530,7 @@ // Pitch/Tempo lock { const CModSpecifications& specs = m_sndFile.GetModSpecifications(); - string str = string("Tempo range: ") + Stringify(specs.tempoMin) + string(" - ") + Stringify(specs.tempoMax); + std::string str = std::string("Tempo range: ") + Stringify(specs.tempoMin) + std::string(" - ") + Stringify(specs.tempoMax); if(str.size() >= 250) str.resize(250); strcpy(pszText, str.c_str()); return TRUE; @@ -2570,7 +2570,7 @@ //Case: Chosen tuning editor to be displayed. //Creating vector for the CTuningDialog. - vector<CTuningCollection*> v; + std::vector<CTuningCollection*> v; v.push_back(&m_sndFile.GetBuiltInTunings()); v.push_back(&m_sndFile.GetLocalTunings()); v.push_back(&m_sndFile.GetTuneSpecificTunings()); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -826,7 +826,7 @@ return; bool success = false; // Has this pattern been duplicated already? (for multiselect) - vector<PATTERNINDEX> patReplaceIndex(sndFile.Patterns.Size(), PATTERNINDEX_INVALID); + std::vector<PATTERNINDEX> patReplaceIndex(sndFile.Patterns.Size(), PATTERNINDEX_INVALID); for(ORDERINDEX i = 0; i <= insertCount; i++) { Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -23,8 +23,6 @@ #include "EffectInfo.h" #include <string> -using std::string; - // Headers #define ROWHDR_WIDTH 32 // Row header #define COLHDR_HEIGHT 16 // Column header @@ -405,7 +403,7 @@ { if(pTuning) { // Drawing custom note names - string noteStr = pTuning->GetNoteName(static_cast<CTuningBase::NOTEINDEXTYPE>(note-NOTE_MIDDLEC)); + std::string noteStr = pTuning->GetNoteName(static_cast<CTuningBase::NOTEINDEXTYPE>(note-NOTE_MIDDLEC)); if(noteStr.size() < 3) noteStr.resize(3, ' '); Modified: trunk/OpenMPT/mptrack/ExceptionHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/ExceptionHandler.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -86,8 +86,8 @@ // Rescue modified files... int numFiles = 0; - vector<CModDoc *> documents = theApp.GetOpenDocuments(); - for(vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) + std::vector<CModDoc *> documents = theApp.GetOpenDocuments(); + for(std::vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) { CModDoc *pModDoc = *doc; if(pModDoc->IsModified() && pModDoc->GetSoundFile() != nullptr) Modified: trunk/OpenMPT/mptrack/HyperEdit.h =================================================================== --- trunk/OpenMPT/mptrack/HyperEdit.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/HyperEdit.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -35,8 +35,6 @@ #include <vector> -using namespace std; - // // This structure holds the starting offset and length for each token // located inside the buffer for the control. We use this data inside @@ -46,7 +44,7 @@ struct _TOKEN_OFFSET{ WORD iStart; // WORD iLength; -}; typedef vector<_TOKEN_OFFSET> OFFSETS; +}; typedef std::vector<_TOKEN_OFFSET> OFFSETS; // CHyperEdit control interface Modified: trunk/OpenMPT/mptrack/MIDIMapping.h =================================================================== --- trunk/OpenMPT/mptrack/MIDIMapping.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/MIDIMapping.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -12,7 +12,6 @@ #include <vector> #include <algorithm> -using std::vector; //========================= @@ -82,7 +81,7 @@ //=============== { public: - typedef vector<CMIDIMappingDirective>::const_iterator const_iterator; + typedef std::vector<CMIDIMappingDirective>::const_iterator const_iterator; CMIDIMapper(CSoundFile& sndfile) : m_rSndFile(sndfile) {} //If mapping found: @@ -121,5 +120,5 @@ private: CSoundFile& m_rSndFile; - vector<CMIDIMappingDirective> m_Directives; + std::vector<CMIDIMappingDirective> m_Directives; }; Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -253,7 +253,7 @@ foundHacks = true; if(autofix) { - vector<bool> usedChannels; + std::vector<bool> usedChannels; CheckUsedChannels(usedChannels); RemoveChannels(usedChannels); // REQUIRES (INTELLIGENT) AUTOFIX Modified: trunk/OpenMPT/mptrack/Mod2wave.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Mod2wave.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -780,7 +780,7 @@ UINT lRead = m_pSndFile->ReadInterleaved(buffer, sizeof(buffer)/(m_pSndFile->m_MixerSettings.gnChannels*m_pSndFile->m_MixerSettings.GetBitsPerSample()/8)); // Process cue points (add base offset), if there are any to process. - vector<PatternCuePoint>::reverse_iterator iter; + std::vector<PatternCuePoint>::reverse_iterator iter; for(iter = m_pSndFile->m_PatternCuePoints.rbegin(); iter != m_pSndFile->m_PatternCuePoints.rend(); ++iter) { if(iter->processed) @@ -922,7 +922,7 @@ fwrite(&cuehdr, 1, sizeof(WavCueHeader), f); // Write all cue points - vector<PatternCuePoint>::const_iterator iter; + std::vector<PatternCuePoint>::const_iterator iter; DWORD num = 0; for(iter = m_pSndFile->m_PatternCuePoints.begin(); iter != m_pSndFile->m_PatternCuePoints.end(); ++iter, num++) { Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -175,8 +175,8 @@ ModCommand *m = m_SndFile.Patterns[pat]; // This is used for -> MOD/XM conversion - vector<vector<ModCommand::PARAM> > effMemory(GetNumChannels()); - vector<ModCommand::VOL> volMemory(GetNumChannels(), 0); + std::vector<std::vector<ModCommand::PARAM> > effMemory(GetNumChannels()); + std::vector<ModCommand::VOL> volMemory(GetNumChannels(), 0); for(size_t i = 0; i < GetNumChannels(); i++) { effMemory[i].resize(MAX_EFFECTS, 0); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -1689,10 +1689,10 @@ int nRenderPasses = 1; // Channel mode - vector<bool> usedChannels; - vector<ChannelFlags> channelFlags; + std::vector<bool> usedChannels; + std::vector<ChannelFlags> channelFlags; // Instrument mode - vector<bool> instrMuteState; + std::vector<bool> instrMuteState; // Channel mode: save song in multiple wav files (one for each enabled channels) if(wsdlg.m_bChannelMode) Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Moddoc.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -262,8 +262,8 @@ CSampleUndo &GetSampleUndo() { return m_SampleUndo; } SplitKeyboardSettings &GetSplitKeyboardSettings() { return m_SplitKeyboardSettings; } - vector<FileHistory> &GetFileHistory() { return m_FileHistory; } - const vector<FileHistory> &GetFileHistory() const { return m_FileHistory; } + std::vector<FileHistory> &GetFileHistory() { return m_FileHistory; } + const std::vector<FileHistory> &GetFileHistory() const { return m_FileHistory; } time_t GetCreationTime() const { return m_creationTime; } // operations @@ -271,17 +271,17 @@ bool ChangeModType(MODTYPE wType); bool ChangeNumChannels(CHANNELINDEX nNewChannels, const bool showCancelInRemoveDlg = true); - bool RemoveChannels(const vector<bool> &keepMask); - CHANNELINDEX ReArrangeChannels(const vector<CHANNELINDEX> &fromToArray, const bool createUndoPoint = true); - void CheckUsedChannels(vector<bool> &usedMask, CHANNELINDEX maxRemoveCount = MAX_BASECHANNELS) const; + bool RemoveChannels(const std::vector<bool> &keepMask); + CHANNELINDEX ReArrangeChannels(const std::vector<CHANNELINDEX> &fromToArray, const bool createUndoPoint = true); + void CheckUsedChannels(std::vector<bool> &usedMask, CHANNELINDEX maxRemoveCount = MAX_BASECHANNELS) const; - SAMPLEINDEX ReArrangeSamples(const vector<SAMPLEINDEX> &newOrder); + SAMPLEINDEX ReArrangeSamples(const std::vector<SAMPLEINDEX> &newOrder); - INSTRUMENTINDEX ReArrangeInstruments(const vector<INSTRUMENTINDEX> &newOrder, deleteInstrumentSamples removeSamples = doNoDeleteAssociatedSamples); + INSTRUMENTINDEX ReArrangeInstruments(const std::vector<INSTRUMENTINDEX> &newOrder, deleteInstrumentSamples removeSamples = doNoDeleteAssociatedSamples); bool ConvertInstrumentsToSamples(); bool ConvertSamplesToInstruments(); - UINT RemovePlugs(const vector<bool> &keepMask); + UINT RemovePlugs(const std::vector<bool> &keepMask); PATTERNINDEX InsertPattern(ORDERINDEX nOrd = ORDERINDEX_INVALID, ROWINDEX nRows = 64); SAMPLEINDEX InsertSample(bool bLimit = false); Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -72,7 +72,7 @@ { // Increasing number of channels BeginWaitCursor(); - vector<CHANNELINDEX> channels(nNewChannels, CHANNELINDEX_INVALID); + std::vector<CHANNELINDEX> channels(nNewChannels, CHANNELINDEX_INVALID); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { channels[nChn] = nChn; @@ -91,8 +91,8 @@ // To remove all channels whose index corresponds to false in the keepMask vector. // Return true on success. -bool CModDoc::RemoveChannels(const vector<bool> &keepMask) -//-------------------------------------------------------- +bool CModDoc::RemoveChannels(const std::vector<bool> &keepMask) +//------------------------------------------------------------- { CHANNELINDEX nRemainingChannels = 0; //First calculating how many channels are to be left @@ -113,7 +113,7 @@ BeginWaitCursor(); // Create new channel order, with only channels from m_bChnMask left. - vector<CHANNELINDEX> channels(nRemainingChannels, 0); + std::vector<CHANNELINDEX> channels(nRemainingChannels, 0); CHANNELINDEX i = 0; for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { @@ -136,8 +136,8 @@ // Base code for adding, removing, moving and duplicating channels. Returns new number of channels on success, CHANNELINDEX_INVALID otherwise. // The new channel vector can contain CHANNELINDEX_INVALID for adding new (empty) channels. -CHANNELINDEX CModDoc::ReArrangeChannels(const vector<CHANNELINDEX> &newOrder, const bool createUndoPoint) -//------------------------------------------------------------------------------------------------------- +CHANNELINDEX CModDoc::ReArrangeChannels(const std::vector<CHANNELINDEX> &newOrder, const bool createUndoPoint) +//------------------------------------------------------------------------------------------------------------ { //newOrder[i] tells which current channel should be placed to i:th position in //the new order, or if i is not an index of current channels, then new channel is @@ -197,8 +197,8 @@ ModChannel chns[MAX_BASECHANNELS]; ModChannelSettings settings[MAX_BASECHANNELS]; - vector<BYTE> recordStates(GetNumChannels(), 0); - vector<bool> chnMutePendings(GetNumChannels(), false); + std::vector<BYTE> recordStates(GetNumChannels(), 0); + std::vector<bool> chnMutePendings(GetNumChannels(), false); for(CHANNELINDEX nChn = 0; nChn < GetNumChannels(); nChn++) { @@ -244,7 +244,7 @@ struct RewriteInstrumentReferencesInPatterns //========================================== { - RewriteInstrumentReferencesInPatterns(const vector<ModCommand::INSTR> &indices) : instrumentIndices(indices) + RewriteInstrumentReferencesInPatterns(const std::vector<ModCommand::INSTR> &indices) : instrumentIndices(indices) { } @@ -256,15 +256,15 @@ } } - const vector<ModCommand::INSTR> &instrumentIndices; + const std::vector<ModCommand::INSTR> &instrumentIndices; }; // Base code for adding, removing, moving and duplicating samples. Returns new number of samples on success, SAMPLEINDEX_INVALID otherwise. // The new sample vector can contain SAMPLEINDEX_INVALID for adding new (empty) samples. // newOrder indices are zero-based, i.e. newOrder[0] will define the contents of the first sample slot. -SAMPLEINDEX CModDoc::ReArrangeSamples(const vector<SAMPLEINDEX> &newOrder) -//------------------------------------------------------------------------ +SAMPLEINDEX CModDoc::ReArrangeSamples(const std::vector<SAMPLEINDEX> &newOrder) +//----------------------------------------------------------------------------- { if(newOrder.size() > m_SndFile.GetModSpecifications().samplesMax) { @@ -283,10 +283,10 @@ } } - vector<int> sampleCount(oldNumSamples + 1, 0); - vector<ModSample> sampleHeaders(oldNumSamples + 1); - vector<SAMPLEINDEX> newIndex(oldNumSamples + 1, 0); // One of the new indexes for the old sample - vector<std::string> sampleNames(oldNumSamples + 1); + std::vector<int> sampleCount(oldNumSamples + 1, 0); + std::vector<ModSample> sampleHeaders(oldNumSamples + 1); + std::vector<SAMPLEINDEX> newIndex(oldNumSamples + 1, 0); // One of the new indexes for the old sample + std::vector<std::string> sampleNames(oldNumSamples + 1); for(size_t i = 0; i < newOrder.size(); i++) { @@ -368,7 +368,7 @@ { PrepareUndoForAllPatterns(); - vector<ModCommand::INSTR> indices(newIndex.size(), 0); + std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) { indices[i] = newIndex[i]; @@ -383,8 +383,8 @@ // Base code for adding, removing, moving and duplicating instruments. Returns new number of instruments on success, INSTRUMENTINDEX_INVALID otherwise. // The new instrument vector can contain INSTRUMENTINDEX_INVALID for adding new (empty) instruments. // newOrder indices are zero-based, i.e. newOrder[0] will define the contents of the first instrument slot. -INSTRUMENTINDEX CModDoc::ReArrangeInstruments(const vector<INSTRUMENTINDEX> &newOrder, deleteInstrumentSamples removeSamples) -//--------------------------------------------------------------------------------------------------------------------------- +INSTRUMENTINDEX CModDoc::ReArrangeInstruments(const std::vector<INSTRUMENTINDEX> &newOrder, deleteInstrumentSamples removeSamples) +//-------------------------------------------------------------------------------------------------------------------------------- { if(newOrder.size() > m_SndFile.GetModSpecifications().instrumentsMax || GetNumInstruments() == 0) { @@ -395,8 +395,8 @@ const INSTRUMENTINDEX oldNumInstruments = m_SndFile.GetNumInstruments(), newNumInstruments = static_cast<INSTRUMENTINDEX>(newOrder.size()); - vector<ModInstrument> instrumentHeaders(oldNumInstruments + 1); - vector<INSTRUMENTINDEX> newIndex(oldNumInstruments + 1, 0); // One of the new indexes for the old instrument + std::vector<ModInstrument> instrumentHeaders(oldNumInstruments + 1); + std::vector<INSTRUMENTINDEX> newIndex(oldNumInstruments + 1, 0); // One of the new indexes for the old instrument for(size_t i = 0; i < newNumInstruments; i++) { const INSTRUMENTINDEX origSlot = newOrder[i]; @@ -444,7 +444,7 @@ PrepareUndoForAllPatterns(); - vector<ModCommand::INSTR> indices(newIndex.size(), 0); + std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) { indices[i] = newIndex[i]; @@ -541,8 +541,8 @@ } -UINT CModDoc::RemovePlugs(const vector<bool> &keepMask) -//----------------------------------------------------- +UINT CModDoc::RemovePlugs(const std::vector<bool> &keepMask) +//---------------------------------------------------------- { //Remove all plugins whose keepMask[plugindex] is false. UINT nRemoved = 0; @@ -1076,8 +1076,8 @@ // Check which channels contain note data. maxRemoveCount specified how many empty channels are reported at max. -void CModDoc::CheckUsedChannels(vector<bool> &usedMask, CHANNELINDEX maxRemoveCount) const -//---------------------------------------------------------------------------------------- +void CModDoc::CheckUsedChannels(std::vector<bool> &usedMask, CHANNELINDEX maxRemoveCount) const +//--------------------------------------------------------------------------------------------- { // Checking for unused channels const int nChannels = GetNumChannels(); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -350,8 +350,8 @@ CHAR s[16]; m_CbnMixingFreq.ResetContent(); - vector<bool> supportedRates; - vector<UINT> samplerates; + std::vector<bool> supportedRates; + std::vector<UINT> samplerates; for(size_t i = 0; i < CountOf(nMixingRates); i++) { samplerates.push_back(nMixingRates[i]); Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -224,8 +224,8 @@ } } - vector<CModDoc *> documents = theApp.GetOpenDocuments(); - for(vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) + std::vector<CModDoc *> documents = theApp.GetOpenDocuments(); + for(std::vector<CModDoc *>::iterator doc = documents.begin(); doc != documents.end(); doc++) { (*doc)->SafeFileClose(); } @@ -240,10 +240,10 @@ // Retrieve a list of all open modules. -vector<CModDoc *> CTrackApp::GetOpenDocuments() const -//--------------------------------------------------- +std::vector<CModDoc *> CTrackApp::GetOpenDocuments() const +//-------------------------------------------------------- { - vector<CModDoc *> documents; + std::vector<CModDoc *> documents; CDocTemplate *pDocTmpl = theApp.GetModDocTemplate(); if(pDocTmpl) @@ -430,7 +430,7 @@ // DLS Banks support #define MPTRACK_REG_DLS "Software\\Olivier Lapicque\\ModPlug Tracker\\DLS Banks" -vector<CDLSBank *> CTrackApp::gpDLSBanks; +std::vector<CDLSBank *> CTrackApp::gpDLSBanks; BOOL CTrackApp::LoadDefaultDLSBanks() @@ -2257,7 +2257,7 @@ if(filterIndex != nullptr) dlg.m_ofn.nFilterIndex = (DWORD)(*filterIndex); - vector<TCHAR> filenameBuffer; + std::vector<TCHAR> filenameBuffer; if(multiSelect) { const size_t bufferSize = 2048; // Note: This is possibly the maximum buffer size in MFC 7(this note was written November 2006). Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -31,9 +31,7 @@ #define NOTEINDEXTYPE CTuning::NOTEINDEXTYPE #define EM_ALLOWALL CTuning::EM_ALLOWALL -using namespace std; - /* TODOS: -Clear tuning @@ -444,7 +442,7 @@ } -TUNINGTYPE CTuningDialog::GetTuningTypeFromStr(const string& str) const +TUNINGTYPE CTuningDialog::GetTuningTypeFromStr(const std::string& str) const //-------------------------------------------------------------------------------- { return CTuning::GetTuningType(str.c_str()); @@ -459,7 +457,7 @@ const size_t BS = 20; char buffer[BS]; m_CombobTuningType.GetWindowText(buffer, BS); - const string strNewType = buffer; + const std::string strNewType = buffer; TUNINGTYPE newType = GetTuningTypeFromStr(strNewType); if(!m_pActiveTuning->IsOfType(newType)) { @@ -535,7 +533,7 @@ const size_t BS = 5; char buffer[BS]; m_EditNotename.GetWindowText(buffer, BS); - string str = string(buffer); + std::string str = std::string(buffer); if(str.length() > 0) { if(str.size() > 3) @@ -568,7 +566,7 @@ const size_t BS = 12; char buffer[BS]; m_EditRatio.GetWindowText(buffer, BS); - string str = buffer; + std::string str = buffer; if(str.length() > 0) { m_pActiveTuning->SetRatio(currentNote, ConvertStrTo<RATIOTYPE>(buffer)); @@ -628,9 +626,9 @@ std::string filter; if(pT != NULL) - filter = string("Tuning files (*") + CTuning::s_FileExtension + string(")|*") + CTuning::s_FileExtension + string("|"); + filter = std::string("Tuning files (*") + CTuning::s_FileExtension + std::string(")|*") + CTuning::s_FileExtension + std::string("|"); if(pTC != NULL) - filter += string("Tuning collection files (") + CTuningCollection::s_FileExtension + string(")|*") + CTuningCollection::s_FileExtension + string("|"); + filter += std::string("Tuning collection files (") + CTuningCollection::s_FileExtension + std::string(")|*") + CTuningCollection::s_FileExtension + std::string("|"); FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, CTuning::s_FileExtension, "", filter, @@ -641,8 +639,8 @@ bool failure = true; - ofstream fout(files.first_file.c_str(), ios::binary); - const string ext = "." + files.extension; + std::ofstream fout(files.first_file.c_str(), std::ios::binary); + const std::string ext = "." + files.extension; if(ext == CTuning::s_FileExtension) { @@ -701,7 +699,7 @@ if (bIsTun) { - std::ifstream fin(files.filenames[counter].c_str(), ios::binary); + std::ifstream fin(files.filenames[counter].c_str(), std::ios::binary); pT = CTuningRTI::DeserializeOLD(fin); if(pT == 0) {fin.clear(); fin.seekg(0); pT = CTuningRTI::Deserialize(fin);} @@ -1075,7 +1073,7 @@ bool CTuningDialog::IsDeletable(const CTuningCollection* const pTC) const //-------------------------------------------------------------------------------- { - vector<CTuningCollection*>::const_iterator iter = find(m_DeletableTuningCollections.begin(), m_DeletableTuningCollections.end(), pTC); + std::vector<CTuningCollection*>::const_iterator iter = find(m_DeletableTuningCollections.begin(), m_DeletableTuningCollections.end(), pTC); if(iter != m_DeletableTuningCollections.end()) return true; else @@ -1218,7 +1216,7 @@ CTuningCollection* pTC = GetpTuningCollection(pT); if(pTC) { - string str = string("Remove tuning '") + pT->GetName() + string("' from ' ") + pTC->GetName() + string("'?"); + std::string str = std::string("Remove tuning '") + pT->GetName() + std::string("' from ' ") + pTC->GetName() + std::string("'?"); if(Reporting::Confirm(str.c_str()) == cnfYes) { if(!pTC->Remove(pT)) Modified: trunk/OpenMPT/mptrack/TuningDialog.h =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/TuningDialog.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -18,9 +18,6 @@ #include "afxwin.h" #include "resource.h" -using std::vector; -using std::string; - //========================== template<class T1, class T2> class CBijectiveMap @@ -52,7 +49,7 @@ void RemoveValue_1(const T1& a) { - typename vector<T1>::iterator iter = find(m_T1.begin(), m_T1.end(), a); + typename std::vector<T1>::iterator iter = find(m_T1.begin(), m_T1.end(), a); if(iter != m_T1.end()) { m_T2.erase(m_T2.begin() + (iter-m_T1.begin())); @@ -62,7 +59,7 @@ void RemoveValue_2(const T2& b) { - typename vector<T2>::iterator iter = find(m_T2.begin(), m_T2.end(), b); + typename std::vector<T2>::iterator iter = find(m_T2.begin(), m_T2.end(), b); if(iter != m_T2.end()) { m_T1.erase(m_T1.begin() + (iter-m_T2.begin())); @@ -72,7 +69,7 @@ T2 GetMapping_12(const T1& a) const { - typename vector<T1>::const_iterator iter = find(m_T1.begin(), m_T1.end(), a); + typename std::vector<T1>::const_iterator iter = find(m_T1.begin(), m_T1.end(), a); if(iter != m_T1.end()) { return m_T2[iter-m_T1.begin()]; @@ -83,7 +80,7 @@ T1 GetMapping_21(const T2& b) const { - typename vector<T2>::const_iterator iter = find(m_T2.begin(), m_T2.end(), b); + typename std::vector<T2>::const_iterator iter = find(m_T2.begin(), m_T2.end(), b); if(iter != m_T2.end()) { return m_T1[iter-m_T2.begin()]; @@ -95,8 +92,8 @@ private: //Elements are collected to two arrays so that elements with the //same index are mapped to each other. - vector<T1> m_T1; - vector<T2> m_T2; + std::vector<T1> m_T1; + std::vector<T2> m_T2; T1 m_NotFoundT1; T2 m_NotFoundT2; @@ -211,7 +208,7 @@ }; public: - typedef vector<CTuningCollection*> TUNINGVECTOR; + typedef std::vector<CTuningCollection*> TUNINGVECTOR; public: CTuningDialog(CWnd* pParent = NULL, const TUNINGVECTOR& = TUNINGVECTOR(), CTuning* pTun = NULL); // standard constructor @@ -231,7 +228,7 @@ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support private: - CTuning::TUNINGTYPE GetTuningTypeFromStr(const string& str) const; + CTuning::TUNINGTYPE GetTuningTypeFromStr(const std::string& str) const; void UpdateTuningDescription(); @@ -265,7 +262,7 @@ private: CTuningRatioMapWnd m_RatioMapWnd; TUNINGVECTOR m_TuningCollections; - vector<CTuningCollection*> m_DeletableTuningCollections; + std::vector<CTuningCollection*> m_DeletableTuningCollections; CTuning* m_pActiveTuning; CTuningCollection* m_pActiveTuningCollection; Modified: trunk/OpenMPT/mptrack/Undo.cpp =================================================================== --- trunk/OpenMPT/mptrack/Undo.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Undo.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -140,7 +140,7 @@ if(undo.channelInfo->oldNumChannels != sndFile.GetNumChannels()) { // Add or remove channels - vector<CHANNELINDEX> channels(undo.channelInfo->oldNumChannels, CHANNELINDEX_INVALID); + std::vector<CHANNELINDEX> channels(undo.channelInfo->oldNumChannels, CHANNELINDEX_INVALID); const CHANNELINDEX copyCount = std::min(sndFile.GetNumChannels(), undo.channelInfo->oldNumChannels); for(CHANNELINDEX i = 0; i < copyCount; i++) { Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -1262,7 +1262,7 @@ } } - vector<PLUGINDEX> emptySlots; + std::vector<PLUGINDEX> emptySlots; BuildEmptySlotList(emptySlots); dlg.SetupMove(m_nCurrentPlugin, emptySlots, defaultIndex); @@ -1371,8 +1371,8 @@ } -void CViewGlobals::BuildEmptySlotList(vector<PLUGINDEX> &emptySlots) -//------------------------------------------------------------------ +void CViewGlobals::BuildEmptySlotList(std::vector<PLUGINDEX> &emptySlots) +//----------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); CSoundFile* pSndFile = pModDoc->GetSoundFile(); Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_gen.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -68,7 +68,7 @@ void UnlockControls() { PostMessage(WM_MOD_UNLOCKCONTROLS); } BOOL IsLocked() const { return (m_nLockCount > 0); } int GetDlgItemIntEx(UINT nID); - void BuildEmptySlotList(vector<PLUGINDEX> &emptySlots); + void BuildEmptySlotList(std::vector<PLUGINDEX> &emptySlots); bool MovePlug(PLUGINDEX src, PLUGINDEX dest, bool bAdjustPat = AdjustPattern); public: Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -1299,7 +1299,7 @@ const bool duplicate = (nFlags & MK_SHIFT) != 0; const CHANNELINDEX newChannels = pModDoc->GetNumChannels() + (duplicate ? 1 : 0); - vector<CHANNELINDEX> channels(newChannels, 0); + std::vector<CHANNELINDEX> channels(newChannels, 0); CHANNELINDEX i = 0; bool modified = duplicate; @@ -2613,12 +2613,12 @@ } bool changed = false; - vector<CHANNELINDEX> validChans; + std::vector<CHANNELINDEX> validChans; if(type == PatternCursor::effectColumn || type == PatternCursor::paramColumn) { - vector<CHANNELINDEX> effectChans; - vector<CHANNELINDEX> paramChans; + std::vector<CHANNELINDEX> effectChans; + std::vector<CHANNELINDEX> paramChans; ListChansWhereColSelected(PatternCursor::effectColumn, effectChans); ListChansWhereColSelected(PatternCursor::paramColumn, paramChans); @@ -2677,7 +2677,7 @@ const ROWINDEX row0 = m_Selection.GetStartRow(), row1 = m_Selection.GetEndRow(); //for all channels where type is selected - for(vector<CHANNELINDEX>::iterator iter = validChans.begin(); iter != validChans.end(); iter++) + for(std::vector<CHANNELINDEX>::iterator iter = validChans.begin(); iter != validChans.end(); iter++) { CHANNELINDEX nchn = *iter; @@ -3151,7 +3151,7 @@ str.Format("Remove channel %d? This channel still contains note data!", nChn + 1); if(isEmpty || Reporting::Confirm(str , "Remove channel") == cnfYes) { - vector<bool> keepMask(pModDoc->GetNumChannels(), true); + std::vector<bool> keepMask(pModDoc->GetNumChannels(), true); keepMask[nChn] = false; pModDoc->RemoveChannels(keepMask); SetCurrentPattern(m_nPattern); //Updating the screen. @@ -3167,7 +3167,7 @@ BeginWaitCursor(); // Create new channel order, with channel nBefore being an invalid (and thus empty) channel. - vector<CHANNELINDEX> channels(pModDoc->GetNumChannels() + 1, CHANNELINDEX_INVALID); + std::vector<CHANNELINDEX> channels(pModDoc->GetNumChannels() + 1, CHANNELINDEX_INVALID); CHANNELINDEX i = 0; for(CHANNELINDEX nChn = 0; nChn < pModDoc->GetNumChannels() + 1; nChn++) { @@ -3203,7 +3203,7 @@ BeginWaitCursor(); // Create new channel order, with channel nDupChn duplicated. - vector<CHANNELINDEX> channels(pModDoc->GetNumChannels() + 1, 0); + std::vector<CHANNELINDEX> channels(pModDoc->GetNumChannels() + 1, 0); CHANNELINDEX i = 0; for(CHANNELINDEX nChn = 0; nChn < pModDoc->GetNumChannels() + 1; nChn++) { @@ -3355,7 +3355,7 @@ } // Volume memory for each channel. - vector<uint8> chvol(lastChannel + 1, 64); + std::vector<uint8> chvol(lastChannel + 1, 64); for(ROWINDEX nRow = firstRow; nRow <= lastRow; nRow++) { @@ -6093,7 +6093,7 @@ { HMENU transMenu = CreatePopupMenu(); - vector<CHANNELINDEX> validChans; + std::vector<CHANNELINDEX> validChans; DWORD greyed = IsColumnSelected(PatternCursor::noteColumn) ? FALSE : MF_GRAYED; if(!greyed || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) @@ -6112,7 +6112,7 @@ bool CViewPattern::BuildAmplifyCtxMenu(HMENU hMenu, CInputHandler *ih) const //-------------------------------------------------------------------------- { - vector<CHANNELINDEX> validChans; + std::vector<CHANNELINDEX> validChans; DWORD greyed = IsColumnSelected(PatternCursor::volumeColumn) ? 0 : MF_GRAYED; if(!greyed || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) @@ -6157,7 +6157,7 @@ } - vector<CHANNELINDEX> validChans; + std::vector<CHANNELINDEX> validChans; DWORD greyed = IsColumnSelected(PatternCursor::instrColumn) ? 0 : MF_GRAYED; if (!greyed || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) @@ -6275,8 +6275,8 @@ // Returns an ordered list of all channels in which a given column type is selected. -CHANNELINDEX CViewPattern::ListChansWhereColSelected(PatternCursor::Columns colType, vector<CHANNELINDEX> &chans) const -//--------------------------------------------------------------------------------------------------------------------- +CHANNELINDEX CViewPattern::ListChansWhereColSelected(PatternCursor::Columns colType, std::vector<CHANNELINDEX> &chans) const +//-------------------------------------------------------------------------------------------------------------------------- { CHANNELINDEX startChan = m_Selection.GetStartChannel(); CHANNELINDEX endChan = m_Selection.GetEndChannel(); @@ -6310,12 +6310,12 @@ bool CViewPattern::IsInterpolationPossible(PatternCursor::Columns colType) const //------------------------------------------------------------------------------ { - vector<CHANNELINDEX> validChans; + std::vector<CHANNELINDEX> validChans; ListChansWhereColSelected(colType, validChans); ROWINDEX startRow = m_Selection.GetStartRow(); ROWINDEX endRow = m_Selection.GetEndRow(); - for(vector<CHANNELINDEX>::iterator iter = validChans.begin(); iter != validChans.end(); iter++) + for(std::vector<CHANNELINDEX>::iterator iter = validChans.begin(); iter != validChans.end(); iter++) { if(IsInterpolationPossible(startRow, endRow, *iter, colType)) { Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -191,7 +191,7 @@ QuickChannelProperties quickChannelProperties; - vector<ModCommand::NOTE> octaveKeyMemory; + std::vector<ModCommand::NOTE> octaveKeyMemory; // Chord preview CHANNELINDEX chordPatternChannels[MPTChord::notesPerChord]; @@ -466,7 +466,7 @@ bool BuildPCNoteCtxMenu(HMENU hMenu, CInputHandler *ih) const; // Returns an ordered list of all channels in which a given column type is selected. - CHANNELINDEX ListChansWhereColSelected(PatternCursor::Columns colType, vector<CHANNELINDEX> &chans) const; + CHANNELINDEX ListChansWhereColSelected(PatternCursor::Columns colType, std::vector<CHANNELINDEX> &chans) const; // Check if a column type is selected on any channel in the current selection. bool IsColumnSelected(PatternCursor::Columns colType) const; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -135,7 +135,7 @@ CModTree::~CModTree() //------------------- { - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for(iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { delete (*iter); @@ -309,7 +309,7 @@ //------------------------------------------ { // Check if document is already in the list - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { if ((*iter)->pModDoc == pModDoc) @@ -340,7 +340,7 @@ void CModTree::RemoveDocument(CModDoc *pModDoc) //--------------------------------------------- { - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { if((*iter)->pModDoc == pModDoc) @@ -366,7 +366,7 @@ } if (hItem != NULL) { - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { if (hItem == (*iter)->hSong) return (*iter)->pModDoc; @@ -380,7 +380,7 @@ ModTreeDocInfo *CModTree::GetDocumentInfoFromModDoc(CModDoc *pModDoc) //------------------------------------------------------------------- { - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { if ((*iter)->pModDoc == pModDoc) @@ -2154,7 +2154,7 @@ { const SAMPLEINDEX from = static_cast<SAMPLEINDEX>(modItemDragID - 1), to = static_cast<SAMPLEINDEX>(modItemDropID - 1); - vector<SAMPLEINDEX> newOrder(pModDoc->GetNumSamples()); + std::vector<SAMPLEINDEX> newOrder(pModDoc->GetNumSamples()); for(SAMPLEINDEX smp = 0; smp < pModDoc->GetNumSamples(); smp++) { newOrder[smp] = smp + 1; @@ -2181,7 +2181,7 @@ { const INSTRUMENTINDEX from = static_cast<INSTRUMENTINDEX>(modItemDragID - 1), to = static_cast<INSTRUMENTINDEX>(modItemDropID - 1); - vector<INSTRUMENTINDEX> newOrder(pModDoc->GetNumInstruments()); + std::vector<INSTRUMENTINDEX> newOrder(pModDoc->GetNumInstruments()); for(INSTRUMENTINDEX ins = 0; ins < pModDoc->GetNumInstruments(); ins++) { newOrder[ins] = ins + 1; @@ -2300,7 +2300,7 @@ dwHint &= (HINT_PATNAMES|HINT_SMPNAMES|HINT_INSNAMES|HINT_MODTYPE|HINT_MODGENERAL|HINT_MODSEQUENCE|HINT_MIXPLUGINS|HINT_MPTOPTIONS|HINT_MASK_ITEM|HINT_SEQNAMES); if ((pHint != this) && (dwHint & HINT_MASK_FLAGS)) { - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { if (((*iter)->pModDoc == pModDoc) || (!pModDoc)) @@ -2879,7 +2879,7 @@ //---------------------------- { BeginWaitCursor(); - vector<ModTreeDocInfo *>::iterator iter; + std::vector<ModTreeDocInfo *>::iterator iter; for (iter = DocInfo.begin(); iter != DocInfo.end(); iter++) { UpdateView((*iter), HINT_MODTYPE); @@ -3025,10 +3025,10 @@ // Helper function for generating an insert vector for samples/instruments template<typename T> -vector<T> GenerateInsertVector(size_t howMany, size_t insertPos, T insertId) -//-------------------------------------------------------------------------- +std::vector<T> GenerateInsertVector(size_t howMany, size_t insertPos, T insertId) +//------------------------------------------------------------------------------- { - vector<T> newOrder(howMany); + std::vector<T> newOrder(howMany); for(T i = 0; i < howMany; i++) { newOrder[i] = i + 1; @@ -3063,7 +3063,7 @@ } else if(modItemType == MODITEM_SAMPLE) { // Duplicate sample - vector<SAMPLEINDEX> newOrder = GenerateInsertVector<SAMPLEINDEX>(pSndFile->GetNumSamples(), modItemID, static_cast<SAMPLEINDEX>(modItemID)); + std::vector<SAMPLEINDEX> newOrder = GenerateInsertVector<SAMPLEINDEX>(pSndFile->GetNumSamples(), modItemID, static_cast<SAMPLEINDEX>(modItemID)); if(pModDoc->ReArrangeSamples(newOrder) != SAMPLEINDEX_INVALID) { pModDoc->SetModified(); @@ -3075,7 +3075,7 @@ } else if(modItemType == MODITEM_INSTRUMENT) { // Duplicate instrument - vector<INSTRUMENTINDEX> newOrder = GenerateInsertVector<INSTRUMENTINDEX>(pSndFile->GetNumInstruments(), modItemID, static_cast<INSTRUMENTINDEX>(modItemID)); + std::vector<INSTRUMENTINDEX> newOrder = GenerateInsertVector<INSTRUMENTINDEX>(pSndFile->GetNumInstruments(), modItemID, static_cast<INSTRUMENTINDEX>(modItemID)); if(pModDoc->ReArrangeInstruments(newOrder) != INSTRUMENTINDEX_INVALID) { pModDoc->UpdateAllViews(NULL, HINT_INSNAMES | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_PATTERNDATA); @@ -3113,7 +3113,7 @@ } else if(modItemType == MODITEM_SAMPLE) { // Insert sample - vector<SAMPLEINDEX> newOrder = GenerateInsertVector<SAMPLEINDEX>(pSndFile->GetNumSamples(), modItemID, 0); + std::vector<SAMPLEINDEX> newOrder = GenerateInsertVector<SAMPLEINDEX>(pSndFile->GetNumSamples(), modItemID, 0); if(pModDoc->ReArrangeSamples(newOrder) != SAMPLEINDEX_INVALID) { pModDoc->SetModified(); @@ -3125,7 +3125,7 @@ } else if(modItemType == MODITEM_INSTRUMENT) { // Insert instrument - vector<INSTRUMENTINDEX> newOrder = GenerateInsertVector<INSTRUMENTINDEX>(pSndFile->GetNumInstruments(), modItemID, 0); + std::vector<INSTRUMENTINDEX> newOrder = GenerateInsertVector<INSTRUMENTINDEX>(pSndFile->GetNumInstruments(), modItemID, 0); if(pModDoc->ReArrangeInstruments(newOrder) != INSTRUMENTINDEX_INVALID) { pModDoc->UpdateAllViews(NULL, HINT_INSNAMES| HINT_INSTRUMENT | HINT_ENVELOPE | HINT_PATTERNDATA); Modified: trunk/OpenMPT/mptrack/View_tre.h =================================================================== --- trunk/OpenMPT/mptrack/View_tre.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/View_tre.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -17,9 +17,6 @@ #include <vector> #include <bitset> -using std::vector; -using std::bitset; - #define TREESTATUS_RDRAG 0x01 #define TREESTATUS_LDRAG 0x02 #define TREESTATUS_SINGLEEXPAND 0x04 @@ -29,8 +26,8 @@ { CModDoc *pModDoc; // Tree state variables - vector<vector<HTREEITEM> > tiOrders; - vector<HTREEITEM> tiSequences, tiPatterns; + std::vector<std::vector<HTREEITEM> > tiOrders; + std::vector<HTREEITEM> tiSequences, tiPatterns; HTREEITEM hSong, hPatterns, hSamples, hInstruments, hComments, hOrders, hEffects; HTREEITEM tiSamples[MAX_SAMPLES]; HTREEITEM tiInstruments[MAX_INSTRUMENTS]; @@ -40,8 +37,8 @@ ORDERINDEX nOrdSel; SEQUENCEINDEX nSeqSel; - bitset<MAX_SAMPLES> samplesPlaying; - bitset<MAX_INSTRUMENTS> instrumentsPlaying; + std::bitset<MAX_SAMPLES> samplesPlaying; + std::bitset<MAX_INSTRUMENTS> instrumentsPlaying; ModTreeDocInfo(const CSoundFile &sndFile) { @@ -125,8 +122,8 @@ HTREEITEM m_tiMidiGrp[17]; HTREEITEM m_tiMidi[128]; HTREEITEM m_tiPerc[128]; - vector<HTREEITEM> m_tiDLS; - vector<ModTreeDocInfo *> DocInfo; + std::vector<HTREEITEM> m_tiDLS; + std::vector<ModTreeDocInfo *> DocInfo; // Instrument library bool m_bShowAllFiles, doLabelEdit; CHAR m_szInstrLibPath[_MAX_PATH], m_szOldPath[_MAX_PATH], m_szSongName[_MAX_PATH]; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -877,7 +877,7 @@ case audioMasterGetPreviousPlug: if(pVstPlugin != nullptr) { - vector<CVstPlugin *> list; + std::vector<CVstPlugin *> list; if(pVstPlugin->GetInputPlugList(list) != 0) { // We don't assign plugins to pins... @@ -890,7 +890,7 @@ case audioMasterGetNextPlug: if(pVstPlugin != nullptr) { - vector<CVstPlugin *> list; + std::vector<CVstPlugin *> list; if(pVstPlugin->GetOutputPlugList(list) != 0) { // We don't assign plugins to pins... @@ -2854,8 +2854,8 @@ // Get list of plugins to which output is sent. A nullptr indicates master output. -size_t CVstPlugin::GetOutputPlugList(vector<CVstPlugin *> &list) -//-------------------------------------------------------------- +size_t CVstPlugin::GetOutputPlugList(std::vector<CVstPlugin *> &list) +//------------------------------------------------------------------- { // At the moment we know there will only be 1 output. // Returning nullptr means plugin outputs directly to master. Modified: trunk/OpenMPT/mptrack/dlg_misc.h =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/dlg_misc.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -75,7 +75,7 @@ { public: CSoundFile &sndFile; - vector<bool> m_bKeepMask; + std::vector<bool> m_bKeepMask; CHANNELINDEX m_nChannels, m_nRemove; CListBox m_RemChansList; //rewbs.removeChansDlgCleanup bool m_ShowCancel; Modified: trunk/OpenMPT/mptrack/mod2midi.cpp =================================================================== --- trunk/OpenMPT/mptrack/mod2midi.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/mod2midi.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -363,7 +363,7 @@ RMIDDATACHUNK rmid; MTHDCHUNK mthd; MTRKCHUNK mtrk; - vector<DYNMIDITRACK> Tracks(m_pSndFile->GetNumChannels()); + std::vector<DYNMIDITRACK> Tracks(m_pSndFile->GetNumChannels()); UINT nMidiChCurPrg[16]; BYTE tmp[256]; CHAR s[256]; Modified: trunk/OpenMPT/mptrack/tagging.cpp =================================================================== --- trunk/OpenMPT/mptrack/tagging.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/tagging.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -91,8 +91,8 @@ } // Write a ID3v2 frame -void CFileTagging::WriteID3v2Frame(char cFrameID[4], string sFramecontent, FILE *f) -//--------------------------------------------------------------------------------- +void CFileTagging::WriteID3v2Frame(char cFrameID[4], std::string sFramecontent, FILE *f) +//-------------------------------------------------------------------------------------- { if(!cFrameID[0] || sFramecontent.empty() || !f) return; @@ -138,7 +138,7 @@ struct { uint32 id; - string *data; + std::string *data; } chunks[] = { { IFFID_ICMT, &comments }, @@ -170,7 +170,7 @@ continue; } - string data = *chunks[iCmt].data; + std::string data = *chunks[iCmt].data; // Special case: Expand year to full date if(chunks[iCmt].id == IFFID_ICRD) { Modified: trunk/OpenMPT/mptrack/tagging.h =================================================================== --- trunk/OpenMPT/mptrack/tagging.h 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/tagging.h 2013-06-27 15:00:03 UTC (rev 2416) @@ -13,8 +13,6 @@ #include <string> #include "Wav.h" -using std::string; - /////////////////////////////////////////////////////////////////////////////////////////////////// // ID3v2.4 Tags @@ -73,7 +71,7 @@ void WriteWaveTags(WAVEDATAHEADER *wdh, WAVEFILEHEADER *wfh, FILE *f); // Tag data - string title, artist, album, year, comments, genre, url, encoder, bpm; + std::string title, artist, album, year, comments, genre, url, encoder, bpm; CFileTagging(); @@ -82,7 +80,7 @@ // Convert Integer to Synchsafe Integer (see ID3v2.4 specs) uint32 intToSynchsafe(uint32 in); // Write a frame - void WriteID3v2Frame(char cFrameID[4], string sFramecontent, FILE *f); + void WriteID3v2Frame(char cFrameID[4], std::string sFramecontent, FILE *f); // Size of our tag uint32 totalID3v2Size; }; Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -73,7 +73,7 @@ s[0] = 0; const bool isValidNote = m_pTuning->IsValidNote(noteToDraw); - string temp; + std::string temp; if(isValidNote) { temp = "(" + Stringify(noteToDraw) + ") " + m_pTuning->GetNoteName(noteToDraw); @@ -100,7 +100,7 @@ rect.InflateRect(1, 1); } dc.SetTextColor((bHighLight) ? colorTextSel : colorText); - string str = Stringify(m_pTuning->GetRatio(noteToDraw)); + std::string str = Stringify(m_pTuning->GetRatio(noteToDraw)); dc.DrawText(str.c_str(), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } rect.SetRect(rcClient.left+m_cxFont*2-1, rcClient.top, rcClient.left+m_cxFont*2+3, ypaint); Modified: trunk/OpenMPT/soundlib/Load_itp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_itp.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/soundlib/Load_itp.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -451,7 +451,7 @@ id = m_nSamples; fwrite(&id, 1, sizeof(id), f); - vector<bool> sampleUsed(GetNumSamples() + 1, false); + std::vector<bool> sampleUsed(GetNumSamples() + 1, false); // Mark samples used in instruments for(i = 0; i < m_nInstruments; i++) Modified: trunk/OpenMPT/soundlib/Load_mid.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mid.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/soundlib/Load_mid.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -473,7 +473,7 @@ const MIDITRACKHEADER *pmth; MODCHANNELSTATE chnstate[MAX_BASECHANNELS]; MIDICHANNELSTATE midichstate[16]; - vector<MIDITRACK> miditracks; + std::vector<MIDITRACK> miditracks; DWORD dwMemPos, dwGlobalFlags, tracks, tempo; UINT row, pat, midimastervol; short int division; Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-27 14:21:41 UTC (rev 2415) +++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-27 15:00:03 UTC (rev 2416) @@ -27,8 +27,6 @@ -Handle const-status better(e.g. status check in unserialization) */ -using namespace std; - const TCHAR CTuningCollection::s_FileExtension[4] = MPT_TEXT(".tc"); namespace CTuningS11n @@ -40,7 +38,7 @@ void ReadRatioTable(std::istream& iStrm, std::vector<CTuningRTI::RATIOTYPE>& v, const size_t); void WriteStr(std::ostream& oStrm, const std::string& str); - void ReadTuning(istream& iStrm, CTuningCollection& Tc, const size_t) {Tc.AddTuning(iStrm, true);} + void ReadTuning(std::istream& iStrm, CTuningCollection& Tc, const size_t) {Tc.AddTuning(iStrm, true);} void WriteTuning(std::ostream& oStrm, const CTuning& t) {t.Serialize(oStrm);} } // namespace CTuningS11n @@ -101,7 +99,7 @@ } -CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Serialize(ostream& oStrm) const +CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Serialize(std::ostream& oStrm) const //-------------------------------------------------------------- { srlztn::Ssb ssb(oStrm); @@ -126,7 +124,7 @@ { if(m_SavefilePath.length() < 1) return SERIALIZATION_FAILURE; - ofstream fout(m_SavefilePath.c_str(), ios::binary); + std::ofstream fout(m_SavefilePath.c_str(), std::ios::binary); if(!fout.good()) return SERIALIZATION_FAILURE; @@ -141,7 +139,7 @@ { if(m_SavefilePath.length() < 1) return SERIALIZATION_FAILURE; - ifstream fin(m_SavefilePath.c_str(), ios::binary); + std::ifstream fin(m_SavefilePath.c_str(), std::ios::binary); if(!fin.good()) return SERIALIZATION_FAILURE; @@ -152,10 +150,10 @@ } -CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Deserialize(istream& iStrm) +CTuningCollection::SERIALIZATION_RETURN_TYPE CTuningCollection::Deserialize(std::istream& iStrm) //--------------------------------------------------------- { - istream::pos_type startpos = iStrm.tellg(); + std::istream::pos_type startpos = iStrm.tellg(); bool oldLoadingSuccess = false; if(DeserializeOLD(iStrm, oldLoadingSuccess)) @@ -193,7 +191,7 @@ //Returns false if stream content was recognised to be right kind of file(by beginmarker), //else true, and sets bool parameter to true if loading was successful -bool CTuningCollection::DeserializeOLD(istream& inStrm, bool& loadingSuccessful) +bool CTuningCollection::DeserializeOLD(std::istream& inStrm, bool& loadingSuccessful) //------------------------------------------------------------------------------ { //s_SerializationBeginMarker = 0x54435348; //ascii of TCSH @@ -309,7 +307,7 @@ } -bool CTuningCollection::AddTuning(istream& inStrm, const bool ignoreEditmask) +bool CTuningCollection::AddTuning(std::istream& inStrm, const bool ignoreEditmask) //--------------------------------------------------------------------------- { if((!ignoreEditmask && (m_EditMask & EM_ADD) == 0) || m_Tunings.size() >= s_nMaxTuningCount) @@ -357,5 +355,5 @@ //------------------------------------------------- { std::bitset<16> mask(m_EditMask); - return mask.to_string<char, char_traits<char>, allocator<char> >(); + return mask.to_string<char, std::char_traits<char>, std::allocator<char> >(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-27 16:17:37
|
Revision: 2417 http://sourceforge.net/p/modplug/code/2417 Author: manxorist Date: 2013-06-27 16:17:29 +0000 (Thu, 27 Jun 2013) Log Message: ----------- [Ref] Remove unused BUILD_TUNINGBASE_AS_TEMPLATE and associated code. Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/soundlib/tuning.cpp trunk/OpenMPT/soundlib/tuning.h trunk/OpenMPT/soundlib/tuningCollection.cpp trunk/OpenMPT/soundlib/tuningbase.cpp trunk/OpenMPT/soundlib/tuningbase.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-06-27 16:17:29 UTC (rev 2417) @@ -403,7 +403,7 @@ { if(pTuning) { // Drawing custom note names - std::string noteStr = pTuning->GetNoteName(static_cast<CTuningBase::NOTEINDEXTYPE>(note-NOTE_MIDDLEC)); + std::string noteStr = pTuning->GetNoteName(static_cast<CTuning::NOTEINDEXTYPE>(note-NOTE_MIDDLEC)); if(noteStr.size() < 3) noteStr.resize(3, ' '); Modified: trunk/OpenMPT/soundlib/tuning.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuning.cpp 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/soundlib/tuning.cpp 2013-06-27 16:17:29 UTC (rev 2417) @@ -28,10 +28,10 @@ namespace CTuningS11n { void ReadStr(std::istream& iStrm, std::string& str, const size_t); - void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); + void ReadNoteMap(std::istream& iStrm, CTuning::NOTENAMEMAP& m, const size_t); void ReadRatioTable(std::istream& iStrm, std::vector<CTuningRTI::RATIOTYPE>& v, const size_t); - void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); + void WriteNoteMap(std::ostream& oStrm, const CTuning::NOTENAMEMAP& m); void WriteStr(std::ostream& oStrm, const std::string& str); struct RatioWriter @@ -371,7 +371,7 @@ } -CTuningBase* CTuningRTI::Deserialize(std::istream& iStrm) +CTuning* CTuningRTI::Deserialize(std::istream& iStrm) //-------------------------------------------------- { if(iStrm.fail()) @@ -380,7 +380,7 @@ CTuningRTI* pTuning = new CTuningRTI; srlztn::Ssb ssb(iStrm); - ssb.BeginRead("CTB244RTI", (CTuningBase::GetVersion() << 24) + GetVersion()); + ssb.BeginRead("CTB244RTI", (CTuning::GetVersion() << 24) + GetVersion()); ssb.ReadItem(pTuning->m_TuningName, "0", 1, ReadStr); ssb.ReadItem(pTuning->m_EditMask, "1"); ssb.ReadItem(pTuning->m_TuningType, "2"); @@ -467,7 +467,7 @@ } -CTUNINGBASE::SERIALIZATION_RETURN_TYPE CTuningRTI::Serialize(std::ostream& outStrm) const +CTuning::SERIALIZATION_RETURN_TYPE CTuningRTI::Serialize(std::ostream& outStrm) const //---------------------------------------------------------------------------------- { srlztn::Ssb ssb(outStrm); @@ -519,7 +519,7 @@ } -void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t) +void ReadNoteMap(std::istream& iStrm, CTuning::NOTENAMEMAP& m, const size_t) //---------------------------------------------------------------------------------- { uint64 val; @@ -559,12 +559,12 @@ } -void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m) +void WriteNoteMap(std::ostream& oStrm, const CTuning::NOTENAMEMAP& m) //--------------------------------------------------------------------------- { srlztn::WriteAdaptive1248(oStrm, m.size()); - CTUNINGBASE::NNM_CITER iter = m.begin(); - CTUNINGBASE::NNM_CITER end = m.end(); + CTuning::NNM_CITER iter = m.begin(); + CTuning::NNM_CITER end = m.end(); for(; iter != end; iter++) { srlztn::Binarywrite<int16>(oStrm, iter->first); Modified: trunk/OpenMPT/soundlib/tuning.h =================================================================== --- trunk/OpenMPT/soundlib/tuning.h 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/soundlib/tuning.h 2013-06-27 16:17:29 UTC (rev 2417) @@ -12,12 +12,7 @@ #include "tuningbase.h" -#ifdef BUILD_TUNINGBASE_AS_TEMPLATE - typedef CTuningBase<int16, uint16, float32, int32, uint32> CTuning; - //If changing RATIOTYPE, serialization methods may need modifications. -#else - typedef CTuningBase CTuning; -#endif +typedef CTuningBase CTuning; @@ -63,7 +58,7 @@ virtual STEPINDEXTYPE GetStepDistance(const NOTEINDEXTYPE& noteFrom, const STEPINDEXTYPE& stepDistFrom, const NOTEINDEXTYPE& noteTo, const STEPINDEXTYPE& stepDistTo) const {return GetStepDistance(noteFrom, noteTo) + stepDistTo - stepDistFrom;} - static CTuningBase* Deserialize(std::istream& inStrm); + static CTuning* Deserialize(std::istream& inStrm); static uint32 GetVersion() {return s_SerializationVersion;} Modified: trunk/OpenMPT/soundlib/tuningCollection.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/soundlib/tuningCollection.cpp 2013-06-27 16:17:29 UTC (rev 2417) @@ -31,10 +31,10 @@ namespace CTuningS11n { - void WriteNoteMap(std::ostream& oStrm, const CTUNINGBASE::NOTENAMEMAP& m); + void WriteNoteMap(std::ostream& oStrm, const CTuning::NOTENAMEMAP& m); void ReadStr(std::istream& iStrm, std::string& str, const size_t); - void ReadNoteMap(std::istream& iStrm, CTuningBase::NOTENAMEMAP& m, const size_t); + void ReadNoteMap(std::istream& iStrm, CTuning::NOTENAMEMAP& m, const size_t); void ReadRatioTable(std::istream& iStrm, std::vector<CTuningRTI::RATIOTYPE>& v, const size_t); void WriteStr(std::ostream& oStrm, const std::string& str); Modified: trunk/OpenMPT/soundlib/tuningbase.cpp =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.cpp 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/soundlib/tuningbase.cpp 2013-06-27 16:17:29 UTC (rev 2417) @@ -9,33 +9,30 @@ #include "stdafx.h" -#define TUNINGBASE_CPP #include "tuningbase.h" #include "../common/serialization_utils.h" -#ifdef TUNINGBASE_H -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningDescriptionGeneral = "No ratio restrictions"; +const char* CTuningBase::s_TuningDescriptionGeneral = "No ratio restrictions"; -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningDescriptionGroupGeometric = "Ratio of ratios with distance of 'groupsize' is constant."; -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningDescriptionGeometric = "Ratio of successive ratios is constant."; +const char* CTuningBase::s_TuningDescriptionGroupGeometric = "Ratio of ratios with distance of 'groupsize' is constant."; -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningTypeStrGeneral = "\"General\""; -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningTypeStrGroupGeometric = "\"GroupGeometric\""; +const char* CTuningBase::s_TuningDescriptionGeometric = "Ratio of successive ratios is constant."; -TEMPLATEDEC -const char* CTUNINGBASE::s_TuningTypeStrGeometric = "\"Geometric\""; -TEMPLATEDEC -const TYPENAME CTUNINGBASE::SERIALIZATION_VERSION CTUNINGBASE::s_SerializationVersion(5); +const char* CTuningBase::s_TuningTypeStrGeneral = "\"General\""; + + +const char* CTuningBase::s_TuningTypeStrGroupGeometric = "\"GroupGeometric\""; + + +const char* CTuningBase::s_TuningTypeStrGeometric = "\"Geometric\""; + + +const CTuningBase::SERIALIZATION_VERSION CTuningBase::s_SerializationVersion(5); /* Version history: 4->5: Lots of changes, finestep interpretation revamp, fileformat revamp. @@ -44,48 +41,48 @@ */ -TEMPLATEDEC -const TYPENAME CTUNINGBASE::SERIALIZATION_RETURN_TYPE CTUNINGBASE::SERIALIZATION_SUCCESS = false; -TEMPLATEDEC -const TYPENAME CTUNINGBASE::SERIALIZATION_RETURN_TYPE CTUNINGBASE::SERIALIZATION_FAILURE = true; +const CTuningBase::SERIALIZATION_RETURN_TYPE CTuningBase::SERIALIZATION_SUCCESS = false; -TEMPLATEDEC -const TCHAR CTUNINGBASE::s_FileExtension[5] = MPT_TEXT(".tun"); -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_RATIOS = 1; //1b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_NOTENAME = 1 << 1; //10b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_TYPE = 1 << 2; //100b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_NAME = 1 << 3; //1000b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_FINETUNE = 1 << 4; //10000b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_VALIDITYRANGE = 1 << 5; //100000b +const CTuningBase::SERIALIZATION_RETURN_TYPE CTuningBase::SERIALIZATION_FAILURE = true; -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_ALLOWALL = 0xFFFF; //All editing allowed. -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_EDITMASK = 0x8000; //Whether to allow modifications to editmask. -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_CONST = 0x8000; //All editing except changing const status disable. -TEMPLATEDEC -const TYPENAME CTUNINGBASE::EDITMASK CTUNINGBASE::EM_CONST_STRICT = 0; //All bits are zero - even the const status can't be changed. +const TCHAR CTuningBase::s_FileExtension[5] = MPT_TEXT(".tun"); -TEMPLATEDEC -const TYPENAME CTUNINGBASE::TUNINGTYPE CTUNINGBASE::TT_GENERAL = 0; //0...00b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::TUNINGTYPE CTUNINGBASE::TT_GROUPGEOMETRIC = 1; //0...10b -TEMPLATEDEC -const TYPENAME CTUNINGBASE::TUNINGTYPE CTUNINGBASE::TT_GEOMETRIC = 3; //0...11b +const CTuningBase::EDITMASK CTuningBase::EM_RATIOS = 1; //1b -TEMPLATEDEC -void CTUNINGBASE::TuningCopy(CTuningBase& to, const CTuningBase& from, const bool allowExactnamecopy) +const CTuningBase::EDITMASK CTuningBase::EM_NOTENAME = 1 << 1; //10b + +const CTuningBase::EDITMASK CTuningBase::EM_TYPE = 1 << 2; //100b + +const CTuningBase::EDITMASK CTuningBase::EM_NAME = 1 << 3; //1000b + +const CTuningBase::EDITMASK CTuningBase::EM_FINETUNE = 1 << 4; //10000b + +const CTuningBase::EDITMASK CTuningBase::EM_VALIDITYRANGE = 1 << 5; //100000b + + +const CTuningBase::EDITMASK CTuningBase::EM_ALLOWALL = 0xFFFF; //All editing allowed. + +const CTuningBase::EDITMASK CTuningBase::EM_EDITMASK = 0x8000; //Whether to allow modifications to editmask. + +const CTuningBase::EDITMASK CTuningBase::EM_CONST = 0x8000; //All editing except changing const status disable. + +const CTuningBase::EDITMASK CTuningBase::EM_CONST_STRICT = 0; //All bits are zero - even the const status can't be changed. + + + +const CTuningBase::TUNINGTYPE CTuningBase::TT_GENERAL = 0; //0...00b + +const CTuningBase::TUNINGTYPE CTuningBase::TT_GROUPGEOMETRIC = 1; //0...10b + +const CTuningBase::TUNINGTYPE CTuningBase::TT_GEOMETRIC = 3; //0...11b + + + +void CTuningBase::TuningCopy(CTuningBase& to, const CTuningBase& from, const bool allowExactnamecopy) //------------------------------------------------------------------------------------ { if(!to.MayEdit(EM_ALLOWALL)) @@ -116,8 +113,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::SetRatio(const NOTEINDEXTYPE& s, const RATIOTYPE& r) + +bool CTuningBase::SetRatio(const NOTEINDEXTYPE& s, const RATIOTYPE& r) //----------------------------------------------------------------- { if(MayEdit(EM_RATIOS)) @@ -133,8 +130,8 @@ } -TEMPLATEDEC -TYPENAME CTUNINGBASE::USTEPINDEXTYPE CTUNINGBASE::SetFineStepCount(const USTEPINDEXTYPE& fs) + +CTuningBase::USTEPINDEXTYPE CTuningBase::SetFineStepCount(const USTEPINDEXTYPE& fs) //------------------------------------------------------- { VRPAIR vrp = GetValidityRange(); @@ -152,8 +149,8 @@ } } -TEMPLATEDEC -TYPENAME CTUNINGBASE::TUNINGTYPE CTUNINGBASE::GetTuningType(const char* str) + +CTuningBase::TUNINGTYPE CTuningBase::GetTuningType(const char* str) //-------------------------------------------------------------------------- { if(!strcmp(str, s_TuningTypeStrGroupGeometric)) @@ -164,8 +161,8 @@ return TT_GENERAL; } -TEMPLATEDEC -std::string CTUNINGBASE::GetTuningTypeStr(const TUNINGTYPE& tt) + +std::string CTuningBase::GetTuningTypeStr(const TUNINGTYPE& tt) //---------------------------------------------------------------- { if(tt == TT_GENERAL) @@ -179,16 +176,16 @@ -TEMPLATEDEC -TYPENAME CTUNINGBASE::NOTESTR CTUNINGBASE::GetNoteName(const NOTEINDEXTYPE& x) const + +CTuningBase::NOTESTR CTuningBase::GetNoteName(const NOTEINDEXTYPE& x) const //----------------------------------------------------------------------- { if(!IsValidNote(x)) return ""; else return ProGetNoteName(x); } -TEMPLATEDEC -TYPENAME CTUNINGBASE::NOTESTR CTUNINGBASE::ProGetNoteName(const NOTEINDEXTYPE& x) const + +CTuningBase::NOTESTR CTuningBase::ProGetNoteName(const NOTEINDEXTYPE& x) const //------------------------------------------------------------------------------------- { NNM_CITER i = m_NoteNameMap.find(x); @@ -199,8 +196,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::IsOfType(const TUNINGTYPE& type) const + +bool CTuningBase::IsOfType(const TUNINGTYPE& type) const //---------------------------------------------------- { if(type == TT_GENERAL) @@ -219,8 +216,8 @@ return false; } -TEMPLATEDEC -bool CTUNINGBASE::SetNoteName(const NOTEINDEXTYPE& n, const std::string& str) + +bool CTuningBase::SetNoteName(const NOTEINDEXTYPE& n, const std::string& str) //----------------------------------------------------------------------- { if(MayEdit(EM_NOTENAME)) @@ -233,8 +230,8 @@ -TEMPLATEDEC -bool CTUNINGBASE::ClearNoteName(const NOTEINDEXTYPE& n, const bool eraseAll) + +bool CTuningBase::ClearNoteName(const NOTEINDEXTYPE& n, const bool eraseAll) //------------------------------------------------------- { if(MayEdit(EM_NOTENAME)) @@ -258,8 +255,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::Multiply(const RATIOTYPE& r) + +bool CTuningBase::Multiply(const RATIOTYPE& r) //--------------------------------------------------- { if(r <= 0 || !MayEdit(EM_RATIOS)) @@ -276,8 +273,8 @@ return false; } -TEMPLATEDEC -bool CTUNINGBASE::CreateGroupGeometric(const NOTEINDEXTYPE& s, const RATIOTYPE& r, const NOTEINDEXTYPE& startindex) + +bool CTuningBase::CreateGroupGeometric(const NOTEINDEXTYPE& s, const RATIOTYPE& r, const NOTEINDEXTYPE& startindex) //------------------------------------------------------------- { if(s < 1 || r <= 0 || startindex < GetValidityRange().first) @@ -290,8 +287,8 @@ return CreateGroupGeometric(v, r, GetValidityRange(), startindex); } -TEMPLATEDEC -bool CTUNINGBASE::CreateGroupGeometric(const std::vector<RATIOTYPE>& v, const RATIOTYPE& r, const VRPAIR vr, const NOTEINDEXTYPE ratiostartpos) + +bool CTuningBase::CreateGroupGeometric(const std::vector<RATIOTYPE>& v, const RATIOTYPE& r, const VRPAIR vr, const NOTEINDEXTYPE ratiostartpos) //------------------------------------------------------------------------------------------ { if(MayEdit(EM_RATIOS) && @@ -315,8 +312,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::CreateGeometric(const UNOTEINDEXTYPE& s, const RATIOTYPE& r, const VRPAIR vr) + +bool CTuningBase::CreateGeometric(const UNOTEINDEXTYPE& s, const RATIOTYPE& r, const VRPAIR vr) //------------------------------------------------------------------- { if(MayEdit(EM_RATIOS) && @@ -339,8 +336,8 @@ -TEMPLATEDEC -bool CTUNINGBASE::ChangeGroupsize(const NOTEINDEXTYPE& s) + +bool CTuningBase::ChangeGroupsize(const NOTEINDEXTYPE& s) //--------------------------------------------------- { if(!MayEdit(EM_RATIOS) || s < 1) @@ -356,8 +353,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::ChangeGroupRatio(const RATIOTYPE& r) + +bool CTuningBase::ChangeGroupRatio(const RATIOTYPE& r) //--------------------------------------------------- { if(!MayEdit(EM_RATIOS) || r <= 0) @@ -373,8 +370,8 @@ } -TEMPLATEDEC -const char* CTUNINGBASE::GetTuningTypeDescription(const TUNINGTYPE& type) + +const char* CTuningBase::GetTuningTypeDescription(const TUNINGTYPE& type) //--------------------------------------------------------------------------------------- { if(type == TT_GENERAL) @@ -386,8 +383,8 @@ return "Unknown"; } -TEMPLATEDEC -TYPENAME CTUNINGBASE::VRPAIR CTUNINGBASE::SetValidityRange(const VRPAIR& vrp) + +CTuningBase::VRPAIR CTuningBase::SetValidityRange(const VRPAIR& vrp) //---------------------------------------------------------------------------------------- { if(vrp.second < vrp.first) return GetValidityRange(); @@ -401,8 +398,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::SetType(const TUNINGTYPE& tt) + +bool CTuningBase::SetType(const TUNINGTYPE& tt) //---------------------------------------------- { //Note: This doesn't check whether the tuning ratios @@ -424,8 +421,8 @@ } -TEMPLATEDEC -bool CTUNINGBASE::DeserializeOLD(std::istream& inStrm) + +bool CTuningBase::DeserializeOLD(std::istream& inStrm) //------------------------------------------------ { char begin[8]; @@ -472,6 +469,3 @@ return SERIALIZATION_SUCCESS; } - -#endif - Modified: trunk/OpenMPT/soundlib/tuningbase.h =================================================================== --- trunk/OpenMPT/soundlib/tuningbase.h 2013-06-27 15:00:03 UTC (rev 2416) +++ trunk/OpenMPT/soundlib/tuningbase.h 2013-06-27 16:17:29 UTC (rev 2417) @@ -10,16 +10,7 @@ #pragma once -//#define BUILD_TUNINGBASE_AS_TEMPLATE -#if defined(TUNINGBASE_CPP) && defined(BUILD_TUNINGBASE_AS_TEMPLATE) - //Not including this file for tuningbase.cpp when building as template. -#else - -#ifndef TUNINGBASE_H -#define TUNINGBASE_H - - #include <string> #include <vector> #include <cmath> @@ -33,30 +24,7 @@ namespace srlztn {class Ssb;} -#ifdef BUILD_TUNINGBASE_AS_TEMPLATE - #define CLASSTEMPLATEDEC template<class TNOTEINDEXTYPE = int16, class TUNOTEINDEXTYPE = uint16, class TRATIOTYPE = float32, class TSTEPINDEXTYPE = int32, class TUSTEPINDEXTYPE = uint32> - #define TEMPLATEDEC template<class A, class B, class C, class D, class E> - #define TYPENAME typename - #define CTUNINGBASE CTuningBase<A, B, C, D, E> -#else - #define CLASSTEMPLATEDEC - typedef int16 TNOTEINDEXTYPE; - typedef uint16 TUNOTEINDEXTYPE; - typedef float32 TRATIOTYPE; - typedef int32 TSTEPINDEXTYPE; - typedef uint32 TUSTEPINDEXTYPE; - #define TYPENAME - #define TEMPLATEDEC - #define CTUNINGBASE CTuningBase -#endif - -#ifndef BYTE - typedef unsigned char BYTE; -#endif - - //Tuning baseclass; basic functionality is to map note to ratio. -CLASSTEMPLATEDEC class CTuningBase //=============== { @@ -70,11 +38,11 @@ public: //BEGIN TYPEDEFS: - typedef TNOTEINDEXTYPE NOTEINDEXTYPE; - typedef TUNOTEINDEXTYPE UNOTEINDEXTYPE; - typedef TRATIOTYPE RATIOTYPE; - typedef TSTEPINDEXTYPE STEPINDEXTYPE; - typedef TUSTEPINDEXTYPE USTEPINDEXTYPE; + typedef int16 NOTEINDEXTYPE; + typedef uint16 UNOTEINDEXTYPE; + typedef float32 RATIOTYPE; //If changing RATIOTYPE, serialization methods may need modifications. + typedef int32 STEPINDEXTYPE; + typedef uint32 USTEPINDEXTYPE; typedef void (*MESSAGEHANDLER)(const char*, const char*); typedef int16 SERIALIZATION_VERSION; @@ -89,8 +57,8 @@ typedef std::string NOTESTR; typedef std::map<NOTEINDEXTYPE, NOTESTR> NOTENAMEMAP; - typedef TYPENAME NOTENAMEMAP::iterator NNM_ITER; - typedef TYPENAME NOTENAMEMAP::const_iterator NNM_CITER; + typedef NOTENAMEMAP::iterator NNM_ITER; + typedef NOTENAMEMAP::const_iterator NNM_CITER; //END TYPEDEFS @@ -294,8 +262,8 @@ private: CTuningBase(CTuningBase&) {} CTuningBase& operator=(const CTuningBase&) {return *this;} - static void ReadNotenamemapPair(std::istream& iStrm, TYPENAME NOTENAMEMAP::value_type& val, const size_t); - static void WriteNotenamemappair(std::ostream& oStrm, const TYPENAME NOTENAMEMAP::value_type& val, const size_t); + static void ReadNotenamemapPair(std::istream& iStrm, NOTENAMEMAP::value_type& val, const size_t); + static void WriteNotenamemappair(std::ostream& oStrm, const NOTENAMEMAP::value_type& val, const size_t); public: static const char* s_TuningDescriptionGeneral; @@ -317,22 +285,22 @@ #define USTEPINDEXTYPE_MAX (std::numeric_limits<USTEPINDEXTYPE>::max)() -TEMPLATEDEC -inline const char* CTUNINGBASE::GetTuningTypeDescription() const + +inline const char* CTuningBase::GetTuningTypeDescription() const //---------------------------------------------------------------------- { return GetTuningTypeDescription(GetType()); } -TEMPLATEDEC -inline void CTUNINGBASE::SetName(const std::string& s) + +inline void CTuningBase::SetName(const std::string& s) //----------------------------------------------- { if(MayEdit(EM_NAME)) m_TuningName = s; } -TEMPLATEDEC -inline bool CTUNINGBASE::IsStepCountRangeSufficient(USTEPINDEXTYPE fs, VRPAIR vrp) + +inline bool CTuningBase::IsStepCountRangeSufficient(USTEPINDEXTYPE fs, VRPAIR vrp) //------------------------------------------------------------------ { if(vrp.first == STEPINDEXTYPE_MIN && vrp.second == STEPINDEXTYPE_MAX) return true; @@ -340,8 +308,8 @@ else return true; } -TEMPLATEDEC -inline bool CTUNINGBASE::SetEditMask(const EDITMASK& em) + +inline bool CTuningBase::SetEditMask(const EDITMASK& em) //------------------------------------------------------ { if(MayEdit(EM_EDITMASK)) @@ -350,12 +318,3 @@ return true; } - - -#if defined(BUILD_TUNINGBASE_AS_TEMPLATE) - #include "tuningbase.cpp" -#endif - -#endif -#endif - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2013-06-27 21:37:15
|
Revision: 2422 http://sourceforge.net/p/modplug/code/2422 Author: saga-games Date: 2013-06-27 21:37:08 +0000 (Thu, 27 Jun 2013) Log Message: ----------- [Reg] Removed hidden setting ITCompressionVerification [Mod] Added test for IT sample compression / decompression [Ref] Don't require CModDoc for PC note serialization test anymore. Modified Paths: -------------- trunk/OpenMPT/soundlib/ITCompression.cpp trunk/OpenMPT/soundlib/ITCompression.h trunk/OpenMPT/test/test.cpp Modified: trunk/OpenMPT/soundlib/ITCompression.cpp =================================================================== --- trunk/OpenMPT/soundlib/ITCompression.cpp 2013-06-27 18:03:07 UTC (rev 2421) +++ trunk/OpenMPT/soundlib/ITCompression.cpp 2013-06-27 21:37:08 UTC (rev 2422) @@ -174,53 +174,9 @@ WriteByte(byteVal); packedData[0] = uint8((packedLength - 2) & 0xFF); packedData[1] = uint8((packedLength - 2) >> 8); - - Verify(data, sampleData, offset); } -#ifdef MODPLUG_TRACKER -#include "../mptrack/Mptrack.h" // For config filename -#endif // MODPLUG_TRACKER - -// Check integrity of compressed data -void ITCompression::Verify(const void *data, void *sampleData, SmpLength offset) -//------------------------------------------------------------------------------ -{ -#ifdef MODPLUG_TRACKER - if(::GetPrivateProfileInt("Misc", "ITCompressionVerification", 0, theApp.GetConfigFileName()) != 0) - { - int8 *newSampleData = new (std::nothrow) int8[baseLength * mptSample.GetElementarySampleSize()]; - // Load original sample data for this block again - if(mptSample.GetElementarySampleSize() > 1) - { - CopySample<int16>(sampleData, data, offset, baseLength, mptSample.GetNumChannels()); - } else - { - CopySample<int8>(sampleData, data, offset, baseLength, mptSample.GetNumChannels()); - } - - FileReader data(&packedData[0], packedLength); - ModSample sample = mptSample; - sample.uFlags.reset(CHN_STEREO); - sample.pSample = newSampleData; - sample.nLength = baseLength; - ITDecompression(data, sample, is215); - - if(memcmp(sampleData, newSampleData, baseLength * mptSample.GetElementarySampleSize())) - { - Reporting::Error("CRITICAL ERROR! Sample compression failed for some sample!\nDisable IT compression NOW, find out which sample got broken and send the original sample to the OpenMPT devs!"); - } - delete[] newSampleData; - } -#else // !MODPLUG_TRACKER - UNREFERENCED_PARAMETER(data); - UNREFERENCED_PARAMETER(sampleData); - UNREFERENCED_PARAMETER(offset); -#endif // MODPLUG_TRACKER -} - - int ITCompression::GetWidthChangeSize(int w, bool is16) //----------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/ITCompression.h =================================================================== --- trunk/OpenMPT/soundlib/ITCompression.h 2013-06-27 18:03:07 UTC (rev 2421) +++ trunk/OpenMPT/soundlib/ITCompression.h 2013-06-27 21:37:08 UTC (rev 2422) @@ -52,7 +52,6 @@ template<typename Properties> void Compress(const void *data, SmpLength offset, SmpLength actualLength); - void Verify(const void *data, void *sampleData, SmpLength offset); static int GetWidthChangeSize(int w, bool is16); Modified: trunk/OpenMPT/test/test.cpp =================================================================== --- trunk/OpenMPT/test/test.cpp 2013-06-27 18:03:07 UTC (rev 2421) +++ trunk/OpenMPT/test/test.cpp 2013-06-27 21:37:08 UTC (rev 2422) @@ -24,6 +24,7 @@ #include "../soundlib/MIDIEvents.h" #include "../soundlib/MIDIMacros.h" #include "../soundlib/SampleFormatConverters.h" +#include "../soundlib/ITCompression.h" #ifdef MODPLUG_TRACKER #include "../mptrack/mptrack.h" #include "../mptrack/moddoc.h" @@ -303,6 +304,7 @@ void TestMIDIEvents(); void TestStringIO(); void TestSampleConversion(); +void TestITCompression(); @@ -316,6 +318,7 @@ DO_TEST(TestStringIO); DO_TEST(TestMIDIEvents); DO_TEST(TestSampleConversion); + DO_TEST(TestITCompression); // slower tests, require opening a CModDoc DO_TEST(TestPCnoteSerialization); @@ -1385,9 +1388,71 @@ DestroySoundFileContainer(sndFileContainer); } +} + +void RunITCompressionTest(const std::vector<int8> &sampleData, ChannelFlags smpFormat, bool it215) +//------------------------------------------------------------------------------------------------ +{ + std::string filename = GetTestFilenameBase() + "raw"; + + ModSample smp; + smp.uFlags = smpFormat; + smp.pSample = const_cast<int8 *>(&sampleData[0]); + smp.nLength = sampleData.size() / smp.GetBytesPerSample(); + + { + FILE *f = fopen(filename.c_str(), "wb"); + ITCompression compression(smp, it215, f); + fclose(f); + } + + { + FILE *f = fopen(filename.c_str(), "rb"); + fseek(f, 0, SEEK_END); + std::vector<int8> fileData(ftell(f), 0); + fseek(f, 0, SEEK_SET); + fread(&fileData[0], 1, fileData.size(), f); + FileReader file(&fileData[0], fileData.size()); + + std::vector<int8> sampleDataNew(sampleData.size(), 0); + smp.pSample = &sampleDataNew[0]; + + ITDecompression decompression(file, smp, it215); + for(size_t i = 0; i < sampleData.size(); i++) + { + VERIFY_EQUAL(sampleData[i], sampleDataNew[i]); + } + fclose(f); + } + remove(filename.c_str()); } + +void TestITCompression() +//---------------------- +{ + return; + // Test loading / saving of IT-compressed samples + const int sampleDataSize = 65536; + std::vector<int8> sampleData(sampleDataSize, 0); + std::srand(0); + for(int i = 0; i < sampleDataSize; i++) + { + sampleData[i] = (int8)std::rand(); + } + + // Run each compression test with IT215 compression and without. + for(int i = 0; i < 2; i++) + { + RunITCompressionTest(sampleData, ChannelFlags(0), i == 0); + RunITCompressionTest(sampleData, CHN_16BIT, i == 0); + RunITCompressionTest(sampleData, CHN_STEREO, i == 0); + RunITCompressionTest(sampleData, CHN_16BIT | CHN_STEREO, i == 0); + } +} + + double Rand01() {return rand() / double(RAND_MAX);} template <class T> @@ -1424,30 +1489,13 @@ void TestPCnoteSerialization() //---------------------------- { -#ifdef MODPLUG_TRACKER - theApp.OnFileNewMPT(); - CMainFrame* pMainFrm = CMainFrame::GetMainFrame(); - if(pMainFrm == nullptr) - throw(std::runtime_error("pMainFrm is nullptr")); - CModDoc* pModDoc = pMainFrm->GetActiveDoc(); - if(pModDoc == nullptr) - throw(std::runtime_error("pModdoc is nullptr")); - - CSoundFile &sndFile = pModDoc->GetrSoundFile(); -#else FileReader file; - std::shared_ptr<CSoundFile> pSndFile(new CSoundFile()); + MPT_SHARED_PTR<CSoundFile> pSndFile(new CSoundFile()); CSoundFile &sndFile = *pSndFile.get(); -#endif + sndFile.ChangeModTypeTo(MOD_TYPE_MPT); + sndFile.Patterns.DestroyPatterns(); + sndFile.m_nChannels = ModSpecs::mptm.channelsMax; -#ifdef MODPLUG_TRACKER - // Set maximum number of channels. - pModDoc->ReArrangeChannels(std::vector<CHANNELINDEX>(ModSpecs::mptm.channelsMax , 0)); -#else - // todo: set number of channels -#endif - - sndFile.Patterns.Remove(0); sndFile.Patterns.Insert(0, ModSpecs::mptm.patternRowsMin); sndFile.Patterns.Insert(1, 64); GenerateCommands(sndFile.Patterns[1], 0.3, 0.3); @@ -1501,11 +1549,6 @@ } VERIFY_EQUAL( bPatternDataMatch, true); } - -#ifdef MODPLUG_TRACKER - pModDoc->OnCloseDocument(); -#endif - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2013-06-28 11:10:37
|
Revision: 2427 http://sourceforge.net/p/modplug/code/2427 Author: manxorist Date: 2013-06-28 11:10:29 +0000 (Fri, 28 Jun 2013) Log Message: ----------- [New] Add .flac output support to openmpt123 on windows. Modified Paths: -------------- trunk/OpenMPT/include/flac/OpenMPT.txt trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj trunk/OpenMPT/openmpt123/openmpt123.sln trunk/OpenMPT/openmpt123/openmpt123.vcxproj trunk/OpenMPT/openmpt123/openmpt123_config.hpp Property Changed: ---------------- trunk/OpenMPT/include/flac/src/libFLAC/ Modified: trunk/OpenMPT/include/flac/OpenMPT.txt =================================================================== --- trunk/OpenMPT/include/flac/OpenMPT.txt 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/include/flac/OpenMPT.txt 2013-06-28 11:10:29 UTC (rev 2427) @@ -13,4 +13,8 @@ - The following preprocessor directives have been removed from both debug and release configurations: FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM - Debug configurations have been changed to use a multi-threaded debug DLL - runtime library (/MDd) \ No newline at end of file + runtime library (/MDd) + - x64 project configurations have been added for VS2010. + These are based on the modified x86 ones, which output filesnames and + directories suffixed by '64'. FLAC__USE_3DNOW is removed for x64. + - A c implementation for local_swap32_block_ if !_M_IX86 has been added. Index: trunk/OpenMPT/include/flac/src/libFLAC =================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/include/flac/src/libFLAC 2013-06-28 11:10:29 UTC (rev 2427) Property changes on: trunk/OpenMPT/include/flac/src/libFLAC ___________________________________________________________________ Modified: svn:ignore ## -1,3 +1,5 ## *.user +Debug64_static Debug_static +Release64_static Release_static Modified: trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c =================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/include/flac/src/libFLAC/bitreader.c 2013-06-28 11:10:29 UTC (rev 2427) @@ -156,6 +156,7 @@ x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } +#if defined(_M_IX86) static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) { __asm { @@ -173,7 +174,16 @@ done1: } } +#else +static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) +{ + while(len--) { + *start = local_swap32_(*start); + start++; + } +} #endif +#endif static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) { Modified: trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj =================================================================== --- trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/include/flac/src/libFLAC/libFLAC_static_10.vcxproj 2013-06-28 11:10:29 UTC (rev 2427) @@ -5,10 +5,18 @@ <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{4cefbc84-c215-11db-8314-0800200c9a66}</ProjectGuid> @@ -21,25 +29,42 @@ <ConfigurationType>StaticLibrary</ConfigurationType> <WholeProgramOptimization>false</WholeProgramOptimization> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <WholeProgramOptimization>false</WholeProgramOptimization> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\lib\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\lib\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug_static\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Debug64_static\</IntDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\lib\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\lib\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release_static\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Release64_static\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -60,6 +85,24 @@ <OutputFile>..\..\lib\libFLAC_staticd.lib</OutputFile> </Lib> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;VERSION="1.2.0";FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <DisableSpecificWarnings>4267;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Lib> + <OutputFile>..\..\lib\libFLAC64_staticd.lib</OutputFile> + </Lib> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <IntrinsicFunctions>true</IntrinsicFunctions> @@ -83,6 +126,29 @@ <OutputFile>..\..\lib\libFLAC_static.lib</OutputFile> </Lib> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;VERSION="1.2.0";FLAC__NO_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <DisableSpecificWarnings>4267;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <FunctionLevelLinking>true</FunctionLevelLinking> + </ClCompile> + <Lib> + <OutputFile>..\..\lib\libFLAC64_static.lib</OutputFile> + </Lib> + </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="include\protected\all.h" /> <ClInclude Include="include\private\all.h" /> Modified: trunk/OpenMPT/openmpt123/openmpt123.sln =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.sln 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/openmpt123/openmpt123.sln 2013-06-28 11:10:29 UTC (rev 2427) @@ -9,6 +9,8 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "..\include\zlib\contrib\vstudio\vc10\zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_static", "..\include\flac\src\libFLAC\libFLAC_static_10.vcxproj", "{4CEFBC84-C215-11DB-8314-0800200C9A66}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -49,6 +51,14 @@ {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = ReleaseWithoutAsm|Win32 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = ReleaseWithoutAsm|x64 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = ReleaseWithoutAsm|x64 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 + {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: trunk/OpenMPT/openmpt123/openmpt123.vcxproj =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.vcxproj 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/openmpt123/openmpt123.vcxproj 2013-06-28 11:10:29 UTC (rev 2427) @@ -72,7 +72,7 @@ <ClCompile> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..;../common;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../common;../include/flac/include;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> @@ -84,7 +84,7 @@ <ClCompile> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..;../common;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../common;../include/flac/include;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> @@ -99,7 +99,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <FloatingPointModel>Fast</FloatingPointModel> - <AdditionalIncludeDirectories>..;../common;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../common;../include/flac/include;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> @@ -119,7 +119,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <FloatingPointModel>Fast</FloatingPointModel> - <AdditionalIncludeDirectories>..;../common;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..;../common;../include/flac/include;../include/portaudio/include;../common/svn_version;../common/svn_version_default</AdditionalIncludeDirectories> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> @@ -136,6 +136,9 @@ <ClCompile Include="openmpt123.cpp" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\include\flac\src\libFLAC\libFLAC_static_10.vcxproj"> + <Project>{4cefbc84-c215-11db-8314-0800200c9a66}</Project> + </ProjectReference> <ProjectReference Include="..\include\portaudio\build\msvc\portaudio_openmpt_vs2010.vcxproj"> <Project>{0a18a071-125e-442f-aff7-a3f68abecf99}</Project> </ProjectReference> Modified: trunk/OpenMPT/openmpt123/openmpt123_config.hpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2013-06-28 10:37:59 UTC (rev 2426) +++ trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2013-06-28 11:10:29 UTC (rev 2427) @@ -14,9 +14,12 @@ #pragma warning( disable : 4996 ) // 'foo': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _foo. See online help for details. +#define MPT_WITH_FLAC #define MPT_WITH_PORTAUDIO #define MPT_WITH_ZLIB +#define FLAC__NO_DLL + #endif // _MSC_VER #ifndef LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |