From: <man...@us...> - 2013-04-02 17:37:24
|
Revision: 1702 http://sourceforge.net/p/modplug/code/1702 Author: manxorist Date: 2013-04-02 17:37:11 +0000 (Tue, 02 Apr 2013) Log Message: ----------- [Ref] Make the magic value tables in Tables.cpp const and add a proper Tables.h header. [Ref] Remove the rather pointless custom sections .modplug and .tables . Modified Paths: -------------- trunk/OpenMPT/mptrack/EffectInfo.cpp trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/Load_mod.cpp trunk/OpenMPT/soundlib/Snd_flt.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Snd_rvb.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/Tables.cpp trunk/OpenMPT/soundlib/modcommand.cpp Added Paths: ----------- trunk/OpenMPT/soundlib/Tables.h Modified: trunk/OpenMPT/mptrack/EffectInfo.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectInfo.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/mptrack/EffectInfo.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -12,9 +12,8 @@ #include "EffectInfo.h" #include "mptrack.h" #include "..\soundlib\modcommand.h" +#include "../soundlib/Tables.h" -extern WORD S3MFineTuneTable[16]; - /////////////////////////////////////////////////////////////////////////// // Effects description Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2013-04-02 17:37:11 UTC (rev 1702) @@ -1083,6 +1083,10 @@ > </File> <File + RelativePath=".\Tables.h" + > + </File> + <File RelativePath=".\tagging.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2013-04-02 17:37:11 UTC (rev 1702) @@ -426,6 +426,7 @@ <ClInclude Include="..\soundlib\SampleFormatConverters.h" /> <ClInclude Include="..\soundlib\SampleIO.h" /> <ClInclude Include="..\soundlib\snd_rvb.h" /> + <ClInclude Include="..\soundlib\Tables.h" /> <ClInclude Include="..\soundlib\WAVTools.h" /> <ClInclude Include="..\soundlib\XMTools.h" /> <ClInclude Include="ACMConvert.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2013-04-02 17:37:11 UTC (rev 1702) @@ -777,6 +777,9 @@ <ClInclude Include="..\sounddsp\EQ.h"> <Filter>Header Files\sounddsp</Filter> </ClInclude> + <ClInclude Include="..\soundlib\Tables.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -17,8 +17,6 @@ #include "WindowedFIR.h" -#pragma bss_seg(".modplug") - // Front Mix Buffer (Also room for interleaved rear mix) int MixSoundBuffer[MIXBUFFERSIZE * 4]; @@ -30,9 +28,7 @@ int MixRearBuffer[MIXBUFFERSIZE * 2]; float MixFloatBuffer[MIXBUFFERSIZE * 2]; -#pragma bss_seg() - #ifndef NO_REVERB extern UINT gnReverbSend; #endif Modified: trunk/OpenMPT/soundlib/Load_mod.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_mod.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Load_mod.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -11,6 +11,7 @@ #include "stdafx.h" #include "Loaders.h" +#include "Tables.h" void CSoundFile::ConvertModCommand(ModCommand &m) const //----------------------------------------------------- @@ -1025,8 +1026,6 @@ #include "../mptrack/moddoc.h" #endif // MODPLUG_TRACKER -extern WORD ProTrackerPeriodTable[6*12]; - bool CSoundFile::SaveMod(LPCSTR lpszFileName) const //------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/Snd_flt.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_flt.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Snd_flt.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -11,6 +11,7 @@ #include "stdafx.h" #include "sndfile.h" +#include "Tables.h" // AWE32: cutoff = reg[0-255] * 31.25 + 100 -> [100Hz-8060Hz] // EMU10K1 docs: cutoff = reg[0-127]*62+100 @@ -18,9 +19,7 @@ #define _USE_MATH_DEFINES #include <math.h> -extern float ITResonanceTable[128]; - DWORD CSoundFile::CutOffToFrequency(UINT nCutOff, int flt_modifier) const //----------------------------------------------------------------------- { Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -20,27 +20,11 @@ #include "../mptrack/moddoc.h" #endif // MODPLUG_TRACKER #include "tuning.h" +#include "Tables.h" #pragma warning(disable:4244) -// Tables defined in tables.cpp -extern BYTE ImpulseTrackerPortaVolCmd[16]; -extern WORD S3MFineTuneTable[16]; -extern WORD ProTrackerPeriodTable[6*12]; -extern WORD ProTrackerTunedPeriods[15*12]; -extern WORD FreqS3MTable[]; -extern WORD XMPeriodTable[96+8]; -extern UINT XMLinearTable[768]; -extern DWORD FineLinearSlideUpTable[16]; -extern DWORD FineLinearSlideDownTable[16]; -extern DWORD LinearSlideUpTable[256]; -extern DWORD LinearSlideDownTable[256]; -extern signed char retrigTable1[16]; -extern signed char retrigTable2[16]; -extern short int ModRandomTable[64]; -extern BYTE ModEFxTable[16]; - //////////////////////////////////////////////////////////// // Length Modified: trunk/OpenMPT/soundlib/Snd_rvb.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_rvb.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Snd_rvb.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -22,10 +22,8 @@ extern VOID MPPASMCALL X86_StereoFill(int *pBuffer, UINT nSamples, LPLONG lpROfs, LPLONG lpLOfs); // Reverb mix buffers -#pragma bss_seg(".modplug") static SWRVBREFDELAY g_RefDelay; static SWLATEREVERB g_LateReverb; -#pragma bss_seg() // Shared reverb state UINT gnReverbSamples = 0; Modified: trunk/OpenMPT/soundlib/Sndmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Sndmix.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -14,6 +14,7 @@ #include "sndfile.h" #include "MIDIEvents.h" #include "tuning.h" +#include "Tables.h" #ifdef MODPLUG_TRACKER #include "../mptrack/TrackerSettings.h" #endif @@ -68,18 +69,6 @@ extern VOID MPPASMCALL X86_MonoFromStereo(int *pMixBuf, UINT nSamples); extern void SndMixInitializeTables(const MixerSettings &mixersettings); -extern short int ModSinusTable[64]; -extern short int ModRampDownTable[64]; -extern short int ModSquareTable[64]; -extern short int ModRandomTable[64]; -extern short int ITSinusTable[256]; -extern short int ITRampDownTable[256]; -extern short int ITSquareTable[256]; -extern DWORD LinearSlideUpTable[256]; -extern DWORD LinearSlideDownTable[256]; -extern DWORD FineLinearSlideUpTable[16]; -extern DWORD FineLinearSlideDownTable[16]; -extern signed char ft2VibratoTable[256]; // -64 .. +64 extern int MixSoundBuffer[MIXBUFFERSIZE * 4]; extern int MixRearBuffer[MIXBUFFERSIZE * 2]; Modified: trunk/OpenMPT/soundlib/Tables.cpp =================================================================== --- trunk/OpenMPT/soundlib/Tables.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/Tables.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -10,6 +10,7 @@ #include "stdafx.h" +#include "Tables.h" #include <math.h> #include "sndfile.h" @@ -28,7 +29,7 @@ char *extension; // "mod" }; -const ModFormatInfo modFormatInfo[] = +static const ModFormatInfo modFormatInfo[] = { { MOD_TYPE_MOD, "ProTracker", "mod" }, { MOD_TYPE_S3M, "ScreamTracker III", "s3m" }, @@ -78,7 +79,7 @@ { MOD_TYPE_MPT, "OpenMPT", "mptmz" }, }; -const ModFormatInfo otherFormatInfo[] = +static const ModFormatInfo otherFormatInfo[] = { // Other stuff { MOD_TYPE_WAV, "Wave", "wav" }, @@ -113,19 +114,15 @@ /////////////////////////////////////////////////////////////////////// -#pragma data_seg(".tables") -#pragma bss_seg(".modplug") -/////////////////////////////////////////////////////////////////////// - -BYTE ImpulseTrackerPortaVolCmd[16] = +const BYTE ImpulseTrackerPortaVolCmd[16] = { 0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; // Period table for Protracker octaves 0-5: -WORD ProTrackerPeriodTable[6*12] = +const WORD ProTrackerPeriodTable[6*12] = { 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, 856,808,762,720,678,640,604,570,538,508,480,453, @@ -136,7 +133,7 @@ }; -WORD ProTrackerTunedPeriods[16*12] = +const WORD ProTrackerTunedPeriods[16*12] = { 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, 1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900, @@ -157,14 +154,14 @@ }; // Table for Invert Loop and Funk Repeat effects (EFx, .MOD only) -BYTE ModEFxTable[16] = +const BYTE ModEFxTable[16] = { 0, 5, 6, 7, 8, 10, 11, 13, 16, 19, 22, 26, 32, 43, 64, 128 }; // S3M C-4 periods -WORD FreqS3MTable[16] = +const WORD FreqS3MTable[16] = { 1712,1616,1524,1440,1356,1280, 1208,1140,1076,1016,960,907, @@ -172,7 +169,7 @@ }; // S3M FineTune frequencies -WORD S3MFineTuneTable[16] = +const WORD S3MFineTuneTable[16] = { 7895,7941,7985,8046,8107,8169,8232,8280, 8363,8413,8463,8529,8581,8651,8723,8757, // 8363*2^((i-8)/(12*8)) @@ -180,7 +177,7 @@ // Sinus table -short int ModSinusTable[64] = +const short int ModSinusTable[64] = { 0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126, 127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12, @@ -189,7 +186,7 @@ }; // Triangle wave table (ramp down) -short int ModRampDownTable[64] = +const short int ModRampDownTable[64] = { 0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60, -64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124, @@ -198,7 +195,7 @@ }; // Square wave table -short int ModSquareTable[64] = +const short int ModSquareTable[64] = { 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, @@ -218,7 +215,7 @@ // Impulse Tracker tables (ITTECH.TXT) // Sinus table -short int ITSinusTable[256] = +const short int ITSinusTable[256] = { 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, @@ -239,7 +236,7 @@ }; // Triangle wave table (ramp down) -short int ITRampDownTable[256] = +const short int ITRampDownTable[256] = { 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, @@ -260,7 +257,7 @@ }; // Square wave table -short int ITSquareTable[256] = +const short int ITSquareTable[256] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -281,16 +278,16 @@ }; // volume fade tables for Retrig Note: -signed char retrigTable1[16] = +const signed char retrigTable1[16] = { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 }; -signed char retrigTable2[16] = +const signed char retrigTable2[16] = { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 }; -WORD XMPeriodTable[104] = +const WORD XMPeriodTable[104] = { 907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814, 808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725, @@ -302,7 +299,7 @@ }; -UINT XMLinearTable[768] = +const UINT XMLinearTable[768] = { 535232,534749,534266,533784,533303,532822,532341,531861, 531381,530902,530423,529944,529466,528988,528511,528034, @@ -403,7 +400,7 @@ }; -signed char ft2VibratoTable[256] = +const signed char ft2VibratoTable[256] = { 0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23, -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42, @@ -425,21 +422,21 @@ -DWORD FineLinearSlideUpTable[16] = +const DWORD FineLinearSlideUpTable[16] = { 65536, 65595, 65654, 65714, 65773, 65832, 65892, 65951, 66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429 }; -DWORD FineLinearSlideDownTable[16] = +const DWORD FineLinearSlideDownTable[16] = { 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123, 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645 }; -DWORD LinearSlideUpTable[256] = +const DWORD LinearSlideUpTable[256] = { 65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213, 67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182, @@ -477,7 +474,7 @@ -DWORD LinearSlideDownTable[256] = +const DWORD LinearSlideDownTable[256] = { 65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900, 63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081, @@ -515,7 +512,7 @@ // LUT for 2 * damping factor -float ITResonanceTable[128] = +const float ITResonanceTable[128] = { 1.0000000000000000f, 0.9786446094512940f, 0.9577452540397644f, 0.9372922182083130f, 0.9172759056091309f, 0.8976871371269226f, 0.8785166740417481f, 0.8597555756568909f, @@ -636,10 +633,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////// -#pragma bss_seg() -#pragma data_seg() - - // Compute Bessel function Izero(y) using a series approximation static double izero(double y) { Added: trunk/OpenMPT/soundlib/Tables.h =================================================================== --- trunk/OpenMPT/soundlib/Tables.h (rev 0) +++ trunk/OpenMPT/soundlib/Tables.h 2013-04-02 17:37:11 UTC (rev 1702) @@ -0,0 +1,37 @@ +/* + * Tables.h + * -------- + * Purpose: Effect, interpolation, data and other pre-calculated tables. + * Notes : (currently none) + * Authors: Olivier Lapicque + * OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + + +extern const BYTE ImpulseTrackerPortaVolCmd[16]; +extern const WORD ProTrackerPeriodTable[6*12]; +extern const WORD ProTrackerTunedPeriods[16*12]; +extern const BYTE ModEFxTable[16]; +extern const WORD FreqS3MTable[16]; +extern const WORD S3MFineTuneTable[16]; +extern const short int ModSinusTable[64]; +extern const short int ModRampDownTable[64]; +extern const short int ModSquareTable[64]; +extern short int ModRandomTable[64]; +extern const short int ITSinusTable[256]; +extern const short int ITRampDownTable[256]; +extern const short int ITSquareTable[256]; +extern const signed char retrigTable1[16]; +extern const signed char retrigTable2[16]; +extern const WORD XMPeriodTable[104]; +extern const UINT XMLinearTable[768]; +extern const signed char ft2VibratoTable[256]; +extern const DWORD FineLinearSlideUpTable[16]; +extern const DWORD FineLinearSlideDownTable[16]; +extern const DWORD LinearSlideUpTable[256]; +extern const DWORD LinearSlideDownTable[256]; +extern const float ITResonanceTable[128]; Property changes on: trunk/OpenMPT/soundlib/Tables.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/OpenMPT/soundlib/modcommand.cpp =================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp 2013-03-28 10:56:48 UTC (rev 1701) +++ trunk/OpenMPT/soundlib/modcommand.cpp 2013-04-02 17:37:11 UTC (rev 1702) @@ -10,10 +10,9 @@ #include "stdafx.h" #include "Sndfile.h" +#include "Tables.h" -extern BYTE ImpulseTrackerPortaVolCmd[16]; - // Convert an Exx command (MOD) to Sxx command (S3M) void ModCommand::ExtendedMODtoS3MEffect() //--------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |