NScumm.Scumm.Audio.IMuse.IMuseDigital.BundleCodecs.InitializeImcTables C# (CSharp) Method

InitializeImcTables() public static method

public static InitializeImcTables ( ) : void
return void
        public static void InitializeImcTables()
        {
            int pos;

            if (_destImcTable == null)
                _destImcTable = new byte[89];
            if (_destImcTable2 == null)
                _destImcTable2 = new uint[89 * 64];

            for (pos = 0; pos <= 88; ++pos)
            {
                byte put = 1;
                int tableValue = ((Ima_ADPCMStream._imaTable[pos] * 4) / 7) / 2;
                while (tableValue != 0)
                {
                    tableValue /= 2;
                    put++;
                }
                if (put < 3)
                {
                    put = 3;
                }
                if (put > 8)
                {
                    put = 8;
                }
                _destImcTable[pos] = (byte)(put - 1);
            }

            for (int n = 0; n < 64; n++)
            {
                for (pos = 0; pos <= 88; ++pos)
                {
                    int count = 32;
                    int put = 0;
                    int tableValue = Ima_ADPCMStream._imaTable[pos];
                    do
                    {
                        if ((count & n) != 0)
                        {
                            put += tableValue;
                        }
                        count /= 2;
                        tableValue /= 2;
                    } while (count != 0);
                    _destImcTable2[n + pos * 64] = (uint)put;
                }
            }
        }

Usage Example

コード例 #1
0
 public ImuseDigiSndMgr(ScummEngine scumm)
 {
     _vm             = scumm;
     _disk           = 0;
     _cacheBundleDir = new BundleDirCache();
     BundleCodecs.InitializeImcTables();
 }