ConnectInstrument

# ConnectInstruments

Patches the output of an instrument to the input of another instrument.

### Synopsis

`Err ConnectInstruments (Item SrcIns, char *SrcName, Item DstIns, char *DstName)`

### Description

This function connects an output from one instrument to an input of another instrument. This allows construction of complex "patches" from existing synthesis modules.

An output can be connected to one or more inputs; only one output can be connected to any given input. If you connect an output to a knob, it disconnects that knob from any possible control by `TweakKnob()` or `TweakRawKnob()`. Unlike Attachments, this kind of connection does not create an Item.

Call `DisconnectInstruments()` to break a connection set up by this function.

You should call `DisconnectInstruments()` before deleting either instrument to avoid undesirable noises.

See the DSP Template pages for complete listings of each template's inputs, outputs and knobs.

### Arguments

SrcIns
  Item number of the source instrument.

SrcName
  Name of the output port of the source instrument to connect to.

DstIns
  Item number of the destination instrument.

DstName
  Name of the input port of the destination instrument to connect to.

### Return Value

The function returns a non-negative value if successful or an error code (a negative value) if an error occurs.

### Implementation

SWI implemented in Audio folio V20.

### Notes

Port names are matched case-insensitively.

### Associated Files

audio.h

### See Also

``DisconnectInstruments`()`