Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Microphone state #24

Open
c4ldas opened this issue Oct 26, 2024 · 0 comments
Open

Read Microphone state #24

c4ldas opened this issue Oct 26, 2024 · 0 comments

Comments

@c4ldas
Copy link

c4ldas commented Oct 26, 2024

Checking the documenation (https://corsairofficial.github.io/cue-sdk/), I could see there is a CorsairReadDeviceProperty. My initial idea was to read the current mic status.

However, that option isn't available to use in the library. Looking into the node_modules, I found the cue-sdk/src/CorsairSdk.cc has the lines below commented (line 532):

exports["CorsairGetDevicePropertyInfo"] = Napi::Function::New(env, corsairGetDevicePropertyInfo);
exports["CorsairReadDeviceProperty"] = Napi::Function::New(env, corsairReadDeviceProperty);
exports["CorsairWriteDeviceProperty"] = Napi::Function::New(env, corsairWriteDeviceProperty);
exports["CorsairFreeProperty"] = Napi::Function::New(env, corsairFreeProperty);

However, even if commented out, that doesn't make them available to use. I believe it would need some rebuild and the function corsairReadDeviceProperty would need to be written, is that correct?
If so, could anyone give me some help on how to do that? I tried to look at the original SDK, but couldn't find anything related to that (it seems the source code is not available).

Unfortunately, I don't have any experience in C/C++ (other than one semester at university 20 years ago and never used it after that)... I tried to create the function based on what already existed in the CorsairSdk.cc, but I have no idea if that would work:

Napi::Object corsairReadDeviceProperty(const Napi::CallbackInfo &info) 
{
  const auto env = info.Env();
  auto result = Napi::Object::New(env);
  auto deviceId = info[size_t(0)].As<Napi::String>().Utf8Value();
  auto propertyId = info[size_t(1)].As<Napi::Number>().Int32Value();
  auto index = info[size_t(2)].As<Napi::Number>().Uint32Value();

  CorsairProperty property;
  const auto err = CorsairReadDeviceProperty(deviceId.c_str(), static_cast<CorsairDevicePropertyId>(propertyId), index, &property);
  result["error"] = (int)err;
  if (err == CorsairError::CE_Success) 
  {
    auto data = Napi::Object::New(env);
    result["data"] = data;    
  }

  return result;
}

I appreciate any help on that, even to say that is not possible and I'm wasting time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant