mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 200711. vehicle-specific rain sound support
This commit is contained in:
21
Train.cpp
21
Train.cpp
@@ -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 ) {
|
||||
|
||||
1
Train.h
1
Train.h
@@ -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 };
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user