diff options
-rw-r--r-- | Alc/alcRing.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/alcRing.c b/Alc/alcRing.c index 0e52ad3c..c2384a83 100644 --- a/Alc/alcRing.c +++ b/Alc/alcRing.c @@ -70,7 +70,7 @@ void DestroyRingBuffer(RingBuffer *ring) ALsizei RingBufferSize(RingBuffer *ring) { - return (ring->read_pos+1-ring->write_pos+ring->length) % ring->length; + return (ring->write_pos-ring->read_pos-1+ring->length) % ring->length; } void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len) @@ -79,8 +79,8 @@ void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len) EnterCriticalSection(&ring->cs); - if((ring->write_pos-ring->read_pos+ring->length)%ring->length < len) - ring->read_pos = ((ring->write_pos+len) % ring->length) + 1; + if((ring->read_pos-ring->write_pos+ring->length)%ring->length < len) + ring->read_pos = (ring->write_pos+len) % ring->length; if(remain < len) { |