Final Platform Layer»Blog

Current state

Hi,

i just want to give you a short overview what the current state of FPL are and what will coming in the next release.

Starting from my recent changes, i finally added support for fixing the audio playback for audio devices such as bcm2835 for ALSA. Now we can play audio almost stutterfree on the raspberry pi ;) I say almost, because my example audio mixer i wrote to test the audio playback is too slow (> 3 ms) to fill the audio buffer in time - resulting in hearable stuttering sometimes :-(

Therefore i also working to improve my demo audio mixer by optimizing the memory layout and translating to SIMD, to process more stuff more efficiently. Thats also the reason why i added several CPU detection features in FPL in the latest release.

In addition i am working out a new and much easier window/display/fullscreen api for FPL, which will work on X11 as well.

And lastly i am trying to fix the missing key-repeating in X11, but detecting key-repeating in X11 is weird - so this may take some time.

The current code is definitly totally busted...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
case KeyRelease:
{
	// Keyboard button up
	if (!appState->currentSettings.input.disabledEvents) {
		bool physical = true;
		if (x11Api->XPending(x11WinState->display)) {
			XEvent nextEvent;
			x11Api->XPeekEvent(x11WinState->display, &nextEvent);
			if (nextEvent.type == KeyPress && nextEvent.xkey.time == ev->xkey.time && nextEvent.xkey.keycode == ev->xkey.keycode) {
				// Delete future key press event, as it is a key-repeat
				x11Api->XNextEvent(x11WinState->display, ev);
				physical = false;
			}
		}
		int keyState = ev->xkey.state;
		int keyCode = ev->xkey.keycode;
		if (physical) {
			fpl__HandleKeyboardButtonEvent(winState, (uint64_t)keyCode, fpl__X11TranslateModifierFlags(keyState), fplButtonState_Release, true);
		} else {
			fpl__HandleKeyboardButtonEvent(winState, (uint64_t)keyCode, fpl__X11TranslateModifierFlags(keyState), fplButtonState_Repeat, false);
		}
	}
} break;


Also i tried the Win32 Resize Fiber thingy and was very impressed how easy it was, to get it working.
So FPL may get a feature of realtime window resizing as well. But not sure, how this will work for X11 events...

Thats the most of it what i want to add or change for the next release. Maybe one one two smaller things will get added too, but we will see.

Oh and finally made a better todo list: https://trello.com/b/gMQIuhF7/libfpl-todo-list

Stay tuned for the next release.
X11 will usually flicker if doing CPU drawing while resizing the window. Not sure how this works with the GPU though.

False key repeats are easily solved by comparing the time-stamps of events with a peek at the next action. If a key goes up and then down with an identical time stamp, you can distinguish it from actually lifting the key between frames.
"currentEvent.xkey.time == nextEvent.xkey.time"
https://github.com/Dawoodoz/DFPSR...urce/windowManagers/X11Window.cpp