forked from mia/Aegisub
Hack: Use a single-play (non-looping) buffer for very short samples that fit entirely in the buffer for DSound playback. This avoids unwanted repeating of very short samples, but also makes it impossible to extend these selections to continue playback.
Fixing the real problem could prove to be very hard or even impossible, as it seems to be a problem of timing and possibly even related to the time slices allocated by the OS. As a buffer size in the DSound player is fixed at 150 ms the side-effect of this hack hopefully won't be a real problem. Originally committed to SVN as r1460.
This commit is contained in:
parent
c62c674975
commit
0718cf5a2c
1 changed files with 9 additions and 5 deletions
|
@ -337,14 +337,18 @@ void DirectSoundPlayer::Play(__int64 start,__int64 count) {
|
||||||
// Fill whole buffer
|
// Fill whole buffer
|
||||||
FillBuffer(true);
|
FillBuffer(true);
|
||||||
|
|
||||||
// Start thread
|
DWORD play_flag = 0;
|
||||||
thread = new DirectSoundPlayerThread(this);
|
if (count > bufSize) {
|
||||||
thread->Create();
|
// Start thread
|
||||||
thread->Run();
|
thread = new DirectSoundPlayerThread(this);
|
||||||
|
thread->Create();
|
||||||
|
thread->Run();
|
||||||
|
play_flag = DSBPLAY_LOOPING;
|
||||||
|
}
|
||||||
|
|
||||||
// Play
|
// Play
|
||||||
buffer->SetCurrentPosition(0);
|
buffer->SetCurrentPosition(0);
|
||||||
res = buffer->Play(0,0,DSBPLAY_LOOPING);
|
res = buffer->Play(0,0,play_flag);
|
||||||
if (SUCCEEDED(res)) playing = true;
|
if (SUCCEEDED(res)) playing = true;
|
||||||
startTime = GetTickCount();
|
startTime = GetTickCount();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue