Another fix for problematic sound card setup... should have been

part of the last commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23765 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-01-27 13:09:11 +00:00
parent a29a9e05fb
commit e681a8f9e9
+6 -1
View File
@@ -73,9 +73,12 @@ SoundOutput::Format() const
bigtime_t bigtime_t
SoundOutput::Latency() SoundOutput::Latency()
{ {
bigtime_t latency = 0;
if (InitCheck() >= B_OK)
latency += fSoundPlayer->Latency();
// Because of buffering, latency of SoundOutput is // Because of buffering, latency of SoundOutput is
// slightly higher then the BSoundPlayer latency. // slightly higher then the BSoundPlayer latency.
return fSoundPlayer->Latency() + min_c(1000, fBufferDuration / 4); return latency + min_c(1000, fBufferDuration / 4);
} }
@@ -99,10 +102,12 @@ SoundOutput::Play(const void *data, size_t size)
ASSERT(size > 0 && size <= fBufferSize); ASSERT(size > 0 && size <= fBufferSize);
acquire_sem(fBufferWriteable); acquire_sem(fBufferWriteable);
memcpy(fBuffer, data, size); memcpy(fBuffer, data, size);
size_t fillsize = fBufferSize - size; size_t fillsize = fBufferSize - size;
if (fillsize) if (fillsize)
memset(fBuffer + size, 0, fillsize); memset(fBuffer + size, 0, fillsize);
release_sem(fBufferReadable); release_sem(fBufferReadable);
if (!fIsPlaying) { if (!fIsPlaying) {
fSoundPlayer->SetHasData(true); fSoundPlayer->SetHasData(true);
fSoundPlayer->Start(); fSoundPlayer->Start();