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

partial unification of sound definition and handling for different vehicle types

This commit is contained in:
tmj-fstate
2017-12-23 16:58:12 +01:00
parent bc13e5b0b5
commit 61a2511e1f
6 changed files with 462 additions and 420 deletions

View File

@@ -59,11 +59,12 @@ sound_source::deserialize( cParser &Input, sound_type const Legacytype, int cons
m_soundchunks[ idx ].second.fadeout = m_soundchunks[ idx + 1 ].second.threshold;
}
// ...and on the other end from the threshold point back into the range of previous chunk
m_soundchunks.front().second.fadein = std::max( 0, m_soundchunks.front().second.threshold );
for( std::size_t idx = 1; idx < m_soundchunks.size(); ++idx ) {
auto const previouschunkwidth { m_soundchunks[ idx ].second.threshold - m_soundchunks[ idx - 1 ].second.threshold };
m_soundchunks[ idx ].second.fadein = m_soundchunks[ idx ].second.threshold - 0.01f * m_crossfaderange * previouschunkwidth;
}
m_soundchunks.back().second.fadeout = std::max( m_soundchunks.back().second.threshold, 100 );
m_soundchunks.back().second.fadeout = std::max( 100, m_soundchunks.back().second.threshold );
// test if the chunk table contains any actual samples while at it
for( auto &soundchunk : m_soundchunks ) {
if( soundchunk.first.buffer != null_handle ) {