예제 #1
0
        public void Process(int length)
        {
            lock (lockObject)
            {
                if (OutputBuffer[0].Length < length)
                {
                    OutputBuffer[0] = new double[2 * length];
                    OutputBuffer[1] = new double[2 * length];
                }

                for (int i = 0; i < length; i += bufsize)
                {
                    var f1Env = ModMatrix.Filter1EnvMod;
                    var f2Env = ModMatrix.Filter2EnvMod;
                    for (int n = 0; n < bufsize; n++)
                    {
                        ampEnvBuffer[n]     = AmpEnv.Process(1);
                        filter1EnvBuffer[n] = Filter1Env.Process(1) * f1Env;
                        filter2EnvBuffer[n] = Filter2Env.Process(1) * f2Env;
                    }

                    // Process modulation
                    Mod1.Process(bufsize);
                    Mod2.Process(bufsize);
                    Mod3.Process(bufsize);
                    Mod4.Process(bufsize);
                    Mod5.Process(bufsize);
                    Mod6.Process(bufsize);
                    ModMatrix.Process();

                    Osc1.Process(bufsize);
                    Osc2.Process(bufsize);
                    Osc3.Process(bufsize);
                    Osc4.Process(bufsize);

                    for (int n = 0; n < bufsize; n++)
                    {
                        path1Buffer[n] = Osc1.OutputBuffer[n] * Mixer.Osc1Vol * (1.0 - Mixer.Osc1Mix)
                                         + Osc2.OutputBuffer[n] * Mixer.Osc2Vol * (1.0 - Mixer.Osc2Mix)
                                         + Osc3.OutputBuffer[n] * Mixer.Osc3Vol * (1.0 - Mixer.Osc3Mix)
                                         + Osc4.OutputBuffer[n] * Mixer.Osc4Vol * (1.0 - Mixer.Osc4Mix);

                        path2Buffer[n] = Osc1.OutputBuffer[n] * Mixer.Osc1Vol * Mixer.Osc1Mix
                                         + Osc2.OutputBuffer[n] * Mixer.Osc2Vol * Mixer.Osc2Mix
                                         + Osc3.OutputBuffer[n] * Mixer.Osc3Vol * Mixer.Osc3Mix
                                         + Osc4.OutputBuffer[n] * Mixer.Osc4Vol * Mixer.Osc4Mix;
                    }

                    path1Buffer = Ins1.Process(path1Buffer);
                    path2Buffer = Ins2.Process(path2Buffer);

                    Filter1.Process(path1Buffer, filter1EnvBuffer);
                    Filter2.Process(path2Buffer, filter2EnvBuffer);

                    for (int n = 0; n < bufsize; n++)
                    {
                        processBuffer[n]  = Filter1.OutputBuffer[n] * Mixer.F1Vol + Filter2.OutputBuffer[n] * Mixer.F2Vol;
                        processBuffer[n] *= Mixer.OutputVolume * ampEnvBuffer[n];

                        OutputBuffer[0][i + n] = processBuffer[n];
                        OutputBuffer[1][i + n] = processBuffer[n];
                    }
                }
            }
        }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (OVRInput.GetDown(OVRInput.RawButton.RIndexTrigger))
        {
            // Wall position
            if (BuildStage == 0 && Building == true)
            {
                Wall.SetActive(true);

                WallYrot = ReturnReferencePosition().transform.eulerAngles.y;

                WallPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _wallBuilder.UpdateWallPosition(WallPosition, WallYrot);

                // Save values
                PlayerPrefs.SetFloat("WallPositionX", WallPosition.x);
                PlayerPrefs.SetFloat("WallPositionY", WallPosition.y);
                PlayerPrefs.SetFloat("WallPositionZ", WallPosition.z);

                PlayerPrefs.SetFloat("WallRotationY", WallYrot);

                // Change instructions
                Ins1.SetActive(false);
                Ins2.SetActive(true);
            }

            // Desk position
            if (BuildStage == 1 && Building == true)
            {
                Desk.SetActive(true);

                DeskYrot = ReturnReferencePosition().transform.eulerAngles.y;

                DeskPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskPosition(DeskPosition, DeskYrot);

                // Save values
                PlayerPrefs.SetFloat("DeskPositionX", DeskPosition.x);
                PlayerPrefs.SetFloat("DeskPositionY", DeskPosition.y);
                PlayerPrefs.SetFloat("DeskPositionZ", DeskPosition.z);

                PlayerPrefs.SetFloat("DeskRotationY", DeskYrot);

                // Change instructions
                Ins2.SetActive(false);
                Ins3.SetActive(true);
            }

            // Desk height
            if (BuildStage == 2 && Building == true)
            {
                DeskHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskHeight(DeskHeight);

                // Save values
                PlayerPrefs.SetFloat("DeskHeightX", DeskHeight.x);
                PlayerPrefs.SetFloat("DeskHeightY", DeskHeight.y);
                PlayerPrefs.SetFloat("DeskHeightZ", DeskHeight.z);

                // Change instructions
                Ins3.SetActive(false);
                Ins4.SetActive(true);
            }


            // Desk right
            if (BuildStage == 3 && Building == true)
            {
                DeskRight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskRight(DeskRight);

                // Save values
                PlayerPrefs.SetFloat("DeskRightX", DeskRight.x);
                PlayerPrefs.SetFloat("DeskRightY", DeskRight.y);
                PlayerPrefs.SetFloat("DeskRightZ", DeskRight.z);

                // Change instructions
                Ins4.SetActive(false);
                Ins5.SetActive(true);
            }

            // Desk left
            if (BuildStage == 4 && Building == true)
            {
                DeskLeft = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskLeft(DeskLeft);

                // Save values
                PlayerPrefs.SetFloat("DeskLeftX", DeskLeft.x);
                PlayerPrefs.SetFloat("DeskLeftY", DeskLeft.y);
                PlayerPrefs.SetFloat("DeskLeftZ", DeskLeft.z);

                ContentHolder.transform.position = AttachReference.transform.position;

                // Change instructions
                Ins5.SetActive(false);
                Ins6.SetActive(true);
            }

            // Desk back
            if (BuildStage == 5 && Building == true)
            {
                DeskBack = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _deskBuilder.UpdateDeskBack(DeskBack);

                // Save values
                PlayerPrefs.SetFloat("DeskBackX", DeskBack.x);
                PlayerPrefs.SetFloat("DeskBackY", DeskBack.y);
                PlayerPrefs.SetFloat("DeskBackZ", DeskBack.z);

                // Change instructions
                Ins6.SetActive(false);
                Ins7.SetActive(true);
            }

            // Button 1
            if (BuildStage == 6 && Building == true)
            {
                Button1.SetActive(true);

                Button1Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton1(Button1Pos);

                // Save values
                PlayerPrefs.SetFloat("Button1X", Button1Pos.x);
                PlayerPrefs.SetFloat("Button1Y", Button1Pos.y);
                PlayerPrefs.SetFloat("Button1Z", Button1Pos.z);

                // Change instructions
                Ins7.SetActive(false);
                Ins8.SetActive(true);
            }

            // Button 2
            if (BuildStage == 7 && Building == true)
            {
                Button2.SetActive(true);

                Button2Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton2(Button2Pos);

                // Save values
                PlayerPrefs.SetFloat("Button2X", Button2Pos.x);
                PlayerPrefs.SetFloat("Button2Y", Button2Pos.y);
                PlayerPrefs.SetFloat("Button2Z", Button2Pos.z);

                // Change instructions
                Ins8.SetActive(false);
                Ins9.SetActive(true);
            }

            // Button 3
            if (BuildStage == 8 && Building == true)
            {
                Button3.SetActive(true);

                Button3Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton3(Button3Pos);

                // Save values
                PlayerPrefs.SetFloat("Button3X", Button3Pos.x);
                PlayerPrefs.SetFloat("Button3Y", Button3Pos.y);
                PlayerPrefs.SetFloat("Button3Z", Button3Pos.z);

                // Change instructions
                Ins9.SetActive(false);
                Ins10.SetActive(true);
            }

            // Button 4
            if (BuildStage == 9 && Building == true)
            {
                Button4.SetActive(true);

                Button4Pos = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);
                _deskBuilder.UpdateButton4(Button4Pos);

                // Save values
                PlayerPrefs.SetFloat("Button4X", Button4Pos.x);
                PlayerPrefs.SetFloat("Button4Y", Button4Pos.y);
                PlayerPrefs.SetFloat("Button4Z", Button4Pos.z);

                // Change instructions
                Ins10.SetActive(false);
                Ins11.SetActive(true);
            }

            // Chair position
            if (BuildStage == 10 && Building == true)
            {
                Chair.SetActive(true);

                ChairYrot = ReturnReferencePosition().transform.eulerAngles.y;

                ChairPosition = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairPosition(ChairPosition, ChairYrot);

                // Save values
                PlayerPrefs.SetFloat("ChairPositionX", ChairPosition.x);
                PlayerPrefs.SetFloat("ChairPositionY", ChairPosition.y);
                PlayerPrefs.SetFloat("ChairPositionZ", ChairPosition.z);

                PlayerPrefs.SetFloat("ChairRotationY", ChairYrot);

                // Change instructions
                Ins11.SetActive(false);
                Ins12.SetActive(true);
            }

            // Chair height
            if (BuildStage == 11 && Building == true)
            {
                ChairHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairHeight(ChairHeight);

                // Save values
                PlayerPrefs.SetFloat("ChairHeightX", ChairHeight.x);
                PlayerPrefs.SetFloat("ChairHeightY", ChairHeight.y);
                PlayerPrefs.SetFloat("ChairHeightZ", ChairHeight.z);

                // Change instructions
                Ins12.SetActive(false);
                Ins13.SetActive(true);
            }

            // Chair right
            if (BuildStage == 12 && Building == true)
            {
                ChairRight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairRight(ChairRight);

                // Save values
                PlayerPrefs.SetFloat("ChairRightX", ChairRight.x);
                PlayerPrefs.SetFloat("ChairRightY", ChairRight.y);
                PlayerPrefs.SetFloat("ChairRightZ", ChairRight.z);

                // Change instructions
                Ins13.SetActive(false);
                Ins14.SetActive(true);
            }

            // Chair left
            if (BuildStage == 13 && Building == true)
            {
                ChairLeft = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairLeft(ChairLeft);

                // Save values
                PlayerPrefs.SetFloat("ChairLeftX", ChairLeft.x);
                PlayerPrefs.SetFloat("ChairLeftY", ChairLeft.y);
                PlayerPrefs.SetFloat("ChairLeftZ", ChairLeft.z);

                // Change instructions
                Ins14.SetActive(false);
                Ins15.SetActive(true);
            }

            // Chair back
            if (BuildStage == 14 && Building == true)
            {
                ChairBack = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairBack(ChairBack);

                // Save values
                PlayerPrefs.SetFloat("ChairBackX", ChairBack.x);
                PlayerPrefs.SetFloat("ChairBackY", ChairBack.y);
                PlayerPrefs.SetFloat("ChairBackZ", ChairBack.z);

                // Change instructions
                Ins15.SetActive(false);
                Ins16.SetActive(true);
            }

            // Chair back height
            if (BuildStage == 15 && Building == true)
            {
                ChairBackHeight = new Vector3(ReturnReferencePosition().transform.position.x, ReturnReferencePosition().transform.position.y, ReturnReferencePosition().transform.position.z);

                _chairBuilder.UpdateChairBackHeight(ChairBackHeight);

                // Save values
                PlayerPrefs.SetFloat("ChairBackHeightX", ChairBackHeight.x);
                PlayerPrefs.SetFloat("ChairBackHeightY", ChairBackHeight.y);
                PlayerPrefs.SetFloat("ChairBackHeightZ", ChairBackHeight.z);

                // Change instructions
                Ins16.SetActive(false);
                InstructionCanvas.SetActive(false);

                // Save object positions
                CombineScene();

                PlayerPrefs.SetInt("IsSavedData", 1);

                LaserPointer.SetActive(true);
            }

            if (BuildStage > 15 && Building == true)
            {
                ResetGlobalPosition();
                LaserPointer.SetActive(true);
            }

            if (Building == true)
            {
                BuildStage++;
            }
        }
    }