Make the buffer latency less agressive for Haiku, this makes audio playback

perfect in Haiku for me (HD Audio), while it adds a very noticable latency.
On C-Media, the difference between "policy 4" and "policy 5" is 2048 versus
32768 bytes, which is 16 times the latency. I added a note on why the same
policy on Haiku might give me troubles (C-Media versus HD Audio means
16 bits/sample versus 32 bits/sample) and if OSS does not double the buffer
size then I can see where the trouble is comming from. I should probably
figure out a more fine grained way of influencing the driver buffer size.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26062 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-06-21 13:13:21 +00:00
parent 2e314c0993
commit 4e913061bb
@@ -96,10 +96,21 @@ status_t OpenSoundDeviceEngine::Open(int mode)
return EIO;
}
// set latency policy = fragment size (4 means 2048 bytes driver buffer
// in my tests)
// XXX: BParameter?
// set latency policy = fragment size and total driver buffer size
// TODO: export this setting as a BParameter?
// NOTE stippi: 4 means 2048 bytes driver buffer in my tests on a C-Media
// This latency is long enough for playback on BeOS. On Haiku, testing on
// HD Audio hardware, it is too short. However, I seem to remember the
// HD Audio supports 32 bit sample width (while C-Media supports "only"
// 16). If OSS uses the same 2048 bytes even for 32 bit/sample, then I
// could see how that would be asking too much, since that would
// effectively half the latency.
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
v = 5;
#else
v = 4;
#endif
if (ioctl(fFD, SNDCTL_DSP_POLICY, &v, sizeof(int)) < 0) {
if (errno != EIO && errno != EINVAL) {
fInitCheckStatus = errno;