Initialize the Chroma SDK in order to utilize the API. The InitSDK
method takes an AppInfo
parameter which defines the application or game details that will appear in the Chroma App
within the Chroma Apps
tab. The expected return result should be RazerErrors.RZRESULT_SUCCESS
which indicates the API is ready for use. If a non-success result is returned, the Chroma implementation should be disabled until the next time the application or game is launched. Reasons for failure are likely to be the user does not have the Synapse
or the Chroma App
installed. After successfully initializing the Chroma SDK, wait approximately 100 ms before playing Chroma Animations.
Note: For the appInfo.Title parameter, do not use characters forbidden in naming a Windows/Linux folder: < (less than), > (greater than), : (colon), “ (double quote), / (forward slash), \ (backslash), | (vertical bar or pipe), ? (question mark), * (asterisk)
APPINFOTYPE appInfo = new APPINFOTYPE();
appInfo.Title = "Unity Sample Scene - Chromatic";
appInfo.Description = "A sample application using Razer Chroma SDK";
// For appInfo.Title, do not use characters forbidden in naming a Windows/Linux folder: < (less than), > (greater than), : (colon), “ (double quote), / (forward slash), \ (backslash), | (vertical bar or pipe), ? (question mark), * (asterisk)
appInfo.Author_Name = "Razer";
appInfo.Author_Contact = "https://developer.razer.com/chroma";
//appInfo.SupportedDevice =
// 0x01 | // Keyboards
// 0x02 | // Mice
// 0x04 | // Headset
// 0x08 | // Mousepads
// 0x10 | // Keypads
// 0x20 // ChromaLink devices
appInfo.SupportedDevice = (0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20);
// 0x01 | // Utility. (To specifiy this is an utility application)
// 0x02 // Game. (To specifiy this is a game);
appInfo.Category = 1;
int result = ChromaAnimationAPI.InitSDK(ref appInfo);
if (result == RazerErrors.RZRESULT_SUCCESS)
{
// Init Success! Ready to use the Chroma SDK!
}
else
{
// Init Failed! Stop using the Chroma SDK until the next game launch!";
}
Applications should uninitialize the Chroma SDK with Uninit() for a clean exit. Uninitialization is only needed if the Chroma SDK was successfully initialized.
int result = ChromaAnimationAPI::Uninit();
if (result == RazerErrors.RZRESULT_SUCCESS)
{
// Chroma has been uninitialized!
}
else
{
// Uninitialization was unsuccessful!
}