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

build 180805. minor bug fixes

This commit is contained in:
tmj-fstate
2018-08-05 13:22:21 +02:00
parent 9830e6c15e
commit 47d8944d17
8 changed files with 23 additions and 12 deletions

View File

@@ -44,10 +44,16 @@ openal_source::play() {
::alGetError(); // pop the error stack
::alSourcePlay( id );
ALint state;
::alGetSourcei( id, AL_SOURCE_STATE, &state );
is_playing = ( state == AL_PLAYING );
/*
is_playing = (
::alGetError() == AL_NO_ERROR ?
true :
false );
*/
}
// stops the playback
@@ -78,14 +84,17 @@ openal_source::update( double const Deltatime, glm::vec3 const &Listenervelocity
if( id != audio::null_resource ) {
sound_change = false;
::alGetSourcei( id, AL_BUFFERS_PROCESSED, &sound_index );
// for multipart sounds trim away processed sources until only one remains, the last one may be set to looping by the controller
// TBD, TODO: instead of change flag move processed buffer ids to separate queue, for accurate tracking of longer buffer sequences
ALuint bufferid;
while( ( sound_index > 0 )
&& ( sounds.size() > 1 ) ) {
::alSourceUnqueueBuffers( id, 1, &bufferid );
sounds.erase( std::begin( sounds ) );
--sound_index;
sound_change = true;
}
int state;