node-minidsp icon indicating copy to clipboard operation
node-minidsp copied to clipboard

Added getSource(), fixed _getMasterStatus(), Constants cleanup

Open markubiak opened this issue 7 years ago • 1 comments

Many things in this PR, if you want me to split them up let me know.

  1. Fixed bugs in _getMasterStatus(). According to the Air app, it seems that the actual volume is -0.5 * the volume returned from the buffer. There was also an issue with the buffer slice causing it to always throw errors.
  2. Renamed setInput() to setSource() and updated throughout. This is confusing when you have an "Input" class, and when getInput is related to that class instead of the selected source. I would also recommend changing the command to switch source from "minidsp input X" to "minidsp source X" to match, but I made sure the changes were backwards compatible with this command.
  3. Added getInput(). Returns the current input as a string. Very straightforward.
  4. Updated constants.js to be more useful. There is now Constants.SOURCE_INDEX[string], which, when given "analog", "toslink", etc. returns the associated index. It now also works the other way with Constants.SOURCE_NAME[index], which returns the string associated with an index. I've updated your code to use these variables.

markubiak avatar May 18 '17 19:05 markubiak

I'm publishing my minidsp control module and would like this PR to be mainlined (and updated on npm) so that I don't have to create and maintain my own fork. Is there something I can fix in the PR?

Mark

markubiak avatar Sep 19 '17 20:09 markubiak