Skip to content

Read Microphone state #24

@c4ldas

Description

@c4ldas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions