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

rename device to instance #78

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
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
28 changes: 14 additions & 14 deletions src/actions/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ConnectionType, GraphConnectionRecord, GraphNode, GraphNodeRecord, Grap
import { getConnection, getConnectionByNodesAndPorts, getConnectionsForSourceNodeAndPort, getNode, getPatcherNodeByIndex, getNodes, getSystemNodeByJackNameAndDirection, getConnections, getPatcherNodes, getSystemNodes } from "../selectors/graph";
import { showNotification } from "./notifications";
import { NotificationLevel } from "../models/notification";
import { DeviceStateRecord } from "../models/device";
import { deleteDevice, setDevice, setDevices } from "./instances";
import { getDevice } from "../selectors/instances";
import { InstanceStateRecord } from "../models/instance";
import { deleteInstance, setInstance, setInstances } from "./instances";
import { getInstance } from "../selectors/instances";
import { PatcherRecord } from "../models/patcher";
import { Connection, EdgeChange, NodeChange } from "reactflow";
import { isValidConnection } from "../lib/editorUtils";
Expand Down Expand Up @@ -205,7 +205,7 @@ export const initNodes = (jackPortsInfo: OSCQueryRNBOJackPortInfo, instanceInfo:
const state = getState();
const existingNodes = getNodes(state);

const devices: DeviceStateRecord[] = [];
const instances: InstanceStateRecord[] = [];
const patcherNodes: GraphPatcherNodeRecord[] = [];

let meta: OSCQuerySetMeta = { nodes: {} };
Expand All @@ -228,7 +228,7 @@ export const initNodes = (jackPortsInfo: OSCQueryRNBOJackPortInfo, instanceInfo:
}

patcherNodes.push(node);
devices.push(DeviceStateRecord.fromDescription(info));
instances.push(InstanceStateRecord.fromDescription(info));
}

// Build a list of all Jack generated names that have not been used for PatcherNodes above
Expand Down Expand Up @@ -266,7 +266,7 @@ export const initNodes = (jackPortsInfo: OSCQueryRNBOJackPortInfo, instanceInfo:

dispatch(deleteNodes(existingNodes.valueSeq().toArray()));
dispatch(setNodes([...systemNodes, ...patcherNodes]));
dispatch(setDevices(devices));
dispatch(setInstances(instances));
};


Expand Down Expand Up @@ -399,14 +399,14 @@ export const updateSystemPortInfo = (type: ConnectionType, direction: PortDirect
};

// Trigger Updates on remote OSCQuery Runner
export const unloadPatcherNodeByIndexOnRemote = (deviceIndex: number): AppThunk =>
export const unloadPatcherNodeByIndexOnRemote = (instanceIndex: number): AppThunk =>
(dispatch) => {
try {

const message = {
address: "/rnbo/inst/control/unload",
args: [
{ type: "i", value: deviceIndex }
{ type: "i", value: instanceIndex }
]
};
oscQueryBridge.sendPacket(writePacket(message));
Expand Down Expand Up @@ -740,9 +740,9 @@ export const addPatcherNode = (desc: OSCQueryRNBOInstance, metaString: string):

dispatch(setNode(node));

// Create Device State
const device = DeviceStateRecord.fromDescription(desc);
dispatch(setDevice(device));
// Create Instance State
const instance = InstanceStateRecord.fromDescription(desc);
dispatch(setInstance(instance));
};

export const removePatcherNode = (index: number): AppThunk =>
Expand All @@ -754,9 +754,9 @@ export const removePatcherNode = (index: number): AppThunk =>
if (node?.type !== NodeType.Patcher) return;
dispatch(deleteNode(node));

const device = getDevice(state, node.id);
if (!device) return;
dispatch(deleteDevice(device));
const instance = getInstance(state, node.id);
if (!instance) return;
dispatch(deleteInstance(instance));
} catch (e) {
console.log(e);
}
Expand Down
Loading
Loading