mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 180805. minor bug fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,6 +16,7 @@ driverkeyboard_input::init() {
|
||||
default_bindings();
|
||||
recall_bindings();
|
||||
bind();
|
||||
m_bindingsetups.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
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
|
||||
@@ -187,7 +187,7 @@ keyboard_input::bind() {
|
||||
|
||||
for( auto const &bindingsetup : m_bindingsetups ) {
|
||||
|
||||
m_bindings[ bindingsetup.binding ] = bindingsetup.command;
|
||||
m_bindings[ bindingsetup.binding ] = bindingsetup.command;
|
||||
}
|
||||
// cache movement key bindings
|
||||
m_bindingscache.forward = binding( user_command::moveforward );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user