David,
One good way of handling this type of situation is to use parallel loops. One loop does the data acquisition. Another loop does the filtering and any other data processing. The third loop handles user interface, like updating display and waiting for button presses, and the saving to file. The data and commands are passed among the loops via queues of LV2 style globals. Look at examples of state machine architecture.
Lynn