void speech_processor::process(sample_ptr samples,std::size_t count) { sample_ptr start=samples; sample_ptr end=start+count; while(fill_input_buffer(start,end)) { on_input(); input.clear(); if(is_stopped()) return; on_output(); if(is_stopped()) return; if(!next) continue; if(!insertion.empty()) { next->insert(&insertion[0],insertion.size()); insertion.clear(); if(is_stopped()) { output.clear(); return; } } if(output.empty()) continue; next->process(&output[0],output.size()); output.clear(); if(is_stopped()) return; } }
/** * \brief Notifies Lua that an input event has just occurred. * * The appropriate callback in sol.main is triggered if it exists. * * \param event The input event to handle. * \return \c true if the event was handled and should stop being propagated. */ bool LuaContext::main_on_input(const InputEvent& event) { bool handled = false; push_main(l); handled = on_input(event); if (!handled) { handled = menus_on_input(-1, event); } lua_pop(l, 1); return handled; }
/** * @brief Notifies a Lua game that an input event has just occurred. * * The appropriate callback in the game is triggered if it exists. * * @param game A game. * @param event The input event to handle. * @return \c true if the event was handled and should stop being propagated. */ bool LuaContext::game_on_input(Game& game, InputEvent& event) { bool handled = false; push_game(l, game.get_savegame()); handled = on_input(event); if (!handled) { handled = menus_on_input(-1, event); } lua_pop(l, 1); return handled; }
/** * @brief Calls an input callback method of a Lua menu. * @param menu_ref A reference to the menu object. * @param event The input event to forward. * @return \c true if the event was handled and should stop being propagated. */ bool LuaContext::menu_on_input(int menu_ref, InputEvent& event) { // Get the Lua menu. push_ref(l, menu_ref); // Trigger its appropriate callback if it exists. bool handled = on_input(event); // Remove the menu from the stack. lua_pop(l, 1); return handled; }
void GUIWindowManagerProvider_Direct::on_input_mouse_up(const InputEvent &input_event) { // It seems multiple windows in the same app act differently for window SetCapture() if (!capture_mouse_window) { // Process MouseUp as normal input event when capture mouse is not used on_input(input_event); return; } InputEvent new_input_event = input_event; if (!func_input_intercept.is_null()) func_input_intercept.invoke(new_input_event); invoke_input_received(capture_mouse_window, new_input_event); }
/** * \brief Notifies a Lua game that an input event has just occurred. * * The appropriate callback in the game is triggered if it exists. * Also notifies the menus of the game if the game itself does not handle the * event. * * \param game A game. * \param event The input event to handle. * \return \c true if the event was handled and should stop being propagated. */ bool LuaContext::game_on_input(Game& game, const InputEvent& event) { if (!game.get_savegame().is_known_to_lua()) { return false; } bool handled = false; push_game(l, game.get_savegame()); if (game.get_savegame().is_with_lua_table()) { handled = on_input(event); } if (!handled) { handled = menus_on_input(-1, event); } lua_pop(l, 1); return handled; }
void speech_processor::finish() { if(!input.empty()) { on_input(); input.clear(); if(is_stopped()) return; } on_end_of_input(); if(is_stopped()) return; on_output(); if(is_stopped()) return; if(!next) { on_finished(); return; } if(!insertion.empty()) { next->insert(&insertion[0],insertion.size()); insertion.clear(); if(is_stopped()) { output.clear(); return; } } if(!output.empty()) { next->process(&output[0],output.size()); output.clear(); } if(is_stopped()) return; next->finish(); if(is_stopped()) return; on_finished(); }
/** * \brief Calls an input callback method of a Lua menu. * \param menu_ref A reference to the menu object. * \param event The input event to forward. * \return \c true if the event was handled and should stop being propagated. */ bool LuaContext::menu_on_input( const ScopedLuaRef& menu_ref, const InputEvent& event ) { // Get the Lua menu. push_ref(l, menu_ref); // Send the event to children menus first. bool handled = menus_on_input(-1, event); if (!handled) { // Sent the event to this menu. handled = on_input(event); } // Remove the menu from the stack. lua_pop(l, 1); return handled; }