Move the ringbuffer to common
This commit is contained in:
+2
-2
@@ -585,6 +585,8 @@ set(COMMON_OBJS
|
||||
common/polyphase_resampler.cpp
|
||||
common/polyphase_resampler.h
|
||||
common/pragmadefs.h
|
||||
common/ringbuffer.cpp
|
||||
common/ringbuffer.h
|
||||
common/strutils.cpp
|
||||
common/strutils.h
|
||||
common/threads.cpp
|
||||
@@ -693,8 +695,6 @@ set(ALC_OBJS
|
||||
alc/inprogext.h
|
||||
alc/logging.h
|
||||
alc/panning.cpp
|
||||
alc/ringbuffer.cpp
|
||||
alc/ringbuffer.h
|
||||
alc/uiddefs.cpp
|
||||
alc/voice.cpp
|
||||
alc/voice.h
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "almalloc.h"
|
||||
@@ -161,17 +160,6 @@ size_t RingBuffer::write(const void *src, size_t cnt) noexcept
|
||||
}
|
||||
|
||||
|
||||
void RingBuffer::readAdvance(size_t cnt) noexcept
|
||||
{
|
||||
mReadPtr.fetch_add(cnt, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
void RingBuffer::writeAdvance(size_t cnt) noexcept
|
||||
{
|
||||
mWritePtr.fetch_add(cnt, std::memory_order_acq_rel);
|
||||
}
|
||||
|
||||
|
||||
ll_ringbuffer_data_pair RingBuffer::getReadVector() const noexcept
|
||||
{
|
||||
ll_ringbuffer_data_pair ret;
|
||||
@@ -1,10 +1,9 @@
|
||||
#ifndef RINGBUFFER_H
|
||||
#define RINGBUFFER_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <stddef.h>
|
||||
#include <utility>
|
||||
|
||||
#include "albyte.h"
|
||||
@@ -75,7 +74,9 @@ public:
|
||||
*/
|
||||
size_t peek(void *dest, size_t cnt) const noexcept;
|
||||
/** Advance the read pointer `cnt' places. */
|
||||
void readAdvance(size_t cnt) noexcept;
|
||||
void readAdvance(size_t cnt) noexcept
|
||||
{ mReadPtr.fetch_add(cnt, std::memory_order_acq_rel); }
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of elements available for writing. This is the number
|
||||
@@ -94,7 +95,8 @@ public:
|
||||
*/
|
||||
size_t write(const void *src, size_t cnt) noexcept;
|
||||
/** Advance the write pointer `cnt' places. */
|
||||
void writeAdvance(size_t cnt) noexcept;
|
||||
void writeAdvance(size_t cnt) noexcept
|
||||
{ mWritePtr.fetch_add(cnt, std::memory_order_acq_rel); }
|
||||
|
||||
/**
|
||||
* Create a new ringbuffer to hold at least `sz' elements of `elem_sz'
|
||||
Reference in New Issue
Block a user