public override bool SetOutputContext(OutputContextType outputType)
        {
            if (VisualizationWindow == null)
            {
                return(false);
            }

            // If width or height are 0 the call will fail.  If width or height are equal to 1
            // the window is in transition.
            if (VisualizationWindow.Width <= 1 || VisualizationWindow.Height <= 1)
            {
                return(false);
            }

            RECT rect = new RECT();

            rect.left   = 0;
            rect.top    = 0;
            rect.right  = VisualizationWindow.Width;
            rect.bottom = VisualizationWindow.Height;

            bool result = SoundSpectrumInterop.SetOutput(SSVisualizationName, outputType, VisualizationWindow.CompatibleDC,
                                                         ref rect);

            // Soundspectrum Graphics always show the cursor, so let's hide it here
            if (GUIGraphicsContext.Fullscreen && _autoHideMouse)
            {
                Cursor.Hide();
            }

            return(result);
        }
Exemple #2
0
        public override void Dispose()
        {
            base.Dispose();

            SoundSpectrumInterop.Quit();
            SoundSpectrumInterop.ShutDown();
        }
        public override int RenderVisualization()
        {
            ////if (VisualizationWindow.InvokeRequired)
            ////{
            ////    ThreadSafeRenderDelegate d = new ThreadSafeRenderDelegate(RenderVisualization);
            ////    return (int)VisualizationWindow.Invoke(d);
            ////}

            try
            {
                if (VisualizationWindow == null || !VisualizationWindow.Visible)
                {
                    return(0);
                }

                int sleepMS = SoundSpectrumInterop.Render();
                return(sleepMS);
            }

            catch (Exception ex)
            {
                Console.WriteLine("Visualization: {0} Render Exception: {1}", VizPluginInfo.Name, ex);
                return(0);
            }
        }
        public override int PreRenderVisualization()
        {
            // The first Render call can take a significant amount of time to return.
            // Consider calling this method from a worker thread to prevent the main thread
            // from blocking while the SoundSpectrum engine does it's own internal initialization.
            //if (VisualizationWindow.InvokeRequired)
            //{
            //    ThreadSafeRenderDelegate d = new ThreadSafeRenderDelegate(PreRenderVisualization);
            //    return (int)VisualizationWindow.Invoke(d);
            //}

            try
            {
                // Soundspectrum Graphics always show the cursor, so let's hide it here
                if (GUIGraphicsContext.Fullscreen && _autoHideMouse)
                {
                    Cursor.Hide();
                }

                return(SoundSpectrumInterop.Render());
            }

            catch
            {
                return(0);
            }
        }
Exemple #5
0
        public override bool Close()
        {
            try
            {
                SoundSpectrumInterop.Quit();
                SoundSpectrumInterop.ShutDown();
            }

            catch
            {
                return(false);
            }

            return(true);
        }
        public override bool Initialize()
        {
            bool result = false;

            try
            {
                DateTime dt = DateTime.Now;
                Log.Info("Visualization Manager: Initializing {0} visualization engine...", VizPluginInfo.Name);

                RECT rect = new RECT();
                rect.left   = 0;
                rect.top    = 0;
                rect.right  = VisualizationWindow.Width;
                rect.bottom = VisualizationWindow.Height;

                OutputContextType outputType = VisualizationWindow.OutputContextType;
                result = SoundSpectrumInterop.InitEngine(SSVisualizationName, outputType, SoundSpectrumInterop.SSCallback,
                                                         VisualizationWindow.CompatibleDC, ref rect);

                // Soundspectrum Graphics always show the cursor, so let's hide it here
                if (GUIGraphicsContext.Fullscreen && _autoHideMouse)
                {
                    Cursor.Hide();
                }

                Log.Info("Visualization Manager: {0} visualization engine initialization {1}", VizPluginInfo.Name,
                         (result ? "succeeded." : "failed!"));
            }

            catch (Exception ex)
            {
                Console.WriteLine("CreateGForceVisualization failed with the following exception: {0}", ex);
                Log.Error(
                    "  Visualization Manager: {0} visualization engine initialization failed with the following exception {1}",
                    VizPluginInfo.Name, ex);
                return(false);
            }

            return(result);
        }
 public override bool IsEngineInstalled()
 {
     return(SoundSpectrumInterop.IsVisualizationInstalled(SSVisualizationName));
 }