Exemplo n.º 1
0
        //Testing
        void SetAndRollEqData()
        {
            //SL: The following demonstrates how to pass EqData to our C++ DLL
            SoundGraphDisplay.IDW_SetVfdEqData(iEqData);
            //Move our data for our next pass
            for (int i = 0; i < 15; i++)
            {
                iEqData.BandData[i] = iEqData.BandData[i + 1];
            }

            if (iEqData.BandData[14] == 100)
            {
                //Maxed bounce back down
                iEqData.BandData[15] = 90;
            }
            else if (iEqData.BandData[14] == 0)
            {
                //Mined bounce back up
                iEqData.BandData[15] = 10;
            }
            else if (iEqData.BandData[13] > iEqData.BandData[14])
            {
                //Going down
                iEqData.BandData[15] = iEqData.BandData[14] - 10;
            }
            else if (iEqData.BandData[13] < iEqData.BandData[14])
            {
                //Going up
                iEqData.BandData[15] = iEqData.BandData[14] + 10;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        protected void UpdateEq()
        {
            if (!(iSettings.iEq.UseEqDisplay & iSettings.iEq._EqDataAvailable))
            {
                return;
            }
            if (iSettings.iEq.RestrictEQ &
                ((DateTime.Now.Ticks - iSettings.iEq._LastEQupdate.Ticks) < iSettings.iEq._EqUpdateDelay))
            {
                return;
            }
            //if (DoDebug)
            {
                //SoundGraphDisplay.LogInfo("\niMONLCDg.DisplayEQ(): Retrieved {0} samples of Equalizer data.", EQSettings.EqFftData.Length / 2);
            }

            if (IsLcd())
            {
                //Force stereo mode for LCD
                iSettings.iEq.UseStereoEq = true;
            }

            if ((iSettings.iEq.UseStereoEq || iSettings.iEq.UseVUmeter) || iSettings.iEq.UseVUmeter2)
            {
                if (iSettings.iEq.UseStereoEq)
                {
                    //Stereo mode
                    iSettings.iEq.Render_MaxValue = 100;
                    iSettings.iEq.Render_BANDS    = 8;
                    iSettings.iEq.EqArray[0]      = 0x63;

                    /*
                     * if ((_DisplayType == DisplayType.LCD) || (_DisplayType == DisplayType.LCD2))
                     * {
                     *  EQSettings.Render_MaxValue = (EQSettings._useEqMode == 2) ? 8 : 0x10;
                     *  EQSettings.EqArray[0] = (byte)EQSettings._useEqMode;
                     * }
                     * else if (_DisplayType == DisplayType.ThreeRsystems)
                     * {
                     *  EQSettings.Render_MaxValue = 6;
                     *  EQSettings.EqArray[0] = 0;
                     * }
                     */
                    MiniDisplayHelper.ProcessEqData(ref iSettings.iEq);
                    for (int i = 0; i < iSettings.iEq.Render_BANDS; i++)
                    {
                        switch (iSettings.iEq.EqArray[0])
                        {
                        case 2:
                        {
                            var num2 = (byte)(iSettings.iEq.EqArray[1 + i] & 15);
                            iSettings.iEq.EqArray[1 + i] = (byte)((num2 << 4) | num2);
                            var num3 = (byte)(iSettings.iEq.EqArray[9 + i] & 15);
                            iSettings.iEq.EqArray[9 + i] = (byte)((num3 << 4) | num3);
                            break;
                        }
                        }
                    }
                    for (int j = 15; j > 7; j--)
                    {
                        iSettings.iEq.EqArray[j + 1] = iSettings.iEq.EqArray[j];
                    }
                    iSettings.iEq.EqArray[8] = 0;
                    iSettings.iEq.EqArray[9] = 0;
                }
                else
                {
                    //UV Meter or UV Meter: unused
                    iSettings.iEq.Render_MaxValue = 80;
                    iSettings.iEq.Render_BANDS    = 1;

                    if (iSettings.iEq._useVUindicators)
                    {
                        iSettings.iEq.Render_MaxValue = 0x4b;
                    }
                    MiniDisplayHelper.ProcessEqData(ref iSettings.iEq);
                }
            }
            else
            {
                iSettings.iEq.Render_MaxValue = 100;
                iSettings.iEq.Render_BANDS    = 0x10;
                iSettings.iEq.EqArray[0]      = 0x63;

                //if ((_DisplayType == DisplayType.LCD) || (_DisplayType == DisplayType.LCD2))
                if (IsLcd())
                {
                    iSettings.iEq.Render_MaxValue = (iSettings.iEq._useEqMode == 2) ? 8 : 0x10;
                    iSettings.iEq.EqArray[0]      = (byte)iSettings.iEq._useEqMode;
                }

                /*
                 * else if (_DisplayType == DisplayType.ThreeRsystems)
                 * {
                 *  EQSettings.Render_MaxValue = 6;
                 *  EQSettings.EqArray[0] = 0;
                 * }*/
                MiniDisplayHelper.ProcessEqData(ref iSettings.iEq);
                for (int k = 0; k < iSettings.iEq.Render_BANDS; k++)
                {
                    switch (iSettings.iEq.EqArray[0])
                    {
                    case 2:
                    {
                        var num6 = (byte)(iSettings.iEq.EqArray[1 + k] & 15);
                        iSettings.iEq.EqArray[1 + k] = (byte)((num6 << 4) | num6);
                        break;
                    }
                    }
                }
            }

            //if ((_DisplayType == DisplayType.LCD) || (_DisplayType == DisplayType.LCD2))
            if (IsLcd())
            {
                if (!iSettings.iEq.UseVUmeter && !iSettings.iEq.UseVUmeter2)
                {
                    //SetEQ(EQSettings.EqArray);
                    //We take the last 16 entries cause the first one is static

                    for (int i = 1; i < 17; i++)
                    {
                        iEqDataLeft.BandData[i - 1]  = iSettings.iEq.EqArray[i];
                        iEqDataRight.BandData[i - 1] = iSettings.iEq.EqArray[i];
                    }

                    //Array.Copy(iSettings.iEq.EqArray, 1, iEqDataLeft.BandData, 0, 0x10);
                    //Array.Copy(iSettings.iEq.EqArray, 1, iEqDataRight.BandData, 0, 0x10);
                    SoundGraphDisplay.IDW_SetLcdEqData(iEqDataLeft, iEqDataRight);
                }
                else
                {
                    //DrawVU(EQSettings.EqArray);
                }
            }

            /*
             * else if (_DisplayType == DisplayType.ThreeRsystems)
             * {
             *  for (int m = 0; m < 8; m++)
             *  {
             *      EQSettings.EqArray[1 + m] =
             *        (byte)((EQSettings.EqArray[1 + m] << 4) + EQSettings.EqArray[9 + m]);
             *  }
             *  ulong data = 0x0901000000000000L;
             *  ulong num9 = 0x0000000000000002L;
             *  data = data + EQSettings.EqArray[1] << 40;
             *  data = data + EQSettings.EqArray[2] << 0x20;
             *  data = data + EQSettings.EqArray[3] << 0x18;
             *  data = data + EQSettings.EqArray[4] << 0x10;
             *  data = data + EQSettings.EqArray[5] << 8;
             *  num9 = num9 + EQSettings.EqArray[6] << 40;
             *  num9 = num9 + EQSettings.EqArray[7] << 0x20;
             *  num9 = num9 + EQSettings.EqArray[8] << 0x18;
             *  SendData(0x0200020000000000L);
             *  SendData(0x0000000000000002L);
             *  SendData(0x0d0f202020202000L);
             *  SendData(0x2020202020202002L);
             *  SendData(data);
             *  SendData(num9);
             * }
             */
            else if (IsVfd())
            {
                if (!iSettings.iEq.UseVUmeter && !iSettings.iEq.UseVUmeter2)
                {
                    //var destinationArray = new int[0x10];
                    //We take the last 16 entries cause the first one is static
                    //Array.Copy(iSettings.iEq.EqArray, 1, iEqData.BandData, 0, 0x10);

                    for (int i = 1; i < 17; i++)
                    {
                        iEqData.BandData[i - 1] = iSettings.iEq.EqArray[i];
                    }

                    SoundGraphDisplay.IDW_SetVfdEqData(iEqData);
                    goto Label_0613;
                }
                //DrawVU(EQSettings.EqArray);
            }
Label_0613:
            iSettings.iEq._LastEQupdate = DateTime.Now;
            if ((DateTime.Now.Ticks - iSettings.iEq._EQ_FPS_time.Ticks) < 0x989680L)
            {
                iSettings.iEq._EQ_Framecount++;
            }
            else
            {
                iSettings.iEq._Max_EQ_FPS    = Math.Max(iSettings.iEq._Max_EQ_FPS, iSettings.iEq._EQ_Framecount);
                iSettings.iEq._EQ_Framecount = 0;
                iSettings.iEq._EQ_FPS_time   = DateTime.Now;
            }
        }