示例#1
0
        internal HolofunkState(
            Clock clock,
            HolofunkSceneGraph sceneGraph, 
            HolofunkBass bass, 
            HolofunKinect kinect,
            float initialBPM)
        {
            m_clock = clock;
            m_sceneGraph = sceneGraph;
            m_bass = bass;
            m_kinect = kinect;

            m_requestedBPM = initialBPM;

            m_player0 = new PlayerModel(0, HolofunkBassAsio.AsioInputChannelId0, this);
            m_player1 = new PlayerModel(1, HolofunkBassAsio.AsioInputChannelId1, this);
        }
        internal HolofunkSceneGraph(
            GraphicsDevice graphicsDevice,
            Vector2 canvasSize,
            Texture2D depthTexture,
            HolofunkTextureContent holofunkContent,
            HolofunkBass audio,
            Clock clock)
            : base()
        {
            m_content = holofunkContent;
            m_clock = clock;

            RootNode = new GroupNode(null, Transform.Identity, "Root");
            m_canvasSize = canvasSize;

            m_background = new SpriteNode(
                RootNode,
                "Background",
                TextureFactory.ShadedCornerColor(
                    graphicsDevice,
                    canvasSize,
                    Color.Black,
                    new Color(0x10, 0x10, 0x10, 0x10),
                    new Color(0x20, 0x20, 0x20, 0x20),
                    new Color(0x20, 0x20, 0x20, 0x20)));
            m_background.LocalTransform = Transform.Identity;

            m_slide = new SpriteNode(
                RootNode,
                "Slide",
                Content.Slides[0]);
            m_slide.LocalTransform = new Transform(new Vector2(canvasSize.X - (int)(Content.Slides[0].Width * 1.1f),
                (canvasSize.Y - (int)Content.Slides[0].Height) / 2));
            m_slide.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.TextureMirrored);

            // constructing the nodes adds them as children of the parent, in first-at-bottom Z order.

            SpriteNode depthNode = new SpriteNode(
                RootNode,
                "DepthImage",
                depthTexture);
            depthNode.LocalTransform = new Transform(
                Vector2.Zero,
                new Vector2((float)canvasSize.X / depthTexture.Width, (float)canvasSize.Y / depthTexture.Height));

            // we want the depth node texture (only) to be mirrored about the center of the viewport
            depthNode.SetSecondaryViewOption(SecondaryViewOption.TextureMirrored); // B4CR: should this also be | PositionMirrored?

            m_audio = audio;

            // Center the textures.
            Vector2 origin = new Vector2(0.5f);

            m_statusText = new TextNode(RootNode, "StatusText");
            m_statusText.SetSecondaryViewOption(SecondaryViewOption.Hidden);
            m_statusText.LocalTransform = new Transform(new Vector2(30f, 20f), new Vector2(MagicNumbers.StatusTextScale));

            // make sure that first update pushes status text
            m_frameCount = MagicNumbers.StatusTextUpdateInterval - 1;

            m_beatNode = new BeatNode(
                RootNode,
                new Transform(new Vector2(m_canvasSize.X / 2, m_canvasSize.Y / 8 * 7)),
                "Root Beater",
                false,
                MagicNumbers.MeasureCircleScale,
                () => (long)((float)clock.ContinuousBeatDuration * 4),
                () => 0,
                () => Color.White);

            m_trackGroupNode = new GroupNode(RootNode, Transform.Identity, "Track group");
        }
        internal HolofunkBassAsio(HolofunkBass bass)
        {
            m_bass = bass;

            m_outputAsioProcAverageLatency = new FloatAverager(20);
            m_outputAsioProcStopwatch = new Stopwatch();
            m_mixerToOutputAsioProc = new ASIOPROC(MixerToOutputAsioProc);
        }
示例#4
0
        /// <summary>Allows the game to perform any initialization it needs to before starting to run.</summary>
        /// <remarks>This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.</remarks>
        protected override void Initialize()
        {
            new Test(GraphicsDevice).RunAllTests();

            // HORRIBLE HACK: just ensure the statics are initialized
            string s = PlayerEffectSpaceModel.EffectSettings[0].LeftLabel;

            m_audioAllocator = new BufferAllocator<float>(2 * 4 * Clock.TimepointRateHz, 128, sizeof(float));

            m_holofunkBass = new HolofunkBass(m_clock, m_audioAllocator);
            m_holofunkBass.StartASIO();

            m_kinect = new HolofunKinect(GraphicsDevice, BodyFrameUpdate);

            m_viewportSize = m_kinect.ViewportSize;

            m_videoAllocator = new BufferAllocator<byte>(64 * MagicNumbers.HeadCaptureBytes, 128, 1);

            base.Initialize();

            // oh dear

            m_holofunkBass.SetBaseForm(m_primaryForm, MagicNumbers.MaxStreamCount);

            Window.Title = "Holofunk Alpha";
            Window.AllowUserResizing = true;

            /*
            object nativeWindow = Window.NativeWindow;
            System.Windows.Forms.Form asForm = nativeWindow as System.Windows.Forms.Form;
            asForm.SetDesktopBounds(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            //asForm.SetDesktopBounds(100, 100, (int)(m_viewportSize.X * 2), (int)(m_viewportSize.Y * 2));
            */
        }
示例#5
0
        /// <summary>Dispose this and all its state.</summary>
        /// <remarks>This seems to be called twice... so making it robust to that.</remarks>
        protected override void Dispose(bool disposeManagedResources)
        {
            if (m_kinect != null) {
                m_kinect.Dispose();
                m_kinect = null;
            }

            if (m_holofunkBass != null) {
                m_holofunkBass.Dispose();
                m_holofunkBass = null;
            }

            base.Dispose(disposeManagedResources);
        }