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.
1
#include "
VoiceChatLegacyContract.hpp
"
2
3
#include <algorithm>
4
5
namespace
monopoly::voicechat::legacy
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"
)
26
settings.
codec
=
AudioRuntime::Codec::Gsm610
;
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
}
name
const char * name
Definition
ArchiveAssembly.cpp:26
index
unsigned index
Definition
ModernIBarSkin.cpp:25
VoiceChatLegacyContract.hpp
monopoly::voicechat::AudioRuntime::Codec::Gsm610
@ Gsm610
monopoly::voicechat::AudioRuntime::Codec::Pcm
@ Pcm
monopoly::voicechat::legacy
Definition
VoiceChatLegacyContract.cpp:6
monopoly::voicechat::legacy::compressorSupported
bool compressorSupported(std::wstring_view name) noexcept
Definition
VoiceChatLegacyContract.cpp:7
monopoly::voicechat::legacy::CompressorNames
constexpr std::array< std::wstring_view, 2 > CompressorNames
Definition
VoiceChatLegacyContract.hpp:18
monopoly::voicechat::legacy::captureSettings
std::expected< AudioRuntime::Settings, std::string > captureSettings(const rules::VoiceChatOptions &options)
Definition
VoiceChatLegacyContract.cpp:14
monopoly::voicechat::legacy::SamplesPerSecond
constexpr int SamplesPerSecond
Definition
VoiceChatLegacyContract.hpp:13
monopoly::voicechat::legacy::BitsPerSample
constexpr int BitsPerSample
Definition
VoiceChatLegacyContract.hpp:14
monopoly::rules::VoiceChatOptions
Definition
RuleTypes.hpp:129
monopoly::rules::VoiceChatOptions::recordingBits
int recordingBits
Definition
RuleTypes.hpp:131
monopoly::rules::VoiceChatOptions::compressorName
std::wstring compressorName
Definition
RuleTypes.hpp:132
monopoly::rules::VoiceChatOptions::recordingHz
int recordingHz
Definition
RuleTypes.hpp:130
monopoly::voicechat::AudioRuntime::Settings
Definition
VoiceChatAudioRuntime.hpp:29
monopoly::voicechat::AudioRuntime::Settings::codec
Codec codec
Definition
VoiceChatAudioRuntime.hpp:30
VoiceChatLegacyContract.cpp
Generated by
1.9.8