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

build 171202. audio subsystem: volume support, source reassignment, bug fixes

This commit is contained in:
tmj-fstate
2017-12-03 02:35:49 +01:00
parent 0f0cb4209b
commit 5645c13362
11 changed files with 122 additions and 58 deletions

View File

@@ -95,7 +95,7 @@ sound_source::play( int const Flags ) {
// initialize emitter-specific pitch variation if it wasn't yet set
if( m_pitchvariation == 0.f ) {
m_pitchvariation = 0.01f * static_cast<float>( Random( 95, 105 ) );
m_pitchvariation = 0.01f * static_cast<float>( Random( 97.5, 102.5 ) );
}
m_flags = Flags;
@@ -130,7 +130,8 @@ sound_source::stop() {
m_stop = true;
if( ( m_soundend.buffer != null_handle )
&& ( m_soundend.buffer != m_soundmain.buffer ) ) { // end == main can happen in malformed legacy cases
&& ( m_soundend.buffer != m_soundmain.buffer ) // end == main can happen in malformed legacy cases
&& ( m_soundend.playing == 0 ) ) {
// spawn potentially defined sound end sample, if the emitter is currently active
insert( m_soundend.buffer );
}
@@ -142,8 +143,9 @@ sound_source::update( audio::openal_source &Source ) {
if( true == Source.is_playing ) {
// kill the sound if requested
if( true == m_stop ) {
if( ( true == m_stop )
&& ( Source.buffers[ Source.buffer_index ] != m_soundend.buffer ) ) {
// kill the sound if stop was requested, unless it's sound bookend sample
Source.stop();
update_counter( Source.buffers[ Source.buffer_index ], -1 );
if( false == is_playing() ) {