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

audio transcript sound volume based filtering, minor ai logic fixes

This commit is contained in:
tmj-fstate
2019-03-22 21:43:36 +01:00
parent faaabf116b
commit 73af767312
4 changed files with 16 additions and 9 deletions

View File

@@ -4950,10 +4950,12 @@ TController::UpdateSituation(double dt) {
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach // za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
// powino zostać wyłączone) // powino zostać wyłączone)
// WriteLog("Zahamowanie składu"); // WriteLog("Zahamowanie składu");
mvOccupied->BrakeLevelSet( if( mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ) {
mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ? mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_EPB ) );
1 : }
3 ); else {
BrakeCtrlPosition = 3;
}
double p = mvOccupied->BrakePressureActual.PipePressureVal; double p = mvOccupied->BrakePressureActual.PipePressureVal;
if( p < 3.9 ) { if( p < 3.9 ) {
// tu może być 0 albo -1 nawet // tu może być 0 albo -1 nawet

View File

@@ -172,9 +172,7 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
First, Last, First, Last,
[&]( audio::buffer_handle const &bufferhandle ) { [&]( audio::buffer_handle const &bufferhandle ) {
auto const &buffer { audio::renderer.buffer( bufferhandle ) }; auto const &buffer { audio::renderer.buffer( bufferhandle ) };
buffers.emplace_back( buffer.id ); buffers.emplace_back( buffer.id ); } );
if( false == buffer.caption.empty() ) {
ui::Transcripts.Add( buffer.caption ); } } );
if( id != audio::null_resource ) { if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() ); ::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );

View File

@@ -211,7 +211,7 @@ scenario_panel::render() {
auto const assignmentheader { locale::strings[ locale::string::driver_scenario_assignment ] }; auto const assignmentheader { locale::strings[ locale::string::driver_scenario_assignment ] };
if( ( false == owner->assignment().empty() ) if( ( false == owner->assignment().empty() )
&& ( true == ImGui::CollapsingHeader( assignmentheader.c_str() ) ) ) { && ( true == ImGui::CollapsingHeader( assignmentheader.c_str() ) ) ) {
ImGui::TextWrapped( owner->assignment().c_str() ); ImGui::TextWrapped( "%s", owner->assignment().c_str() );
ImGui::Separator(); ImGui::Separator();
} }
} }
@@ -1034,7 +1034,7 @@ transcripts_panel::render() {
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) { if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
// header section // header section
for( auto const &line : text_lines ) { for( auto const &line : text_lines ) {
ImGui::TextWrapped( line.data.c_str() ); ImGui::TextWrapped( "%s", line.data.c_str() );
} }
} }
ImGui::End(); ImGui::End();

View File

@@ -861,6 +861,13 @@ sound_source::update_counter( sound_handle const Sound, int const Value ) {
// sound( Sound ).playing = std::max( 0, sound( Sound ).playing + Value ); // sound( Sound ).playing = std::max( 0, sound( Sound ).playing + Value );
sound( Sound ).playing += Value; sound( Sound ).playing += Value;
if( ( m_properties.gain > 0.f )
&& ( sound( Sound ).playing == 1 ) ) {
auto const &buffer { audio::renderer.buffer( sound( Sound ).buffer ) };
if( false == buffer.caption.empty() ) {
ui::Transcripts.Add( buffer.caption );
}
}
assert( sound( Sound ).playing >= 0 ); assert( sound( Sound ).playing >= 0 );
} }