Merge pull request #18 from aliaspider/master

fix audio clicking
This commit is contained in:
dimok789 2016-11-12 11:53:31 +01:00 committed by GitHub
commit c97af74a9d

View File

@ -82,7 +82,7 @@ public:
voiceBuffer.format = format; voiceBuffer.format = format;
voiceBuffer.loop = (nextBuffer == NULL) ? 0 : 1; voiceBuffer.loop = (nextBuffer == NULL) ? 0 : 1;
voiceBuffer.cur_pos = 0; voiceBuffer.cur_pos = 0;
voiceBuffer.end_pos = bufferSize >> 1; voiceBuffer.end_pos = (bufferSize >> 1) - 1;
voiceBuffer.loop_offset = ((nextBuffer - buffer) >> 1); voiceBuffer.loop_offset = ((nextBuffer - buffer) >> 1);
nextBufferSize = nextBufSize; nextBufferSize = nextBufSize;
@ -126,7 +126,7 @@ public:
if(lastLoopCounter != loopCounter) if(lastLoopCounter != loopCounter)
{ {
lastLoopCounter = loopCounter; lastLoopCounter = loopCounter;
AXSetVoiceEndOffset(voice, voiceBuffer.loop_offset + (nextBufferSize >> 1)); AXSetVoiceEndOffset(voice, voiceBuffer.loop_offset + (nextBufferSize >> 1) - 1);
return true; return true;
} }
return false; return false;