Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
VoiceChatLegacyContract.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4
6{
7 bool compressorSupported(std::wstring_view name) noexcept
8 {
9 return std::find(
10 CompressorNames.begin(), CompressorNames.end(), name) !=
11 CompressorNames.end();
12 }
13
14 std::expected<AudioRuntime::Settings, std::string> captureSettings(
15 const rules::VoiceChatOptions& options)
16 {
17 if (options.recordingHz != SamplesPerSecond)
18 return std::unexpected(
19 "legacy voice capture currently requires 11025 Hz");
20 if (options.recordingBits != BitsPerSample)
21 return std::unexpected(
22 "legacy voice capture currently requires 8-bit samples");
23
24 AudioRuntime::Settings settings{};
25 if (options.compressorName == L"GSM 6.10")
27 else if (options.compressorName == L"No Compression")
28 settings.codec = AudioRuntime::Codec::Pcm;
29 else
30 return std::unexpected(
31 "legacy voice compressor is not supported");
32
33 return settings;
34 }
35}
const char * name
unsigned index
bool compressorSupported(std::wstring_view name) noexcept
constexpr std::array< std::wstring_view, 2 > CompressorNames
std::expected< AudioRuntime::Settings, std::string > captureSettings(const rules::VoiceChatOptions &options)