Skip to content

Multi Channel Audio 2 1 up to 7 1

Finalspace edited this page May 29, 2026 · 1 revision

Table of Contents

Default initialization

By default you don't have to setup anything in FPL, if your audio device supports multiple channels you can get the fplAudioChannelLayout and the number of channels from the fplAudioFormat.

 settings;
(&settings);

if ((, &settings)) {
    // ... your code here
}

Setting an Audio Channel Layout

By default, FPL uses the native audio channel layout for your default sound device, but you can overwrite it by setting the fplAudioChannelLayout in the fplAudioSettings structure:

 settings;
(&settings);
 &audioSettings = settings.;

// Forcing to use a 5.1 audio channel layout with 6 channels
audioSettings.layout = ;

// Or you can set the number of channels to 6 for 5.1 as well
audioSettings.channels = 6;

if ((, &settings)) {
    // ... your code here
}

Note: You have to call

fplGetAudioChannelMap() to get the actual audio channel mapping table, which maps each audio channel to a

fplAudioChannelType .

Channel Mapping

A channel map is a table of channel indices to a fplAudioChannelType.

If you have a fplAudioChannelLayout_Stereo or even fplAudioChannelLayout_Mono, you can simply use the default indices (0|1) or just zero for mono.

As soon as you have more than two channels, you have to get the fplAudioChannelMap from the current audio backend and map your source channel indices. You can get the current fplAudioChannelMap by calling fplGetAudioChannelMap().

This must be called, after the audio system has been initialized, either after fplPlatformInit() or after fplAudioInit().

 channelMap = ;
if ((&channelMap)) {
    // Do your own channel mapping from your source samples
}

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally