Volume control doesn't update

I’m trying to build an extension that adds external volume control to Dynaudio Connect using the node-roon-api-volume-control API: https://github.com/RoonLabs/node-roon-api-volume-control

I now built a method to catch set_volume requests coming from Roon:

  set_volume: function (req, mode, value) {
    console.log(this.state);
    let newvol = mode == "absolute" ? value : (this.state.volume_value + value);
    if      (newvol < this.state.volume_min) newvol = this.state.volume_min;
    else if (newvol > this.state.volume_max) newvol = this.state.volume_max;

    this.state.volume_value = newvol;
    req.send_complete("Success");
  }

This seems to work and the state object is updated whenever I change volume in Roon (I see the volume_value changing in the logs). However, the volume slider in Roon keeps jumping back to the initial value. Do I need to send some kind of confirmation back to Roon to confirm the change and update the new value? I assume sending req.send_complete(“Success”) would do that, or am I wrong?

are you implementing get_volume?

Not yet, no. My assumption (based on https://github.com/RoonLabs/node-roon-api-volume-control/blob/master/lib.js) was that get_all would do the job.

How is get_volume implemented? My guess now was something like this (but it didn’t work):

  get_volume: function() {
    req.send_complete("Success", { volume: this.state.volume_value});
  }

Is this documented anywhere?

sorry no… i mispoke…

set_volume is telling the extension that the volume change is requested - at some later point, you must reflect that back as a state update showing that the state has been indeeded updated.


and

The Meridian one, I use every day so I know it works… the Devialet one became obsolete since our AIR integration, so it’s not really up-to-date.

Both however are a great place to start when writing this extension.

Let me know if you need more info or assistance. I should pick up a Dynaudio Connect, we have a lot of people asking for this integration.

Perfect, this works! See here:

One strange hack/workaround I had to do was to multiply the volume values in Roon with 5, so that I can adjust the volume by one step with my keyboard. Jumps of 5 (as they happen when I press cmd-up) are too much when the system only has 31 steps. Or am I missing something? Is it possible to set this somehow?

tell me about the Connect… what is it’s volume range, and how doe sit move when you use a slider/remote?

You could sent Step to be 0.2 and it’d solve you /5 problem I think.

You arent there yet, but there are 2 ways you can stop hardcoding that IP as well:

  1. use the settings service to expose it as an input field in the Roon UI
  2. do discovery and present all the Connects in a dropdown using the settings service.

I owe a lot of what I know to @Muffinman and his excellent Connect API documentation:

The volume ranges from 0 to 31 (0x00 to 0x1f).

I tried setting volume_step to 0.2, but it still jumps e.g. from 10.4 to 15.4 when I use cmd-up.

dont worry about the cmd-up… i should fix that ui issue related to the gui to via steps and not via aboslute nubers

If the normal steps are 0-31, can you do partial steps or are steps integer based only? For example, Devialet Expert can go from like -97.5 to +30, with 0.5 level steps.

No, these are integer based steps. There’s no official documentation, so I’m not sure if these steps actually stand for anything like dB.

any user interface, knob, or remote? are there only 32 steps on that control mechanism?

The volume can be controlled using either their iOS app (via TCP network requests), or via the speaker’s IR remote control. I tried counting how many steps there are going from zero to full using the IR remote, and it’s roughly 32 (it’s a bit harder to count precisely since there’s no clear feedback).

Are you in touch with Dynaudio to make their Connect Roon Ready? It seems that the interfaces wouldn’t be all too hard to build and the system really is a perfect match for digital music and thus Roon. The only major issue I’m experiencing with my integration at the moment is that the Connect’s TCP interface seems to crash every once in a while, requiring a restart (I’ve contacted their support).

@danny Kudos for the new volume control in Roon 1.4! So much improvement in fact that I decided it’s now possible to make my Dynaudio setup work just the way I want it. So I spent some more time programming the Dynaudio volume control extension and noticed a strange bug:

The program now listens to volume updates from the Dynaudio Connect and updates the Roon volume accordingly. This works fine on my iOS Roon remote, but the volume changes don’t show up on the Roon Core on my Mac.

Same when I change the volume from the iOS remote: the volume changes, but it doesn’t show on the Roon Core.

Changing the volume on the Mac fixes the issue for a while, but after a few minutes, it’s back again.

See demo here: https://youtu.be/BvEbwD1WEg8

@danny I’ve noticed this is still there in Roon 1.5. Volume changes from the iOS app (and from external volume controls) don’t update on Roon Core on my Mac.

Do you have a code repo available? Nothing changed and my Meridian extendiyng works everyday. This issue must be with your code.

Yes, the repo is here: https://github.com/naepflin/roon-extension-dynaudio

And here’s a demo of how it looks like:

The volume is not updated for volume updates that come direct from the Dynaudio Connect, but also not for volume updates made through Roon Remote (iOS app --> Roon Core --> Roon extension --> Dynaudio Connect).

@danny I’m not sure this is an API issue. I get the same when I change language on iOS Roon Remote using the system output device, which has a native volume control.

Old topic but exactly what I am looking for. Despite being completely in over my head I have been able to get an extension working for volume and source control of my Niles Zr6 , just can’t get the volume slider to update. Have tried to follow the samples above and many more but I just can’t get it figured out. Would someone show me the specific code that updates the volume status?

pointer to your existing code and the protocol of the device?

Not connecting directly to the Niles. I’m using http.request to send post commands to a vb program I wrote years ago that talks to the Niles and a few other devices around the house. The PostCode function updates the Niles and returns the volume level between 0 and 100. This all works fine, just don’t know how to update the volume_value in Roon. I don’t have much experience with java script so following the examples is a bit difficult for me.

set_volume: function (req, mode, value) {
	let newvol = mode == "absolute" ? value : (this.state.volume_value + value);
	if      (newvol < this.state.volume_min) newvol = this.state.volume_min;
	else if (newvol > this.state.volume_max) newvol = this.state.volume_max;

    this.state.volume_value = PostCode(NilesZone, newvol);
	console.log("newvol: ", newvol, "returned value: ", this.state.volume_value);

	req.send_complete("Success");

Missed the first bit of my code.

const NilesVolumeControl = svc_volume_control.new_device({
state: {
display_name: “NilesVolume”,
control_key: 1,
volume_type: “number”,
volume_min: 0,
volume_max: 100,
volume_value: PostCode(NilesZone, “volume”),
volume_step: 1,
is_muted: false
},