Lucky number five. Posted this in another thread, thought you might like to give it a try.Perhaps it's time for a dedicated pulseaudio engine after all. Yet another audio API to support.
http://0pointer.de/lennart/projects/pul ... 6c26206689
Code: Select all
#include <pulse/simple.h>
pa_simple *pa_server;
bool init() {
pa_sample_spec spec;
spec.format = PA_SAMPLE_S16LE;
spec.channels = 2;
spec.rate = 2000000; // or 8000 ;)
pa_server = pa_simple_new(0, "gambatte::pulseaudio", PA_STREAM_PLAYBACK, 0, "audio", &spec, 0, 0, 0);
return pa_server;
}
void write(uint16_t *data, unsigned length_in_bytes) {
int error;
pa_simple_write(pa_server, (void*)data, length_in_bytes, &error);
}
void term() {
if(pa_server) {
pa_simple_free(pa_server);
pa_server = 0;
}
}
Enjoy the double latency of a sound server ;)
Very true, my resampling is infinitesimal by comparison. Amazing that the GB can generate a 2 MHz signal. Seems absurdly excessive.But the case of resampling from ~2 MHz to ~44 kHz is much harder than the case of resampling from 32 kHz to ~44 kHz.
May I ask why you drop to 8KHz, instead of eg 48KHz? Not like it's going to make a world of difference starting from 2MHZ ...even more if you go from 2 MHz to 8 kHz.
I haven't had much success with it in the past, so it may not be worth the effort to even try. Just an idea.I haven't. It would mean yet another video engine option, but if it often works better it'd be well worth it.