mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
departure warning sound positioning, support for combined brake squeal sound
This commit is contained in:
50
DynObj.cpp
50
DynObj.cpp
@@ -4109,6 +4109,10 @@ void TDynamicObject::RenderSounds() {
|
||||
volume = rsPisk.m_amplitudeoffset + interpolate( -1.0, 1.0, brakeforceratio ) * rsPisk.m_amplitudefactor;
|
||||
if( volume > 0.075 ) {
|
||||
rsPisk
|
||||
.pitch(
|
||||
true == rsPisk.is_combined() ?
|
||||
MoverParameters->Vel * 0.01f :
|
||||
rsPisk.m_frequencyoffset + rsPisk.m_frequencyfactor * 1.f )
|
||||
.gain( volume )
|
||||
.play( sound_flags::exclusive | sound_flags::looping );
|
||||
}
|
||||
@@ -4138,19 +4142,22 @@ void TDynamicObject::RenderSounds() {
|
||||
}
|
||||
// NBMX sygnal odjazdu
|
||||
if( MoverParameters->DoorClosureWarning ) {
|
||||
if( ( MoverParameters->DepartureSignal )
|
||||
for( auto &door : m_doorsounds ) {
|
||||
// TBD, TODO: per-location door state triggers?
|
||||
if( ( MoverParameters->DepartureSignal )
|
||||
/*
|
||||
|| ( ( MoverParameters->DoorCloseCtrl = control::autonomous )
|
||||
&& ( ( ( false == MoverParameters->DoorLeftOpened ) && ( dDoorMoveL > 0.0 ) )
|
||||
|| ( ( false == MoverParameters->DoorRightOpened ) && ( dDoorMoveR > 0.0 ) ) ) )
|
||||
|| ( ( MoverParameters->DoorCloseCtrl = control::autonomous )
|
||||
&& ( ( ( false == MoverParameters->DoorLeftOpened ) && ( dDoorMoveL > 0.0 ) )
|
||||
|| ( ( false == MoverParameters->DoorRightOpened ) && ( dDoorMoveR > 0.0 ) ) ) )
|
||||
*/
|
||||
) {
|
||||
// for the autonomous doors play the warning automatically whenever a door is closing
|
||||
// MC: pod warunkiem ze jest zdefiniowane w chk
|
||||
sDepartureSignal.play( sound_flags::exclusive | sound_flags::looping );
|
||||
}
|
||||
else {
|
||||
sDepartureSignal.stop();
|
||||
) {
|
||||
// for the autonomous doors play the warning automatically whenever a door is closing
|
||||
// MC: pod warunkiem ze jest zdefiniowane w chk
|
||||
door.sDepartureSignal.play( sound_flags::exclusive | sound_flags::looping );
|
||||
}
|
||||
else {
|
||||
door.sDepartureSignal.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
// NBMX Obsluga drzwi, MC: zuniwersalnione
|
||||
@@ -5414,12 +5421,6 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
sHorn3.owner( this );
|
||||
}
|
||||
|
||||
else if( token == "departuresignal:" ) {
|
||||
// pliki z sygnalem odjazdu
|
||||
sDepartureSignal.deserialize( parser, sound_type::multipart, sound_parameters::range );
|
||||
sDepartureSignal.owner( this );
|
||||
}
|
||||
|
||||
else if( token == "pantographup:" ) {
|
||||
// pliki dzwiekow pantografow
|
||||
sound_source pantographup { sound_placement::external };
|
||||
@@ -5471,6 +5472,19 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
sSmallCompressor.owner( this );
|
||||
}
|
||||
|
||||
else if( token == "departuresignal:" ) {
|
||||
// pliki z sygnalem odjazdu
|
||||
sound_source soundtemplate { sound_placement::general, 25.f };
|
||||
soundtemplate.deserialize( parser, sound_type::multipart, sound_parameters::range );
|
||||
soundtemplate.owner( this );
|
||||
for( auto &door : m_doorsounds ) {
|
||||
// apply configuration to all defined doors, but preserve their individual offsets
|
||||
auto const dooroffset { door.lock.offset() };
|
||||
door.sDepartureSignal = soundtemplate;
|
||||
door.sDepartureSignal.offset( dooroffset );
|
||||
}
|
||||
}
|
||||
|
||||
else if( token == "dooropen:" ) {
|
||||
sound_source soundtemplate { sound_placement::general, 25.f };
|
||||
soundtemplate.deserialize( parser, sound_type::single );
|
||||
@@ -5620,6 +5634,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
|| ( sides == "left" ) ) {
|
||||
// left...
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * 0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
door.sDepartureSignal.offset( location );
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
door.lock.offset( location );
|
||||
@@ -5632,6 +5647,7 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
||||
|| ( sides == "right" ) ) {
|
||||
// ...and right
|
||||
auto const location { glm::vec3 { MoverParameters->Dim.W * -0.5f, MoverParameters->Dim.H * 0.5f, offset } };
|
||||
door.sDepartureSignal.offset( location );
|
||||
door.rsDoorClose.offset( location );
|
||||
door.rsDoorOpen.offset( location );
|
||||
door.lock.offset( location );
|
||||
|
||||
Reference in New Issue
Block a user