underrun | Twin stick shooter game in 13kb of JavaScript/WebGL | Game Engine library
kandi X-RAY | underrun Summary
kandi X-RAY | underrun Summary
My entry for the 2018 js13k competition. Please be aware that this projects makes use of the Sonant-X library (albeit heavily modified) which is published under the zlib license.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Load a level
- update game loop
- Initialize WebGL object
- generate audio context
- Run callback function .
- Display a notice message .
- Gets the delay in ms .
- Push quads to the quad .
- Pushes lightness to the given point
- Write a line to the terminal
underrun Key Features
underrun Examples and Code Snippets
Community Discussions
Trending Discussions on underrun
QUESTION
Imagine that we have a string like
...ANSWER
Answered 2021-Dec-17 at 06:14You may try using re.findall
here as follows:
QUESTION
The question says it all. I am going in circles here. I set snd_pcm_sw_params_set_stop_threshold to boundary (and zero too just for fun) and I am still getting buffer underrun errors on snd_pcm_writei. I cannot understand why. The documentation is pretty clear on this:
...ANSWER
Answered 2021-Sep-04 at 17:41Okay I figured it out. To anyone who runs into this issue who also has pipewire or pulse (or any other thirdparty non-alsa audio card) enabled as the "default" card the solution is to not use pipewire or pulse directly. It seems that snd_pcm_sw_params_set_stop_threshold is not implemented properly in pipewire/pulseaudio. You'll notice that if you disable pipewire or pulse this code will run exactly the way you want it to run.
Here is how you can disable pulseaudio (which was the issue on my system):
QUESTION
I am using oboe library to make a music app. There I produce music by writing PCM float values to the given pointer. I rarely have underruns which I can hearwhich. I also verify this with the following oboe APIs:
...ANSWER
Answered 2021-Apr-14 at 23:08I dived deep and found out that
managedStream->getXRunCount();
Returns the number of XRuns for the streams whole lifetime. I thought it would return the value relative to previous call. So apparently I was getting 12 but there were no underrun because this was from the session which had previous underrun.
However, I would love to see an explanation of what does it mean to have a non-full buffer in the trace.QUESTION
First, some relevant background info: I've got a CoreAudio-based low-latency audio processing application that does various mixing and special effects on audio that is coming from an input device on a purpose-dedicated Mac (running the latest version of MacOS) and delivers the results back to one of the Mac's local audio devices.
In order to obtain the best/most reliable low-latency performance, this app is designed to hook in to CoreAudio's low-level audio-rendering callback (via AudioDeviceCreateIOProcID(), AudioDeviceStart(), etc) and every time the callback-function is called (from the CoreAudio's realtime context), it reads the incoming audio frames (e.g. 128 frames, 64 samples per frame), does the necessary math, and writes out the outgoing samples.
This all works quite well, but from everything I've read, Apple's CoreAudio implementation has an unwritten de-facto requirement that all real-time audio operations happen in a single thread. There are good reasons for this which I acknowledge (mainly that outside of SIMD/SSE/AVX instructions, which I already use, almost all of the mechanisms you might employ to co-ordinate parallelized behavior are not real-time-safe and therefore trying to use them would result in intermittently glitchy audio).
However, my co-workers and I are greedy, and nevertheless we'd like to do many more math-operations per sample-buffer than even the fastest single core could reliably execute in the brief time-window that is necessary to avoid audio-underruns and glitching.
My co-worker (who is fairly experienced at real-time audio processing on embedded/purpose-built Linux hardware) tells me that under Linux it is possible for a program to requisition exclusive access for one or more CPU cores, such that the OS will never try to use them for anything else. Once he has done this, he can run "bare metal" style code on that CPU that simply busy-waits/polls on an atomic variable until the "real" audio thread updates it to let the dedicated core know it's time to do its thing; at that point the dedicated core will run its math routines on the input samples and generate its output in a (hopefully) finite amount of time, at which point the "real" audio thread can gather the results (more busy-waiting/polling here) and incorporate them back into the outgoing audio buffer.
My question is, is this approach worth attempting under MacOS/X? (i.e. can a MacOS/X program, even one with root access, convince MacOS to give it exclusive access to some cores, and if so, will big ugly busy-waiting/polling loops on those cores (including the polling-loops necessary to synchronize the CoreAudio callback-thread relative to their input/output requirements) yield results that are reliably real-time enough that you might someday want to use them in front of a paying audience?)
It seems like something that might be possible in principle, but before I spend too much time banging my head against whatever walls might exist there, I'd like some input about whether this is an avenue worth pursuing on this platform.
...ANSWER
Answered 2021-May-20 at 13:46can a MacOS/X program, even one with root access, convince MacOS to give it exclusive access to some cores
I don't know about that, but you can use as many cores / real-time threads as you want for your calculations, using whatever synchronisation methods you need to make it work, then pass the audio to your IOProc
using a lock free ring buffer, like TPCircularBuffer.
But your question reminded me of a new macOS 11/iOS 14 API I've been meaning to try, the Audio Workgroups API (2020 WWDC Video).
My understanding is that this API lets you "bless" your non-IOProc real-time threads with audio real-time thread properties or at least cooperate better with the audio thread.
The documents distinguish between the threads working in parallel (this sounds like your case) and working asynchronously (this sounds like my proposal), I don't know which case is better for you.
I still don't know what happens in practice when you use Audio Workgroups
, whether they opt you in to good stuff or opt you out of bad stuff, but if they're not the hammer you're seeking, they may have some useful hammer-like properties.
QUESTION
I have been following a Pygame tutorial on made on 2019 so it might be outdated. It should detect the arrow keys and print it but it keeps spamming the print right or left arrow and the keystroke released when i press any arrow key. is the code outdated or is there a mistake on my code? And also before it start the spamming it says "ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred" on the pycharm as an error. It works great for all the other parts.
video link if you need (https://youtu.be/FfWpgLFMI7w?t=2458)
im using pygame 2.0.0 on pycharm 3.8.5 if its the same on pycharm and python. Linux ubuntu 20.04.1
...ANSWER
Answered 2020-Dec-18 at 17:13I don't really understand why it's not working, I tried rewriting the code and I have no errors, try with what I wrote:
QUESTION
I am studying stack guarding in Linux. I found that the Linux kernel VMAP_STACK config parameter is using the guard page mechanism along with vmalloc() to provide stack guarding.
I am trying to find a way to check how this guard page is working in Linux kernel. I googled and checked the kernel code, but did NOT find out the codes.
A further question is how to verify the guarded stack.
I had a kernel module to underrun/overflow a process's kernel stack, like this
ANSWER
Answered 2020-Dec-07 at 09:57The VMAP_STACK Linux feature is used to map the kernel stack of the threads into VMA. By virtually mapping stack, the underlying physical pages don't need to be contiguous. It is possible to detect cross-page overflows by adding guard pages. As the VMA are followed by a guard (unless the VM_NO_GUARD flag is passed at allocation time), the stacks allocated in those area benefits from it for stack overflow detection.
ALLOCATION
The thread stacks are allocated at thread creation time with alloc_thread_stack_node() in kernel/fork.c. When VMAP_STACK is activated, the stacks are cached because according to the comments in the source code:
vmalloc() is a bit slow, and calling vfree() enough times will force a TLB flush. Try to minimize the number of calls by caching stacks.
The kernel stack size is THREAD_SIZE (equal to 4 pages on x86_64 platforms). The source code of the allocation invoked at thread creation time is:
QUESTION
I am trying to combine some logs together and select only the lines that have a high underrun (u:). Anything over 0 is high. The code works wonders inside the terminal. However, when I push the information to a file, I get ESC characters instead of the information.
...ANSWER
Answered 2020-Sep-24 at 14:05After some digging the solution to this is the -Raw flag on select-string.
QUESTION
I am trying to get information from this line of text:
...ANSWER
Answered 2020-Jun-24 at 20:42If the data format is predictable and always in the order as shown above, you can use the -match
operator against single strings. Then return matched values from the $matches
automatic variable:
QUESTION
I'm trying to send a .wav file via UDP sockets from the server to the client and playing it back from the client side.
The file is 48kHz and 16 bits and has duration of 25 sec.
Since the server.c is a small code section inside a larger C-RAN code module I'm checking it by passing a wav file from the stdin:
...ANSWER
Answered 2020-May-31 at 14:09The problem in your implementation is that the transfer of the music data is one way from the server to the client. When the client sends the first request, the server starts broadcasting the audio stream as fast as it can. As a result the client will loose some packets. If only one in two packets gets actually written to the audio device, it looks like that the music is played twice as fast. You can easily see that you are loosing packets if you sum all the bytes_read
in the client. It will be much smaller than the actual file size.
Also it's not clear why in the client you first recvfrom
socket into payload
and then read
into buffer2
. In theory only the first operation is required and then you write from payload
to the audio device.
If you want to implement the streaming in the proper way you need to implement a proper buffering solution in the client and also some speed throttling on the server, to avoid sending data at a speed much higher than needed.
If you want to fix your code in an easy way, one possibility would be to add an ACK that the client sends to the server after receiving one packet. The server will wait for the client ACK before sending the next packet. This will more or less make the UDP protocol a TCP protocol.
I have modified your code a little bit to show you what I mwan. With this code you are able to playback correctly the wav file. It's not perfect, but at least it should give you an idea of what is the problem with your code
server.c
QUESTION
for research purposes I am developing a native Android app (with Java), which allows geriatric patients after an ambulatory rehab to record a nutrition diary.
Due to the high age of the target group it has to be taken into account that the users have a tremor in their hands.
My approach to avoid "unintended" inputs: Is there some kind of global setting that defines a "minimum time" between two touch inputs? If this time is underrun, the app only executes the first input and ignores further inputs within this timeframe.
Of course I am open for other approaches and ideas. Maybe Android itself provides input assistance for people with tremor? So far I could not find anything that helps me with this topic.
Thank you for your ideas and suggestions.
Edit: To give you an idea of the situation: The user clicks a button. This causes the UI to change and a new button to appear in the exact same place where the user clicked. This button should not be directly "clickable". But of course, buttons at other locations should not react directly either.
...ANSWER
Answered 2020-Mar-18 at 12:53Why don't you put all the buttons in an array and give them all the same onClickListener interface which when onClick a for loop iterates over this array and disable each else button something like this
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install underrun
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page