2015-07-06 08:05:22 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
|
|
*
|
|
|
|
* This file is part of libsoundio, which is MIT licensed.
|
|
|
|
* See http://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SOUNDIO_RING_BUFFER_HPP
|
|
|
|
#define SOUNDIO_RING_BUFFER_HPP
|
|
|
|
|
|
|
|
#include "atomics.hpp"
|
2015-08-20 21:48:19 +00:00
|
|
|
#include "os.h"
|
2015-07-06 08:05:22 +00:00
|
|
|
|
|
|
|
struct SoundIoRingBuffer {
|
2015-07-27 22:29:10 +00:00
|
|
|
SoundIoOsMirroredMemory mem;
|
2015-07-06 08:05:22 +00:00
|
|
|
atomic_long write_offset;
|
|
|
|
atomic_long read_offset;
|
2015-07-27 22:29:10 +00:00
|
|
|
int capacity;
|
2015-07-06 08:05:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int soundio_ring_buffer_init(struct SoundIoRingBuffer *rb, int requested_capacity);
|
|
|
|
void soundio_ring_buffer_deinit(struct SoundIoRingBuffer *rb);
|
|
|
|
|
|
|
|
#endif
|