Skip to content

Commit

Permalink
only send meta when we actually clear midi
Browse files Browse the repository at this point in the history
  • Loading branch information
x37v committed Jun 22, 2024
1 parent 5b9ce1e commit 8f8c0fa
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/actions/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,23 +304,18 @@ export const clearParameterMidiMappingOnRemote = (id: InstanceStateRecord["id"],
const param = instance.parameters.get(paramId);
if (!param) return;

let meta = param.meta;
try {
const j = JSON.parse(meta);
delete j.midi;
meta = JSON.stringify(j);
} catch {
// Ignore
}

const message = {
address: `${param.path}/meta`,
args: [
{ type: "s", value: meta }
]
};
const meta = param.getParsedMeta();
if (typeof meta === "object") {
delete meta.midi;
const message = {
address: `${param.path}/meta`,
args: [
{ type: "s", value: JSON.stringify(meta) }
]
};

oscQueryBridge.sendPacket(writePacket(message));
oscQueryBridge.sendPacket(writePacket(message));
}
};

export const setInstanceMessagePortMetaOnRemote = (_instance: InstanceStateRecord, port: MessagePortRecord, value: string): AppThunk =>
Expand Down

0 comments on commit 8f8c0fa

Please sign in to comment.