mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 02:29:17 +02:00
reformat: use auto on certain types
This commit is contained in:
@@ -25,7 +25,7 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
||||
SF_INFO si;
|
||||
si.format = 0;
|
||||
|
||||
std::string file = Filename;
|
||||
const std::string file = Filename;
|
||||
|
||||
WriteLog("sound: loading file: " + file);
|
||||
|
||||
@@ -36,7 +36,7 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
||||
|
||||
sf_command(sf, SFC_SET_NORM_FLOAT, nullptr, SF_TRUE);
|
||||
|
||||
auto fbuf = new float[si.frames * si.channels];
|
||||
const auto fbuf = new float[si.frames * si.channels];
|
||||
if (sf_readf_float(sf, fbuf, si.frames) != si.frames)
|
||||
throw std::runtime_error("sound: incomplete file");
|
||||
|
||||
@@ -47,7 +47,7 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
||||
if (si.channels != 1)
|
||||
WriteLog("sound: warning: mixing multichannel file to mono");
|
||||
|
||||
auto buf = new int16_t[si.frames];
|
||||
const auto buf = new int16_t[si.frames];
|
||||
for (size_t i = 0; i < si.frames; i++)
|
||||
{
|
||||
float accum = 0;
|
||||
|
||||
@@ -529,7 +529,7 @@ openal_renderer::init_caps() {
|
||||
::alcGetIntegerv( m_device, ALC_MINOR_VERSION, 1, &versionminor );
|
||||
auto const oalversion { std::to_string( versionmajor ) + "." + std::to_string( versionminor ) };
|
||||
|
||||
std::string al_renderer((char *)::alcGetString( m_device, ALC_DEVICE_SPECIFIER ));
|
||||
const std::string al_renderer((char *)::alcGetString( m_device, ALC_DEVICE_SPECIFIER ));
|
||||
crashreport_add_info("openal_renderer", al_renderer);
|
||||
crashreport_add_info("openal_version", oalversion);
|
||||
|
||||
@@ -539,7 +539,7 @@ openal_renderer::init_caps() {
|
||||
|
||||
WriteLog( "Supported extensions: " + std::string{ (char *)::alcGetString( m_device, ALC_EXTENSIONS ) } );
|
||||
|
||||
ALCint attr[3] = { ALC_MONO_SOURCES, Global.audio_max_sources, 0 }; // request more sounds
|
||||
const ALCint attr[3] = { ALC_MONO_SOURCES, Global.audio_max_sources, 0 }; // request more sounds
|
||||
|
||||
m_context = ::alcCreateContext( m_device, attr );
|
||||
if( m_context == nullptr ) {
|
||||
|
||||
@@ -85,7 +85,7 @@ sound_source::deserialize( cParser &Input, sound_type const Legacytype, int cons
|
||||
m_soundchunks.back().second.fadeout = std::max( Chunkrange, m_soundchunks.back().second.threshold );
|
||||
// m_soundchunks.back().second.fadeout = m_soundchunks.back().second.threshold;
|
||||
// test if the chunk table contains any actual samples while at it
|
||||
for( auto &soundchunk : m_soundchunks ) {
|
||||
for (const auto &soundchunk : m_soundchunks ) {
|
||||
if( soundchunk.first.buffer != null_handle ) {
|
||||
m_soundchunksempty = false;
|
||||
break;
|
||||
@@ -247,7 +247,7 @@ sound_source::deserialize_mapping( cParser &Input ) {
|
||||
{ "external", sound_placement::external },
|
||||
{ "custom", sound_placement::custom },
|
||||
{ "general", sound_placement::general } };
|
||||
auto lookup{ placements.find( value ) };
|
||||
const auto lookup{ placements.find( value ) };
|
||||
if( lookup != placements.end() ) {
|
||||
m_placement = lookup->second;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ sound_source::deserialize_mapping( cParser &Input ) {
|
||||
{ "amplitudeoffset:", m_amplitudeoffset },
|
||||
{ "range:", m_range } };
|
||||
|
||||
auto lookup { properties.find( key ) };
|
||||
const auto lookup { properties.find( key ) };
|
||||
if( lookup != properties.end() ) {
|
||||
Input.getTokens( 1, false, "\n\r\t ,;" );
|
||||
Input >> lookup->second;
|
||||
@@ -802,7 +802,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
|
||||
// chunks other than the first can have fadein
|
||||
auto const fadeinwidth { chunkdata.threshold - chunkdata.fadein };
|
||||
if( soundpoint < chunkdata.threshold ) {
|
||||
float lineargain =
|
||||
const float lineargain =
|
||||
std::lerp(
|
||||
0.f, 1.f,
|
||||
std::clamp(
|
||||
@@ -822,7 +822,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
|
||||
auto const fadeoutwidth { chunkdata.fadeout - m_soundchunks[ chunkindex + 1 ].second.fadein };
|
||||
auto const fadeoutstart { chunkdata.fadeout - fadeoutwidth };
|
||||
if( soundpoint > fadeoutstart ) {
|
||||
float lineargain =
|
||||
const float lineargain =
|
||||
std::lerp(
|
||||
0.f, 1.f,
|
||||
std::clamp(
|
||||
@@ -973,7 +973,7 @@ sound_source::update_soundproofing() {
|
||||
4 ) : // free roam view
|
||||
listenervehicle->MoverParameters->CabOccupied ) }; // some internal view so we can be sure listener isn't a nullptr
|
||||
// location-based gain factor:
|
||||
std::uintptr_t soundproofingstamp =
|
||||
const std::uintptr_t soundproofingstamp =
|
||||
reinterpret_cast<std::uintptr_t>( listenervehicle )
|
||||
+ ( listenervehicle ?
|
||||
occupiedcab :
|
||||
|
||||
Reference in New Issue
Block a user