MusHandleSetPan()

Syntax

int MusHandleSetPan(musHandle handle, int pan);

Arguments

handle
the sound handle
pan
the stereo pan scale

Description

It sets the pan position scale value for the channels associated with the specified sound handle. This function allows the programmer to "move" the pan position of songs and sound effects relevant to the position originally defined within the sound data.

The handle must be a sound handle returned by MusStartSong(), MusStartSongFromMarker(), MusStartEffect(), or MusStartEffect2(). If a handle of zero is supplied, this function will always return zero.

The pan value should be within the range of 0 to 0x100 (256), with this range representing 0% to 200% of the value defined in the original sound data. The default pan position scale value for all channels is 0x80 (100%).

Return Value

Number of channels that have been changed.

Example

void PanFromAngle(unsigned long handle, float angle)
{
  int pan;

  /* calculate pan position */
  if (angle>180.0)
    angle -= 180.0;
  else
    angle = 180.0-angle;
  angle = angle*(256.0/180.0);
  pan = (int)angle;

  MusHandleSetPan(handle, pan);
}

See Also

MusHandleSetVolume(), MusStartSong(), MusStartEffect(), MusStartEffect2()