コード例 #1
0
        private void Init()
        {
            // TODO: Check synapse version. https://chromasdk.io:54236/razer/chromasdk Version must be >= 3.X
            int status = 0;

            try
            {
                status = ChromaAnimationAPI.Init();
                if (status != 0)
                {
                    throw new InvalidOperationException("Chroma SDK exception. Status " + status);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error initializing Razer Chroma controller. Is Razer Synapse installed? Status=" + status);
                throw new InvalidOperationException("Error initializing Razer Chroma controller. Is Razer Synapse installed?", e);
            }
            baseKeyboardAnim = ChromaAnimationAPI.CreateAnimationInMemory((int)ChromaAnimationAPI.DeviceType.DE_2D, (int)ChromaAnimationAPI.Device2D.Keyboard);
            if (baseKeyboardAnim == -1)
            { // TODO: Returns -1 if the keyboard is not connected? Check how it works
                MessageBox.Show("Error initializing Razer Chroma controller. Check that your keyboard is connected and Razer Synapse is installed");
                throw new InvalidOperationException("CreateAnimationInMemory ChromaSDK returned -1");
            }
            // is AddFrame needed?
            ChromaAnimationAPI.AddFrame(baseKeyboardAnim, 1, new int[MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS], MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS);
        }
コード例 #2
0
        private void Init()
        {
            // TODO: Check synapse version. https://chromasdk.io:54236/razer/chromasdk Version must be >= 3.X
            int status = 0;

            try
            {
                status = ChromaAnimationAPI.Init();
                if (status != 0)
                {
                    throw new InvalidOperationException("Chroma SDK exception. Status " + status);
                }
            }
            catch (Exception e)
            {
                string errorString = "Please make sure that Razer Synapse 3 is installed and updated to the latest version.";
                switch ((long)status)
                {
                case RZRESULT_DLL_NOT_FOUND:
                    errorString = "Couldn't find Chroma SDK. This is usually caused because Razer Synapse 3 is not installed or updated to the latest version.";
                    break;

                case RZRESULT_SERVICE_NOT_ACTIVE:
                    errorString = "The Chroma SDK service is not active. This is usually caused because Razer Synapse VERSION 3 is not installed or updated to the latest version.";
                    break;
                }
                MessageBox.Show("Error initializing Razer Chroma controller. Status=" + status + "\n" + errorString);
                throw new InvalidOperationException("Error initializing Razer Chroma controller. Is Razer Synapse installed?", e);
            }

            baseKeyboardAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_2D, (int)ChromaAnimationAPI.Device2D.Keyboard);
            //ChromaAnimationAPI.AddFrame(baseKeyboardAnim, 1, new int[MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS], MAX_KEYBOARD_COLS * MAX_KEYBOARD_ROWS);

            baseMouseAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_2D, (int)ChromaAnimationAPI.Device2D.Mouse);

            baseMousepadAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_1D, (int)ChromaAnimationAPI.Device1D.Mousepad);

            baseHeadsetAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_1D, (int)ChromaAnimationAPI.Device1D.Headset);

            baseKeypadAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_2D, (int)ChromaAnimationAPI.Device2D.Keypad);

            baseGeneralAnim = CreateAnimation(ChromaAnimationAPI.DeviceType.DE_1D, (int)ChromaAnimationAPI.Device1D.ChromaLink);


            disposed = false;
        }
コード例 #3
0
    public void Start()
    {
        ChromaAnimationAPI._sStreamingAssetPath = Application.streamingAssetsPath;
        _mResult      = ChromaAnimationAPI.Init();
        _mInitialized = true;
        switch (_mResult)
        {
        case RazerErrors.RZRESULT_DLL_NOT_FOUND:
            Debug.LogError(string.Format("Chroma DLL is not found! {0}", RazerErrors.GetResultString(_mResult)));
            break;

        case RazerErrors.RZRESULT_DLL_INVALID_SIGNATURE:
            Debug.LogError(string.Format("Chroma DLL has an invalid signature! {0}", RazerErrors.GetResultString(_mResult)));
            break;

        case RazerErrors.RZRESULT_SUCCESS:
            break;

        default:
            Debug.LogError(string.Format("Failed to initialize Chroma! {0}", RazerErrors.GetResultString(_mResult)));
            break;
        }
    }
コード例 #4
0
ファイル: Rmidi.cs プロジェクト: AzorMusics/TypeMidi
        public static void Init()
        {
            _mResult = ChromaAnimationAPI.Init();
            switch (_mResult)
            {
            case RazerErrors.RZRESULT_DLL_NOT_FOUND:
                Console.Error.WriteLine("Chroma DLL is not found! {0}", RazerErrors.GetResultString(_mResult));
                break;

            case RazerErrors.RZRESULT_DLL_INVALID_SIGNATURE:
                Console.Error.WriteLine("Chroma DLL has an invalid signature! {0}", RazerErrors.GetResultString(_mResult));
                break;

            case RazerErrors.RZRESULT_SUCCESS:
                break;

            default:
                Console.Error.WriteLine("Failed to initialize Chroma! {0}", RazerErrors.GetResultString(_mResult));
                break;
            }

            Update();
        }