# mixer.cpp File Reference

Mixing of sound samples. More...

`#include "stdafx.h"`
`#include "mixer.h"`
`#include "core/math_func.hpp"`

Go to the source code of this file.

## Data Structures
struct | MixerChannel
## Functions
static void | mix_int8_to_int16 (MixerChannel *sc, int16 *buffer, uint samples)
static void | MxCloseChannel (MixerChannel *mc)
void | MxMixSamples (void *buffer, uint samples)
MixerChannel * | MxAllocateChannel ()
void | MxSetChannelRawSrc (MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags)
void | MxSetChannelVolume (MixerChannel *mc, uint left, uint right)
void | MxActivateChannel (MixerChannel *mc)
bool | MxInitialize (uint rate)
## Variables
static MixerChannel | _channels [8]
static uint32 | _play_rate = 11025
static const int | MAX_VOLUME = 128 * 128
| The theoretical maximum volume for a single sound sample.

## Detailed Description

Mixing of sound samples.

Definition in file mixer.cpp.

## Variable Documentation

const int MAX_VOLUME = 128 * 128`[static]`

The theoretical maximum volume for a single sound sample.

Multiple sound samples should not exceed this limit as it will sound too loud. It also stops overflowing when too many sounds are played at the same time, which causes an even worse sound quality.

Definition at line 37 of file mixer.cpp.