# LoadPIMap

Loads a program-instrument map from a text file.

### Synopsis

`Err LoadPIMap( ScoreContext *scon, char *FileName )`

### Description

This function reads the designated program-instrument map file (PIMap file) and writes appropriate values to the specified score context's PIMap. It also assigns appropriate sampled sound instruments to samples listed in the PIMap file and imports all instrument templates listed in the PIMap file.

For information about the format of a PIMap file, read the "Playing MIDI Scores" chapter of the Portfolio Programmer's Guide.

Note that if you want to set a score context's PIMap entries directly, you can use `SetPIMapEntry()`.

### Arguments

scon
  Pointer to a ScoreContext data structure.

FileName
  Pointer to the character string containing the name of the PIMap file.

### Return Value

This function returns 0 if successful or an error code (a negative value) if an error occurs.

### Implementation

Library call implemented in music.lib V20.

### Associated Files

score.h, music.lib

### See Also

``SetPIMapEntry`(), UnloadPIMap()`