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

reformat: remove redundant qualifiers

This commit is contained in:
jerrrrycho
2026-07-04 05:34:23 +02:00
parent 20e7a99516
commit cf9fb07800
98 changed files with 2290 additions and 2290 deletions

View File

@@ -11,27 +11,27 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
std::vector<ALuint> buffers;
std::for_each(
First, Last,
[&]( audio::buffer_handle const &bufferhandle ) {
auto const &buffer { audio::renderer.buffer( bufferhandle ) };
[&]( buffer_handle const &bufferhandle ) {
auto const &buffer { renderer.buffer( bufferhandle ) };
if (buffer.id != null_resource) buffers.emplace_back( buffer.id ); } );
is_multipart = buffers.size() > 1;
if( id != audio::null_resource && !buffers.empty()) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
::alSourceRewind( id );
if( id != null_resource && !buffers.empty()) {
alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
alSourceRewind( id );
// sound controller can potentially request playback to start from certain buffer point
// for multipart sounds the offset is applied only to last piece during playback
// for single sound we also make sure not to apply the offset to optional bookends
if( controller->start() == 0.f || is_multipart || controller->is_bookend( buffers.front() ) ) {
// regular case with no offset, reset bound source just in case
::alSourcei( id, AL_SAMPLE_OFFSET, 0 );
alSourcei( id, AL_SAMPLE_OFFSET, 0 );
}
else {
// move playback start to specified point in 0-1 range
ALint buffersize;
::alGetBufferi( buffers.front(), AL_SIZE, &buffersize );
::alSourcei(
alGetBufferi( buffers.front(), AL_SIZE, &buffersize );
alSourcei(
id,
AL_SAMPLE_OFFSET,
static_cast<ALint>( controller->start() * ( buffersize / sizeof( std::int16_t ) ) ) );