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

fix: populate tone names in metadata for Sound Switch CC defaultToneId #6452

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions packages/cc/src/cc/SoundSwitchCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,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 @@ -438,14 +436,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