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

build 200120. pantograph valves, emergency brake sound, sound proofing tweak, minor vehicle logic bug fixes, minor gfx renderer bug fixes

This commit is contained in:
tmj-fstate
2020-01-20 18:51:18 +01:00
parent cf02c37ea7
commit a501c09b0f
16 changed files with 533 additions and 602 deletions

View File

@@ -155,14 +155,18 @@ openal_source::sync_with( sound_properties const &State ) {
::alSourcefv( id, AL_POSITION, glm::value_ptr( glm::vec3() ) );
}
// gain
if( ( State.soundproofing_stamp != properties.soundproofing_stamp )
|| ( State.gain != properties.gain ) ) {
if( ( State.gain != properties.gain )
|| ( State.soundproofing_stamp != properties.soundproofing_stamp ) ) {
// gain value has changed
properties.gain = State.gain;
properties.soundproofing = State.soundproofing;
properties.soundproofing_stamp = State.soundproofing_stamp;
::alSourcef( id, AL_GAIN, properties.gain * properties.soundproofing );
auto const range { (
sound_range >= 0 ?
sound_range :
5 ) }; // range of -1 means sound of unlimited range, positioned at the listener
::alSourcef( id, AL_REFERENCE_DISTANCE, range * ( 1.f / 16.f ) * properties.soundproofing );
}
if( sound_range > 0 ) {
auto const rangesquared { sound_range * sound_range };