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

build 171205. support for random sound sets, explicit range-driven sound attenuation

This commit is contained in:
tmj-fstate
2017-12-05 19:51:36 +01:00
parent 4f9464499c
commit 807eecd482
7 changed files with 135 additions and 79 deletions

View File

@@ -56,7 +56,7 @@ struct openal_source {
for( auto const buffer : buffers ) {
bufferids.emplace_back( audio::renderer.buffer( buffer ).id ); }
if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, bufferids.size(), bufferids.data() );
::alSourceQueueBuffers( id, static_cast<ALsizei>( bufferids.size() ), bufferids.data() );
::alSourceRewind( id ); }
return *this; }
// starts playback of queued buffers
@@ -91,6 +91,7 @@ private:
float pitch_variation { 1.f }; // emitter-specific variation of the base pitch
float sound_range { 50.f }; // cached audible range of the emitted samples
glm::vec3 sound_distance; // cached distance between sound and the listener
bool is_in_range { false }; // helper, indicates the source was recently within audible range
bool is_multipart { false }; // multi-part sounds are kept alive at longer ranges
};