FMOD Engine User Manual 2.03

6. Core API Mixing and Routing

This chapter covers the many ways in which channel groups and the dsp graph can be used to manipulate and process your game's sounds.

6.1 Channel Groups and Routing

While it is possible to add the same effect to multiple channels, creating a submix of those channels and adding the effect to that submix requires only a single instance of the effect, and thus consumes fewer resources. This reduces CPU usage greatly.

The primary tool for achieving this in FMOD Studio and the Studio API is the "bus"; in the Core API, it is the "channel group." If multiple channels are routed into the same bus or channel group, the it creates a sub-mix of those signals. If an effect is added to that bus or ChannelGroup, the effect only processes that sub-mix, rather than processing every individual Channel that contributed to it.

The volume of a ChannelGroup can be altered, which allows for master volume groups. The volume is scaled based on a fader DSP inside a ChannelGroup. All Channels and ChannelGroups have a fader DSP by default.

ChannelGroups are hierarchical. ChannelGroups can contain ChannelGroups, which can contain other ChannelGroups and Channels.

Many attributes can be applied to a ChannelGroup, including things like speaker mix, and 3D position. A whole group of Channels, and the ChannelGroups below them, can be positioned in 3D with 1 call, rather than trying to position all of them individually.

'Master Volume', 'SFX Volume' and 'Music Volume' are typical settings in a game. Setting up an 'SFX' ChannelGroup, and a 'Music' ChannelGroup, and having them children of the master ChannelGroup (see System::getMasterChannelGroup)

6.1.1 Channel and Channel Group Handles

All FMOD types, whether they are represented internally via pointer or handle, look like a pointer type. No matter the type, a null pointer will never be returned as a valid result, but it is not safe to assume anything else about the pointer value. Do not assume that the pointer value falls in any particular address range, or that it has any zero bits in the bottom of the pointer value address.

All FMOD types are equivalent for both the C and C++ API. It is possible to cast between the appropriate types by re-interpreting the pointer type directly.

FMOD Channels are returned to you as a pointer, but actually consist of 32 bits of packed integer handle data. This allows Channels to be re-used safely.

If a Channel is stopped with ChannelControl::stop or ends naturally, the Channel handle will become invalid and return FMOD_ERR_INVALID_HANDLE.

If not enough Channels are specified at System::init and an existing virtual Channel is stolen by the FMOD priority system, then the handle to the stolen Channel becomes 'invalid'. Subsequent Channel commands to a stolen handle will return FMOD_ERR_CHANNEL_STOLEN.

FMOD ChannelGroups are returned to you directly as a pointer. Once you destroy a ChannelGroup, it is no longer safe to call FMOD functions with that pointer.

6.2 Upmix/Downmix Behavior

FMOD handles downmixing using mix matrices. Below you can find the various mix matrix layouts, with each table representing a separate output format. In each table, speakers in the "Output" column are assigned levels from the incoming speaker formulas in the relevant row, according to the incoming speaker layout. Different mix matrix layouts can be set using ChannelControl::setMixMatrix. See FMOD_SPEAKER and FMOD_SPEAKERMODE for more details on existing speaker layouts.
For an improved result when using 5.1 on a stereo output device,the Dolby Pro Logic II downmix algorithm can be chosen by specifying FMOD_INIT_PREFER_DOLBY_DOWNMIX as an init flag when calling System::init.

Key Value
M Mono
L Left
R Right
FL Front Left
FR Front Right
C Center
LFE Low Frequency Effects
SL Surround Left
SR Surround Right
BL Back Left
BR Back Right
TFL Top Front Left
TFR Top Front Right
TBL Top Back Left
TBR Top Back Right

6.2.1 Mono

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
M M L x 0.707 + R x 0.707 FL x 0.500 + FR x 0.500 + SL x 0.500 + SR x 0.500 FL x 0.447 + FR x 0.447 + C x 0.447 + BL x 0.447 + BR x 0.447 FL x 0.447 + FR x 0.447 + C x 0.447 + BL x 0.447 + BR x 0.447 FL x 0.378 + FR x 0.378 + C x 0.378 + SL x 0.378 + SR x 0.378 + BL x 0.378 + BR x 0.378 FL x 0.378 + FR x 0.378 + C x 0.378 + SL x 0.378 + SR x 0.378 + BL x 0.378 + BR x 0.378

6.2.2 Stereo

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
L M x 0.707 L FL + SL x 0.707 FL + C x 0.707 + BL x 0.707 FL + C x 0.707 + BL x 0.707 FL + C x 0.707 + SL x 0.707 + BL x 0.596 FL + C x 0.707 + SL x 0.707 + BL x 0.596
R M x 0.707 R FR + SR x 0.707 FR + C x 0.707 + BR x 0.707 FR + C x 0.707 + BR x 0.707 FR + C x 0.707 + SR x 0.707 + BR x 0.596 FR + C x 0.707 + SR x 0.707 + BR x 0.596

6.2.3 Quad

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
FL M x 0.707 L FL FL + C x 0.707 FL + C x 0.707 FL x 0.965 + FR x 0.258 + C x 0.707 + SL x 0.707 FL x 0.965 + FR x 0.258 + C x 0.707 + SL x 0.707
FR M x 0.707 R FR FR + C x 0.707 FR + C x 0.707 FL x 0.258 + FR x 0.965 + C x 0.707 + SR x 0.707 FL x 0.258 + FR x 0.965 + C x 0.707 + SR x 0.707
SL SL BL BL SL x 0.707 + BL x 0.965 + BR x 0.258 SL x 0.707 + BL x 0.965 + BR x 0.258
SR SR BR BR SR x 0.707 + BL x 0.258 + BR x 0.965 SR x 0.707 + BL x 0.258 + BR x 0.965

6.2.4 Surround

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
FL M x 0.707 L FL x 0.961 FL FL FL + SL x 0.367 FL + SL x 0.367
FR M x 0.707 R FR x 0.961 FR FR FR + SR x 0.367 FR + SR x 0.367
C C C C C
BL FL x 0.274 + SL x 0.960 + SR x 0.422 BL BL SL x 0.930 + BL x 0.700 + BR x 0.460 SL x 0.930 + BL x 0.700 + BR x 0.460
BR FR x 0.274 + SL x 0.422 + SR x 0.960 BR BR SR x 0.930 + BL x 0.460 + BR x 0.700 SR x 0.930 + BL x 0.460 + BR x 0.700

6.2.5 5.1

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
FL M x 0.707 L FL x 0.961 FL FL FL + SL x 0.367 FL + SL x 0.367
FR M x 0.707 R FR x 0.961 FR FR FR + SR x 0.367 FR + SR x 0.367
C C C C C
LFE LFE LFE LFE
BL FL x 0.274 + SL x 0.960 + SR x 0.422 BL BL SL x 0.930 + BL x 0.700 + BR x 0.460 SL x 0.930 + BL x 0.700 + BR x 0.460
BR FR x 0.274 + SL x 0.422 + SR x 0.960 BR BR SR x 0.930 + BL x 0.460 + BR x 0.700 SR x 0.930 + BL x 0.460 + BR x 0.700

6.2.6 7.1

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
FL M x 0.707 L FL x 0.939 FL FL FL FL
FR M x 0.707 R FR x 0.939 FR FR FR FR
C C C C C
LFE LFE LFE LFE
SL FL x 0.344 + SL x 0.344 BL x 0.883 BL x 0.883 SL SL
SR FR x 0.344 + SR x 0.344 BR x 0.883 BR x 0.883 SR SR
BL SL x 0.939 BL x 0.470 BL x 0.470 BL BL
BR SR x 0.939 BR x 0.470 BR x 0.470 BR BR

6.2.7 7.1.4

Output Mono Stereo Quad 5.0 5.1 7.1 7.1.4
FL M x 0.707 L FL x 0.939 FL FL FL FL
FR M x 0.707 R FR x 0.939 FR FR FR FR
C C C C C
LFE LFE LFE LFE
SL FL x 0.344 + SL x 0.344 BL x 0.883 BL x 0.883 SL SL
SR FR x 0.344 + SR x 0.344 BR x 0.883 BR x 0.883 SR SR
BL SL x 0.939 BL x 0.470 BL x 0.470 BL BL
BR SR x 0.939 BR x 0.470 BR x 0.470 BR BR
TFL TFL
TFR TFR
TBL TBL
TBR TBR