Files
foo_input_joc/src/lang.h
T
TheM14 43b16687cc
build / windows (push) Canceled after 0s
build / release (push) Canceled after 0s
Add a side/rear channel swap for speaker output
Some receivers and players expect the side pair (Ls/Rs) where the renderer puts
the rear pair (Lrs/Rrs) and the other way round, and the layouts here follow the
reference table, so the delivered PCM cannot match both. The new preference does
the reorder on the way out: Ls with Lrs, Rs with Rrs, everything else untouched.

Which channels to move is decided by name in the layout table, not by channel
count. 7.1, 7.1.2, 7.1.4, 9.1.4 and 9.1.6 carry both pairs; 5.1.2 and 5.1.4 fill
the last two slots with top channels and are left alone, and a layout that has no
rear pair makes the swap a no-op. The decoder only enables it when the layout the
core rendered is the one being delivered, so a binaural stream is never touched.

The reorder happens once per read, before the float32 and the forced int24
delivery branch, so both formats carry it and the peak and clip accounting see the
same samples as before. Decoding, object positions, the layout table and the
rendering itself are unchanged.

channel_swap_test checks the layout selection, the reorder, its inverse and the
int24 packing order. The render harness gained --swap-side-rear and the text fit
check now measures the new label in both languages.

Verified on a 7.1 render: only channels 5-8 change, 5<->7 and 6<->8 byte-exactly,
with float32 and int24 alike; a 5.1.2 render is identical with the switch on.
2026-11-01 23:53:54 +08:00

75 lines
1.9 KiB
C++

// User-interface text for the component, in the languages the page offers.
//
// Only strings a user can see belong here: labels, buttons, the status lines under
// the controls, and the messages an error is reported with. Log lines and engine
// diagnostics stay English, so a support log reads the same whatever the page is
// set to.
//
// The Chinese column is the source: the English column translates it rather than
// wording the feature independently, and the two must mean the same thing.
#pragma once
#include <string>
namespace joc_lang {
enum class Language {
kSystem = 0, // follow the Windows user-interface language
kChineseSimplified = 1,
kEnglish = 2,
};
enum class Text {
// preferences page
kPageName,
kGroupOutput,
kRadioBinaural,
kRadioSpeaker,
kLabelMode,
kComboModeNear,
kComboModeMid,
kComboModeFar,
kLabelTail,
kCheckInt24,
kInt24Hint,
kSpeakerStatus,
kGroupHrtf,
kRadioSofa,
kRadioRosella,
kLabelHrtfFile,
kButtonBrowse,
kHrtfHint,
kHrtfSourceSofa,
kHrtfSourceRosella,
kHrtfDefault,
kHrtfDefaultUnknown,
kGroupGain,
kCheckGain,
kLabelGainUnit,
kGainStatusOn,
kGainStatusOff,
kGainHint,
kCheckSwapSideRear,
kGroupOther,
kLabelLanguage,
kLabelFfmpeg,
kLanguageSystem,
kLanguageChinese,
kLanguageEnglish,
// "SOFA": the separator between a label and the value after it
kSeparator,
// messages shown when decoding fails
kErrorHrtfNeeded,
kErrorRenderStream,
kErrorSeek,
};
// The language actually used: kSystem resolves to the Windows user-interface
// language (Chinese if that language is Chinese, English otherwise).
Language resolve(Language language);
// Text for an already resolved language (pass resolve()'s result).
const char* get(Language language, Text id);
} // namespace joc_lang