Log in

View Full Version : AC3 encoder => Which is faster : waveout or directsound


Tril
11th November 2005, 07:29
I hope I'm in the right forum for this kind of question. That's my first post here.

I'm currently making a realtime AC3 encoder that will work with the kX drivers. The drivers route the 5.1 sound to ASIO. My program takes the audio from ASIO and uses the AC3 encoding from avcodec (from ffmpeg). It encapsulate the encoded data to spdif and sends the audio to the card using waveout and the card uses passthru to send the audio to an external AC3 decoder (a receiver, etc). It's currently working and almost ready for release.

The advantage of this is that all sound without exception gets encoded to AC3. There's no need for a AC3 encoder plugin in every software you use. It works for games, tv, everything. The drawback is latency.

My card does not support passthru but the kX drivers can decode AC3 in software in realtime. I measured the latency between when the audio gets sent to ASIO and when the card gets the decoded AC3. I measured 160 ms. It's good but the lower it gets, the better. I can't get lower than 32 ms for sure. That's the time it takes to fill the buffer of samples to encode.

Any suggestions to improve the latency?

How much time passes between the time you use waveout and the soundcard receives the audio?
Would the latency get lower by using directsound instead of waveout?
Are there ways of improving the speed of waveout (a priority option or something)?
What switches should I use when compiling ffmpeg for the best performance? I used msys mingw32. The last time I did it, I used : ./configure --enable-shared --enable-memalign-hack --disable-debug --disable-ffplay --disable-ffserver --disable-audio-oss

Once it's released, it will be good news to users of soundblaster live, audigy and audigy 2 that use the kX drivers.

Tril
17th November 2005, 23:14
My tests showed that waveout was slightly faster than directsound.
I got a latency around 170 ms with WaveOut.
I got a latency around 200 ms with DirectSound.

I thought that DirectSound would be faster before making tests.

I released the program yesterday in the kX drivers forum. I called it redocneXk.