libvc | Vulkan Compute for C | GPU library
kandi X-RAY | libvc Summary
kandi X-RAY | libvc Summary
The interface is still being designed. It will feature abstractions for devices, memory, buffers, shaders, etc.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of libvc
libvc Key Features
libvc Examples and Code Snippets
Community Discussions
Trending Discussions on libvc
QUESTION
I'm in the process of finishing a MIDI controlled software synthesizer. The MIDI input and synthesis work alright, but I appear to have a problem one playing the audio itself.
I'm using jackd
as my audio server because of the possibility to configure it for low latency applications, such as in my case, real-time MIDI instruments, with alsa
as the jackd
backend.
In my program I'm using RtAudio
which is a fairly well known C++ library to connect to various sound servers and offers basic stream operations on them. As the name says, it's optimised for real-time audio.
I also use the Vc
library, which is a library that provides vectorization for various math functions, in order to speed up the additive synthesis process. I'm basically adding up a multitude of sine waves of different frequencies and amplitudes in order the produce a complex waveform on the output, like a sawtooth wave or a square wave, for example.
Now, the problem is not that latency is high to start with, as that could probably be solved or blamed on a lot of things, such as MIDI input or what not. The problem is that latency between my soft synth and the final audio output starts very low, and after a couple of minutes, it gets unbearably high.
Since I plan to use this to play "live", i.e. in my home, I can't really be bothered to play with an ever-growing latency between my keystrokes and the audio feedback I hear.
I've tried to reduce the code base that reproduces the problem all the way down, and I can't further reduce it any more.
...ANSWER
Answered 2018-Feb-19 at 00:51I think your get_samples thread generates audio faster or slower than streamCallback consumes them. Using clock for flow control is unreliable.
Simple way to fix, remove that thread and sample_buffer queue and generate samples directly in streamCallback function.
If you do want to use multithreading for your app, it requires proper synchronization between producer and consumer. Much more complex. But in short, the steps are below.
Replace your queue with a reasonably small fixed-length circular buffer. Technically, std::queue will work too, just slower because pointer-based, and you need to manually limit the max.size.
In producer thread implement endless loop that checks is there empty space in the buffer, if there’s space generate more audio, if not, wait for the consumer to consume the data from the buffer.
In consumer streamCallback callback, copy data from circular buffer to output_buf. If there’s not enough data available, wake the producer thread and wait for it to produce the data.
Unfortunately an efficient implementation of that is quite tricky. You need synchronization to protect shared data, but you don’t want too much synchronization otherwise producer and consumer will be serialized and will only use a single hardware thread. One approach is single std::mutex to protect the buffer while moving pointers/size/ofset (but unlock while reading/writing the data), and two std::condition_variable, one for the producer to sleep when there’s no free space in the buffer, another one for the consumer to sleep when there’s no data in the buffer.
QUESTION
I'm developing a media player based on libvc, I want to make a progress bar like the one in Kmplayer for example, I'm thinking in a bar that shows the progress but also allow me to change the position of the movie with a click on the desired position on the bar. Also the Kmplayer's progress bar shows the title of the movie in the left side and the duration/elapsed time in the rigth side.(Attached Picture shows desired effects marked in green)
How can I copy that look? I think that I need to create my own subclass of QProgressBar but Could someone point me in the rigth direction please? …
Kmplayer Progress Bar Picture
...ANSWER
Answered 2017-Jul-19 at 07:38Here an example of paintEvent()
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install libvc
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