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

build 180515. brake cylinder and doorstep sounds, comprehensive gauge update sound trigggers, vehicle removal from marked tracks, minor bug fixes

This commit is contained in:
tmj-fstate
2018-05-15 19:49:17 +02:00
parent 847f4db5b4
commit 0787be500a
10 changed files with 266 additions and 84 deletions

View File

@@ -216,7 +216,7 @@ sound_source::deserialize_mapping( cParser &Input ) {
auto const pitch { Input.getToken<float>( false, "\n\r\t ,;" ) };
for( auto &chunk : m_soundchunks ) {
if( chunk.second.threshold == index ) {
chunk.second.pitch = pitch;
chunk.second.pitch = ( pitch > 0.f ? pitch : 1.f );
break;
}
}
@@ -386,8 +386,9 @@ sound_source::play_combined() {
if( soundpoint < soundchunk.second.fadein ) { break; }
if( soundpoint >= soundchunk.second.fadeout ) { continue; }
if( ( soundchunk.first.playing > 0 )
|| ( soundchunk.first.buffer == null_handle ) ) {
if( ( soundchunk.first.buffer == null_handle )
|| ( ( ( m_flags & ( sound_flags::exclusive | sound_flags::looping ) ) != 0 )
&& ( soundchunk.first.playing > 0 ) ) ) {
// combined sounds only play looped, single copy of each activated chunk
continue;
}
@@ -612,13 +613,15 @@ sound_source::update_combined( audio::openal_source &Source ) {
*/
if( ( soundhandle & sound_id::chunk ) != 0 ) {
// for sound chunks, test whether the chunk should still be active given current value of the controlling variable
auto const soundpoint { compute_combined_point() };
auto const &soundchunk { m_soundchunks[ soundhandle ^ sound_id::chunk ] };
if( ( soundpoint < soundchunk.second.fadein )
|| ( soundpoint >= soundchunk.second.fadeout ) ) {
Source.stop();
update_counter( soundhandle, -1 );
return;
if( ( m_flags & ( sound_flags::exclusive | sound_flags::looping ) ) != 0 ) {
auto const soundpoint { compute_combined_point() };
auto const &soundchunk { m_soundchunks[ soundhandle ^ sound_id::chunk ] };
if( ( soundpoint < soundchunk.second.fadein )
|| ( soundpoint >= soundchunk.second.fadeout ) ) {
Source.stop();
update_counter( soundhandle, -1 );
return;
}
}
}