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;

View File

@@ -50,6 +50,7 @@ struct openal_source {
uint32_sequence sounds; //
// buffer_sequence buffers; // sequence of samples the source will emit
int sound_index { 0 }; // currently queued sample from the buffer sequence
bool sound_change { false }; // indicates currently queued sample has changed
bool is_playing { false };
bool is_looping { false };
sound_properties properties;

View File

@@ -16,6 +16,7 @@ driverkeyboard_input::init() {
default_bindings();
recall_bindings();
bind();
m_bindingsetups.clear();
return true;
}

View File

@@ -344,7 +344,7 @@ driver_mode::on_key( int const Key, int const Scancode, int const Action, int co
}
}
if( Action == GLFW_PRESS ) {
if( Action != GLFW_RELEASE ) {
OnKeyDown( Key );

View File

@@ -17,6 +17,8 @@ editorkeyboard_input::init() {
// TODO: re-enable after mode-specific binding import is in place
// return recall_bindings();
bind();
m_bindingsetups.clear();
return true;
}

View File

@@ -87,7 +87,7 @@ keyboard_input::recall_bindings() {
if( bindingkeyname == "shift" ) { binding |= keymodifier::shift; }
else if( bindingkeyname == "ctrl" ) { binding |= keymodifier::control; }
else if( bindingkeyname == "none" ) { binding = -1; }
else if( bindingkeyname == "none" ) { binding = 0; }
else {
// regular key, convert it to glfw key code
auto const keylookup = nametokeymap.find( bindingkeyname );
@@ -143,10 +143,10 @@ keyboard_input::key( int const Key, int const Action ) {
true );
}
if( Key == -1 ) { return false; }
// store key state
if( Key != -1 ) {
input::keys[ Key ] = Action;
}
if( true == is_movement_key( Key ) ) {
// if the received key was one of movement keys, it's been handled and we don't need to bother further

View File

@@ -533,9 +533,8 @@ sound_source::update_basic( audio::openal_source &Source ) {
if( sound( sound_id::begin ).buffer != null_handle ) {
// potentially a multipart sound
// detect the moment when the sound moves from startup sample to the main
if( ( false == Source.is_looping )
&& ( soundhandle == sound_id::main ) ) {
// when it happens update active sample counters, and activate the looping
if( true == Source.sound_change ) {
// when it happens update active sample counters, and potentially activate the looping
update_counter( sound_id::begin, -1 );
update_counter( soundhandle, 1 );
Source.loop( TestFlag( m_flags, sound_flags::looping ) );
@@ -618,8 +617,7 @@ sound_source::update_combined( audio::openal_source &Source ) {
if( sound( sound_id::begin ).buffer != null_handle ) {
// potentially a multipart sound
// detect the moment when the sound moves from startup sample to the main
if( ( false == Source.is_looping )
&& ( soundhandle == ( sound_id::chunk | 0 ) ) ) {
if( true == Source.sound_change ) {
// when it happens update active sample counters, and activate the looping
update_counter( sound_id::begin, -1 );
update_counter( soundhandle, 1 );

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 18
#define VERSION_MINOR 804
#define VERSION_MINOR 805
#define VERSION_REVISION 0