16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 13:39:18 +02:00

build 191205. sound pitch variation parameter

This commit is contained in:
tmj-fstate
2019-12-05 17:21:04 +01:00
parent 63619d13a6
commit 8020c15967
2 changed files with 13 additions and 2 deletions

View File

@@ -182,6 +182,17 @@ sound_source::deserialize_mapping( cParser &Input ) {
{ std::stoi( key.substr( indexstart, indexend - indexstart ) ), 0, 0, 1.f } } );
}
}
else if( key == "pitchvariation:" ) {
auto const variation {
clamp(
Input.getToken<float>( false, "\n\r\t ,;" ),
0.0f, 1.0f )
* 100.0f / 2.0f };
m_pitchvariation = (
variation == 0.0f ?
1.0f :
0.01f * static_cast<float>( Random( 100.0 - variation, 100.0 + variation ) ) );
}
else if( key.compare( 0, std::min<std::size_t>( key.size(), 5 ), "pitch" ) == 0 ) {
// sound chunk pitch, defined with key pitchX where X = activation threshold
auto const indexstart { key.find_first_of( "1234567890" ) };
@@ -333,7 +344,7 @@ sound_source::play( int const Flags ) {
// initialize emitter-specific pitch variation if it wasn't yet set
if( m_pitchvariation == 0.f ) {
m_pitchvariation = 1.f; // 0.01f * static_cast<float>( Random( 97.5, 102.5 ) );
m_pitchvariation = 0.01f * static_cast<float>( Random( 97.5, 102.5 ) );
}
/*
if( ( ( m_flags & sound_flags::exclusive ) != 0 )

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 19
#define VERSION_MINOR 1117
#define VERSION_MINOR 1205
#define VERSION_REVISION 0