Skip to content

Commit

Permalink
fix: populate tone names in metadata for Sound Switch CC `defaultTo…
Browse files Browse the repository at this point in the history
…neId` (#6452)
  • Loading branch information
AlCalzone authored Oct 23, 2023
1 parent 88ddf8d commit 3c729a4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/cc/src/cc/SoundSwitchCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,7 @@ default volume: ${config.defaultVolume}`;
});
}

const metadataStates: Record<number, string> = {
0: "off",
};
const metadataStates: Record<number, string> = {};
for (let toneId = 1; toneId <= toneCount; toneId++) {
applHost.controllerLog.logNode(node.id, {
message: `requesting info for tone #${toneId}`,
Expand All @@ -439,14 +437,25 @@ duration: ${info.duration} seconds`;
});
metadataStates[toneId] = `${info.name} (${info.duration} sec)`;
}
metadataStates[0xff] = "default";

// Remember tone count and info on the default tone ID metadata
this.setMetadata(applHost, SoundSwitchCCValues.defaultToneId, {
...SoundSwitchCCValues.defaultToneId.meta,
min: 1,
max: toneCount,
states: metadataStates,
});

// Remember tone count and info on the tone ID metadata
this.setMetadata(applHost, SoundSwitchCCValues.toneId, {
...SoundSwitchCCValues.toneId.meta,
min: 0,
max: toneCount,
states: metadataStates,
states: {
0: "off",
...metadataStates,
[0xff]: "default",
},
});

// Remember that the interview is complete
Expand Down

0 comments on commit 3c729a4

Please sign in to comment.