|
|
@ -457,19 +457,22 @@ unsigned plWin32StreamingSound::GetByteOffset() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fDataStream && fDSoundBuffer) |
|
|
|
if (fDataStream && fDSoundBuffer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
UInt32 totalSize = fDataStream->GetDataSize(); |
|
|
|
|
|
|
|
UInt32 bytesRemaining = fDataStream->NumBytesLeft(); |
|
|
|
unsigned bytesQueued = fDSoundBuffer->BuffersQueued() * STREAM_BUFFER_SIZE; |
|
|
|
unsigned bytesQueued = fDSoundBuffer->BuffersQueued() * STREAM_BUFFER_SIZE; |
|
|
|
unsigned offset = fDSoundBuffer->GetByteOffset(); |
|
|
|
unsigned offset = fDSoundBuffer->GetByteOffset(); |
|
|
|
long byteoffset = ((fDataStream->GetDataSize() - fDataStream->NumBytesLeft()) - bytesQueued) + offset; |
|
|
|
long byteoffset = ((totalSize - bytesRemaining) - bytesQueued) + offset; |
|
|
|
|
|
|
|
|
|
|
|
return byteoffset < 0 ? fDataStream->GetDataSize() - abs(byteoffset) : byteoffset; |
|
|
|
return byteoffset < 0 ? totalSize - std::abs(byteoffset) : byteoffset; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float plWin32StreamingSound::GetActualTimeSec() |
|
|
|
float plWin32StreamingSound::GetActualTimeSec() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fDataStream && fDSoundBuffer) |
|
|
|
if (fDataStream && fDSoundBuffer) |
|
|
|
return fDSoundBuffer->BytePosToMSecs(fDataStream->NumBytesLeft()) / 1000.0f; |
|
|
|
return fDSoundBuffer->BytePosToMSecs(this->GetByteOffset()) / 1000.0f; |
|
|
|
return 0.0f; |
|
|
|
return 0.0f; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|