# InitScoreMixer

Creates and initializes a mixer instrument for MIDI score playback.

### Synopsis

`Err InitScoreMixer( ScoreContext *scon, char *MixerName,int32 MaxNumVoices, int32 Amplitude )`

### Description

This function creates a mixer instrument from the specified instrument template and writes the item number of that mixer into the score context so that notes played with that score context are fed through the mixer. The function uses the maximum number of voices specified to create an appropriate number of note trackers to handle MIDI note playback. The function also uses the amplitude value as the maximum possible amplitude allowed for each voice in the score.

Note that a task should first allocate system amplitude to itself. It can then divide that amplitude up by the number of voices to arrive at a completely safe amplitude value (one that won't drive the DSP to distortion) for this call. Because it's unlikely that all voices will play simultaneously at full amplitude, a task can typically raise amplitude levels above the level considered to be completely safe.

### Arguments

scon
  Pointer to a ScoreContext data structure.

MixerName
  Pointer to a character string containing the name of a mixer instrument template.

MaxNumVoices
  Value indicating the maximum number of voices used for the score.

Amplitude
  Value indicating the maximum volume for each voice in the score.

### 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

``ChangeScoreProgram`(), InitScoreDynamics(), TermScoreMixer(), CreateScoreContext()`