Exemple #1
0
            public static Settings Load()
            {
                Settings settings;

                SoundGraphDisplay.LogDebug("SoundGraphImon.Settings.Load(): started");
                if (File.Exists(Config.GetFile(Config.Dir.Config, m_Filename)))
                {
                    SoundGraphDisplay.LogDebug("SoundGraphImon.Settings.Load(): Loading settings from XML file");
                    var serializer = new XmlSerializer(typeof(Settings));
                    var xmlReader  = new XmlTextReader(Config.GetFile(Config.Dir.Config, m_Filename));
                    settings = (Settings)serializer.Deserialize(xmlReader);
                    xmlReader.Close();
                }
                else
                {
                    SoundGraphDisplay.LogDebug("SoundGraphImon.Settings.Load(): Loading settings from defaults");
                    settings = new Settings();
                    Default(settings);
                    SoundGraphDisplay.LogDebug("SoundGraphImon.Settings.Load(): Loaded settings from defaults");
                }

                //Sync our EQ settings
                settings.iEq.UseEqDisplay        = settings.EqDisplay;
                settings.iEq.DelayEQ             = settings.EqStartDelay;
                settings.iEq._DelayEQTime        = settings.DelayEqTime;
                settings.iEq.EQTitleDisplay      = settings.EqPeriodic;
                settings.iEq._EQTitleShowTime    = settings.EqDisabledTimeInSeconds;
                settings.iEq._EQTitleDisplayTime = settings.EqEnabledTimeInSeconds;


                SoundGraphDisplay.LogDebug("SoundGraphImon.Settings.Load(): completed");
                return(settings);
            }
Exemple #2
0
        private void SetMediaProgress()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaProgress() called");
            int newMediaCurrentPosition = 0;

            if (g_Player.Player != null && g_Player.Player.Playing)
            {
                double duration        = g_Player.Duration;
                double currentPosition = g_Player.CurrentPosition;
                if (duration == 0)
                {
                    newMediaCurrentPosition = 0;
                }
                else
                {
                    newMediaCurrentPosition =
                        (int)((g_Player.CurrentPosition / g_Player.Duration) * MediaTotalTime);
                }
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaProgress(): determined media position: " + newMediaCurrentPosition);
            }
            else
            {
                newMediaCurrentPosition = 0;
            }

            if (newMediaCurrentPosition != _currentMediaCurrentPosition)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaProgress(): new settings found, call API");
                SoundGraphDisplay.IDW_SetLcdProgress(newMediaCurrentPosition, MediaTotalTime);
                _currentMediaCurrentPosition = newMediaCurrentPosition;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaProgress() completed");
        }
Exemple #3
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;
            }
        }
Exemple #4
0
        private void AdvancedSettings_OnSettingsChanged()
        {
            SoundGraphDisplay.LogDebug("SoundGraphImon.AdvancedSettings_OnSettingsChanged(): RELOADING SETTINGS");

            //CleanUp();
            //Thread.Sleep(100);
            LoadAdvancedSettings();
            //Initialize();
        }
Exemple #5
0
        public override void Configure()
        {
            //Open our advanced setting dialog
            SoundGraphDisplay.LogDebug("SoundGraphImonLcd.Configure() called");
            Form form = new SoundGraphImonSettingsForm();

            form.ShowDialog();
            form.Dispose();
            SoundGraphDisplay.LogDebug("SoundGraphImonLcd.Configure() completed");
        }
Exemple #6
0
        public override void Configure()
        {
            //Our display is initialized, now open the advanced setting dialog
            SoundGraphDisplay.LogDebug("SoundGraphImonVfd.Configure() called");
            SoundGraphImonSettingsForm form = new SoundGraphImonSettingsForm();

            //Hide our LCD tab since we configure a VFD display
            //TODO: make this a method of SoundGraphImonSettingsForm
            form.tabControl.TabPages.Remove(form.tabLcd);
            form.ShowDialog();
            form.Dispose();
            SoundGraphDisplay.LogDebug("(IDisplay) SoundGraphImonVfd.Configure() completed");
        }
Exemple #7
0
        private void SetMediaTypeIcons()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaTypeIcons() called");
            SoundGraphDisplay.MediaTypes newMediaTypes = SoundGraphDisplay.MediaTypes.None;

            _activeWindowInfo.ActiveWindow = GUIWindowManager.ActiveWindow;
            if (_activeWindowInfo.IsWeather)
            {
                newMediaTypes |= SoundGraphDisplay.MediaTypes.News_Weather;
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaTypeIcons(): in weather plugin");
            }

            if (g_Player.Player != null && g_Player.Player.Playing)
            {
                if (g_Player.IsCDA)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Cd_Dvd;
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Music;
                }
                if (g_Player.IsDVD || g_Player.IsDVDMenu)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Cd_Dvd;
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Movie;
                }
                if (g_Player.IsMusic)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Music;
                }
                if (g_Player.IsTV || g_Player.IsTVRecording)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Tv;
                }
                if (g_Player.IsVideo)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.Movie;
                }
                if (_activeWindowInfo.IsWebCasting)
                {
                    newMediaTypes |= SoundGraphDisplay.MediaTypes.WebCasting;
                }
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaTypeIcons(): determined media type: " + newMediaTypes);
            }

            if (_currentMediaTypes != newMediaTypes)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaTypeIcons(): new settings found, call API");
                SoundGraphDisplay.IDW_SetLcdMediaTypeIcon((byte)newMediaTypes);
                _currentMediaTypes = newMediaTypes;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetMediaTypeIcons() completed");
        }
Exemple #8
0
 public override void Update()
 {
     //Check if we need to show EQ this is also taking into account our various settings.
     iSettings.iEq._EqDataAvailable = MiniDisplayHelper.GetEQ(ref iSettings.iEq);
     if (iSettings.iEq._EqDataAvailable)
     {
         //SetAndRollEqData();
         UpdateEq();
     }
     else if (NeedTextUpdate)
     {
         //Not show EQ then display our lines
         SoundGraphDisplay.IDW_SetVfdText(TextTopLine, TextBottomLine);
         NeedTextUpdate = false;
     }
 }
Exemple #9
0
        public override void Update()
        {
            //Check if we need to show EQ this is also taking into account our various settings.
            iSettings.iEq._EqDataAvailable = MiniDisplayHelper.GetEQ(ref iSettings.iEq);
            if (iSettings.iEq._EqDataAvailable)
            {
                //SetAndRollEqData();
                UpdateEq();
            }
            else if (NeedTextUpdate)
            {
                //Not showing EQ then display our lines
                //Only show the second line for now

                bool isPlaying = g_Player.Player != null && g_Player.Player.Playing;

                if (isPlaying && iSettings.PreferFirstLinePlayback)
                {
                    SoundGraphDisplay.IDW_SetLcdText(TextTopLine);
                }
                else if (!isPlaying && iSettings.PreferFirstLineGeneral)
                {
                    SoundGraphDisplay.IDW_SetLcdText(TextTopLine);
                }
                else
                {
                    SoundGraphDisplay.IDW_SetLcdText(TextBottomLine);
                }

                NeedTextUpdate = false;
            }

            //Update our icons here, only very N seconds
            if (SoundGraphDisplay.IsElapsed(LastIconUpdateTime, 2))
            {
                SetMediaTypeIcons();
                SetCodecs();
                SetMediaProgress();
                SetSpeakerConfig();
                SetAspectRatio();
                SetEtcIcons();
                LastIconUpdateTime = DateTime.Now;
            }
        }
Exemple #10
0
        private void SetAspectRatio()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetAspectRatio() called");
            byte newAspectRatioIcons = 0;

            if (g_Player.Player != null && g_Player.Player.Playing &&
                g_Player.MediaInfo != null && g_Player.IsVideo)
            {
                int videoHeight = g_Player.MediaInfo.Height;

                if (videoHeight >= 720)
                {
                    newAspectRatioIcons |= (byte)SoundGraphDisplay.AspectRatios.HDTV;
                }
                else if (videoHeight > 0)
                {
                    newAspectRatioIcons |= (byte)SoundGraphDisplay.AspectRatios.TV;
                }
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetAspectRatio(): determined video height: " + videoHeight);

                if (g_Player.ARType == Geometry.Type.Original)
                {
                    newAspectRatioIcons |= (byte)SoundGraphDisplay.AspectRatios.SRC;
                }
                else
                {
                    newAspectRatioIcons |= (byte)SoundGraphDisplay.AspectRatios.FIT;
                }
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetAspectRatio(): determined ARType: " + g_Player.ARType.ToString());
            }
            else
            {
                newAspectRatioIcons = 0;
            }

            if (newAspectRatioIcons != _currentAspectRatioIcons)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetAspectRatio(): new settings found, call API");
                SoundGraphDisplay.IDW_SetLcdAspectRatioIcon(newAspectRatioIcons);
                _currentAspectRatioIcons = newAspectRatioIcons;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetAspectRatio() completed");
        }
Exemple #11
0
        //Here comes icon management methods

        private void SetEtcIcons()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetEtcIcons() called");
            SoundGraphDisplay.EtcIcons newEtcIcons = SoundGraphDisplay.EtcIcons.None;

            if (MiniDisplayHelper.MPStatus.Media_IsRecording)
            {
                newEtcIcons |= SoundGraphDisplay.EtcIcons.Recording;
            }

            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetEtcIcons(): determined media type: " + newEtcIcons);

            if (_currentEtcIcons != newEtcIcons)
            {
                Log.Info("(IDisplay) ImonLcd.SetEtcIcons(): new settings found, call API");
                SoundGraphDisplay.IDW_SetLcdEtcIcon((byte)newEtcIcons);
                _currentEtcIcons = newEtcIcons;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetEtcIcons() completed");
        }
Exemple #12
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;
            }
        }
Exemple #13
0
        private void SetCodecs()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs() called");
            byte newVideoCodecs = 0;
            byte newAudioCodecs = 0;

            if (g_Player.Player != null && g_Player.Player.Playing)
            {
                if (g_Player.MediaInfo != null && !g_Player.MediaInfo.MediaInfoNotloaded && g_Player.IsVideo && g_Player.MediaInfo.BestVideoStream != null)
                {
                    // video playback
                    _videoMediaInfo.Format = g_Player.MediaInfo.BestVideoStream.Codec.ToCodecString();
                    _audioMediaInfo.Format = g_Player.MediaInfo.BestAudioStream?.Codec.ToCodecString() ?? string.Empty;

                    // video stream
                    if (_videoMediaInfo.IsMpg)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.MPG;
                    }
                    else if (_videoMediaInfo.IsMpg2)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.MPG2;
                    }
                    else if (_videoMediaInfo.IsDivx)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.DIVX;
                    }
                    else if (_videoMediaInfo.IsXvid)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.XVID;
                    }
                    else if (_videoMediaInfo.IsWmv)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.WMV;
                    }

                    // audio stream
                    if (_audioMediaInfo.IsMp3)
                    {
                        newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.MP3;
                    }
                    else if (_audioMediaInfo.IsWma)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.WMA;
                    }
                    else if (_audioMediaInfo.IsDts)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.DTS;
                    }
                    else if (_audioMediaInfo.IsAc3)
                    {
                        newVideoCodecs |= (byte)SoundGraphDisplay.VideoCodecs.AC3;
                    }
                    else if (_audioMediaInfo.IsOgg)
                    {
                        newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.OGG;
                    }
                    SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): determined video codec: " + newVideoCodecs);
                    SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): determined audio codec: " + newAudioCodecs);
                }
                else if (g_Player.IsMusic)
                {
                    // music playback
                    string currentFile = g_Player.currentFileName;
                    SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): determined current music file: " + currentFile);
                    if (currentFile != null && currentFile.Length > 0)
                    {
                        string extension = System.IO.Path.GetExtension(currentFile).ToUpper();

                        switch (extension)
                        {
                        case ".MP3":
                            newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.MP3;
                            break;

                        case ".OGG":
                            newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.OGG;
                            break;

                        case ".WMA":
                            newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.WMA;
                            break;

                        case ".WAV":
                            newAudioCodecs |= (byte)SoundGraphDisplay.AudioCodecs.WAV;
                            break;

                        default:
                            break;
                        }
                        SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): determined music codec by extension: " + newAudioCodecs);
                    }
                }
            }
            else
            {
                newVideoCodecs = 0;
            }

            if (newVideoCodecs != _currentVideoCodecs)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): new video settings found, call API");
                SoundGraphDisplay.IDW_SetLcdVideoCodecIcon(newVideoCodecs);
                _currentVideoCodecs = newVideoCodecs;
            }

            if (newAudioCodecs != _currentAudioCodecs)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs(): new audio settings found, call API");
                SoundGraphDisplay.IDW_SetLcdAudioCodecIcon(newAudioCodecs);
                _currentAudioCodecs = newAudioCodecs;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetCodecs() completed");
        }
Exemple #14
0
        private void SetSpeakerConfig()
        {
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetSpeakerConfig() called");
            byte newSpeakers = 0, newSpeakerRR = 0;

            if (g_Player.Player != null && g_Player.Player.Playing && g_Player.MediaInfo != null)
            {
                switch (g_Player.MediaInfo.AudioChannels)
                {
                case 1:     // mono
                case 2:     // stereo
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.R;
                    break;

                case 3:     // 2.1
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.LFE;
                    break;

                case 4:     // quad
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SL;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SR;
                    break;

                case 5:     // surround
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SL;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SR;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.C;
                    break;

                case 6:     // 5.1
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.RL;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.C;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.LFE;
                    newSpeakerRR |= (byte)SoundGraphDisplay.SpeakersRR.RR;
                    break;

                case 7:     // 6.1
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SL;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.SR;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.C;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.LFE;
                    newSpeakers |= (byte)SoundGraphDisplay.Speakers.RL;
                    break;

                case 8:     // 7.1
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.L;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.R;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.SL;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.SR;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.C;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.LFE;
                    newSpeakers  |= (byte)SoundGraphDisplay.Speakers.RL;
                    newSpeakerRR |= (byte)SoundGraphDisplay.SpeakersRR.RR;
                    break;

                default:     // no audio/unknown
                    newSpeakers = newSpeakerRR = 0;
                    break;
                }
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetSpeakerConfig(): determined speaker config, speakers: " + newSpeakers + ", speakerRR: " + newSpeakerRR);
            }
            else
            {
                newSpeakers = newSpeakerRR = 0;
            }
            if (newSpeakers != _currentSpeakers || newSpeakerRR != _currentSpeakerRR)
            {
                SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetSpeakerConfig(): new settings found, call API");
                SoundGraphDisplay.IDW_SetLcdSpeakerIcon(newSpeakers, newSpeakerRR);
                _currentSpeakers  = newSpeakers;
                _currentSpeakerRR = newSpeakerRR;
            }
            SoundGraphDisplay.LogDebug("(IDisplay) ImonLcd.SetSpeakerConfig() completed");
        }