build 200711. vehicle-specific rain sound support

This commit is contained in:
tmj-fstate
2020-07-12 04:47:41 +02:00
parent 93c92e5ae9
commit 3ea0d5b074
4 changed files with 23 additions and 4 deletions

View File

@@ -7200,8 +7200,6 @@ bool TTrain::Update( double const Deltatime )
void
TTrain::update_sounds( double const Deltatime ) {
if( Deltatime == 0.0 ) { return; }
double volume { 0.0 };
double const brakevolumescale { 0.5 };
@@ -7383,6 +7381,15 @@ TTrain::update_sounds( double const Deltatime ) {
// don't play the optional ending sound if the listener switches views
rsHuntingNoise.stop( true == FreeFlyModeFlag );
}
// rain sound
if( ( false == FreeFlyModeFlag )
&& ( false == Global.CabWindowOpen )
&& ( Global.Weather == "rain:" ) ) {
m_precipitationsound.play( sound_flags::exclusive | sound_flags::looping );
}
else {
m_precipitationsound.stop();
}
if( fTachoCount >= 3.f ) {
auto const frequency { (
@@ -7720,6 +7727,11 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
// rsHuntingNoise.m_amplitudefactor /= ( 1 + mvOccupied->Vmax );
rsHuntingNoise.m_frequencyfactor /= ( 1 + mvOccupied->Vmax );
}
else if( token == "rainsound:" ) {
// precipitation sound:
m_precipitationsound.deserialize( parser, sound_type::single );
m_precipitationsound.owner( DynamicObject );
}
} while (token != "");
}
@@ -8030,6 +8042,11 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
if (DynamicObject->mdKabina)
{
*/
// assign default samples to sound emitters which weren't included in the config file
if( m_precipitationsound.empty() ) {
m_precipitationsound.deserialize( "rainsound_default", sound_type::single );
m_precipitationsound.owner( DynamicObject );
}
// configure placement of sound emitters which aren't bound with any device model, and weren't placed manually
// try first to bind sounds to location of possible devices
if( dsbReverserKey.offset() == nullvector ) {

View File

@@ -726,6 +726,7 @@ public: // reszta może by?publiczna
sound_source rsFadeSound { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
sound_source rsRunningNoise{ sound_placement::internal, EU07_SOUND_GLOBALRANGE };
sound_source rsHuntingNoise{ sound_placement::internal, EU07_SOUND_GLOBALRANGE };
sound_source m_precipitationsound { sound_placement::internal, -1 };
sound_source dsbHasler { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
sound_source dsbBuzzer { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };

View File

@@ -179,7 +179,8 @@ world_environment::update() {
"day:" :
"night:" );
if( Global.Weather == "rain:" ) {
if( ( true == ( FreeFlyModeFlag || Global.CabWindowOpen ) )
&& ( Global.Weather == "rain:" ) ) {
m_precipitationsound.play( sound_flags::exclusive | sound_flags::looping );
}
else {

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 20
#define VERSION_MINOR 709
#define VERSION_MINOR 711
#define VERSION_REVISION 0