Skip to content

Commit

Permalink
Fix synth gain went missing in saved project data (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nahkd123 committed Sep 17, 2023
1 parent c04ea77 commit 993c0eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/engine/src/nodes/group/GroupNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GroupIONode, GroupInputsNode, GroupOutputsNode } from "./GroupIONode.js

interface GroupNodeSavedData {
children: SavedNodesNetwork;
synthGain: number;
}

interface SynthPlayingNote {
Expand Down Expand Up @@ -107,7 +108,10 @@ export class GroupNode implements INode<GroupNode, GroupNodeSavedData> {
}

saveNode(): GroupNodeSavedData {
return { children: this.children.save() };
return {
children: this.children.save(),
synthGain: (this.synthAudioGain.socket as AudioParam).value
};
}

createCopy(): GroupNode {
Expand Down Expand Up @@ -178,6 +182,9 @@ export class GroupNode implements INode<GroupNode, GroupNodeSavedData> {
portFrom.onConnectedToPort(portTo);
});

// Synth
(node.synthAudioGain.socket as AudioParam).value = data.synthGain ?? 1.0;

return node;
}
};
Expand Down

0 comments on commit 993c0eb

Please sign in to comment.