Factor computation.
This commit is contained in:
parent
a4f0c7b457
commit
c36a6b0aee
@ -143,6 +143,7 @@ osx_render(void *vdata,
|
|||||||
AudioBuffer *buffer = &bufferList->mBuffers[0];
|
AudioBuffer *buffer = &bufferList->mBuffers[0];
|
||||||
size_t bufferSize = buffer->mDataByteSize;
|
size_t bufferSize = buffer->mDataByteSize;
|
||||||
size_t bytesToCopy;
|
size_t bytesToCopy;
|
||||||
|
size_t bytes;
|
||||||
int curpos = 0;
|
int curpos = 0;
|
||||||
|
|
||||||
/*DEBUG("osx_render: enter : %i\n", (int)bufferList->mNumberBuffers);
|
/*DEBUG("osx_render: enter : %i\n", (int)bufferList->mNumberBuffers);
|
||||||
@ -185,8 +186,8 @@ osx_render(void *vdata,
|
|||||||
bufferSize = bytesToCopy;
|
bufferSize = bytesToCopy;
|
||||||
od->len -= bytesToCopy;
|
od->len -= bytesToCopy;
|
||||||
|
|
||||||
if (od->pos + bytesToCopy > od->bufferSize) {
|
bytes = od->bufferSize - od->pos;
|
||||||
size_t bytes = od->bufferSize - od->pos;
|
if (bytesToCopy > bytes) {
|
||||||
memcpy((unsigned char*)buffer->mData + curpos, od->buffer + od->pos, bytes);
|
memcpy((unsigned char*)buffer->mData + curpos, od->buffer + od->pos, bytes);
|
||||||
od->pos = 0;
|
od->pos = 0;
|
||||||
curpos += bytes;
|
curpos += bytes;
|
||||||
@ -299,6 +300,7 @@ osx_play(void *data, const char *playChunk, size_t size)
|
|||||||
{
|
{
|
||||||
OsxData *od = data;
|
OsxData *od = data;
|
||||||
size_t bytesToCopy;
|
size_t bytesToCopy;
|
||||||
|
size_t bytes;
|
||||||
size_t curpos;
|
size_t curpos;
|
||||||
|
|
||||||
/* DEBUG("osx_play: enter\n"); */
|
/* DEBUG("osx_play: enter\n"); */
|
||||||
@ -333,8 +335,8 @@ osx_play(void *data, const char *playChunk, size_t size)
|
|||||||
size -= bytesToCopy;
|
size -= bytesToCopy;
|
||||||
od->len += bytesToCopy;
|
od->len += bytesToCopy;
|
||||||
|
|
||||||
if (curpos + bytesToCopy > od->bufferSize) {
|
bytes = od->bufferSize - curpos;
|
||||||
size_t bytes = od->bufferSize - curpos;
|
if (bytesToCopy > bytes) {
|
||||||
memcpy(od->buffer + curpos, playChunk, bytes);
|
memcpy(od->buffer + curpos, playChunk, bytes);
|
||||||
curpos = 0;
|
curpos = 0;
|
||||||
playChunk += bytes;
|
playChunk += bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user