mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 17:16:38 +01:00
* added a bit of documentation in an effort to understand the code
git-svn-id: svn://localhost/ardour2/branches/3.0@4355 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c7c1753c72
commit
fa71e0e12a
1 changed files with 34 additions and 0 deletions
|
|
@ -56,6 +56,8 @@ public:
|
||||||
g_atomic_int_set(&_read_ptr, 0);
|
g_atomic_int_set(&_read_ptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Calculate remaining space for writing
|
||||||
|
*/
|
||||||
size_t write_space() const {
|
size_t write_space() const {
|
||||||
const size_t w = g_atomic_int_get(&_write_ptr);
|
const size_t w = g_atomic_int_get(&_write_ptr);
|
||||||
const size_t r = g_atomic_int_get(&_read_ptr);
|
const size_t r = g_atomic_int_get(&_read_ptr);
|
||||||
|
|
@ -69,6 +71,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Calculate how much still can be read
|
||||||
|
*/
|
||||||
size_t read_space() const {
|
size_t read_space() const {
|
||||||
const size_t w = g_atomic_int_get(&_write_ptr);
|
const size_t w = g_atomic_int_get(&_write_ptr);
|
||||||
const size_t r = g_atomic_int_get(&_read_ptr);
|
const size_t r = g_atomic_int_get(&_read_ptr);
|
||||||
|
|
@ -80,14 +84,44 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Report the buffers size
|
||||||
|
*/
|
||||||
size_t capacity() const { return _size; }
|
size_t capacity() const { return _size; }
|
||||||
|
|
||||||
|
/** Peek at the ringbuffer (read w/o advancing read pointer).
|
||||||
|
* @return how much has been peeked (read cannot exceed the end
|
||||||
|
* of the buffer):
|
||||||
|
* <pre>
|
||||||
|
* |-------------------------R=============================|
|
||||||
|
* read-pointer---^
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
size_t peek(size_t size, T* dst);
|
size_t peek(size_t size, T* dst);
|
||||||
|
|
||||||
|
/** Peek at the ringbuffer (read w/o advancing read pointer).
|
||||||
|
* @return how much has been peeked (wraps around if read exceeds
|
||||||
|
* the end of the buffer):
|
||||||
|
* <pre>
|
||||||
|
* |===========--------------R=============================|
|
||||||
|
* read-pointer---^
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
bool full_peek(size_t size, T* dst);
|
bool full_peek(size_t size, T* dst);
|
||||||
|
|
||||||
|
/** Read from the ringbuffer. (advances read pointer)
|
||||||
|
* @return how much has been read (read cannot exceed the end
|
||||||
|
* of the buffer):
|
||||||
|
*/
|
||||||
size_t read(size_t size, T* dst);
|
size_t read(size_t size, T* dst);
|
||||||
|
|
||||||
|
/** Read from the ringbuffer. (advances read pointer)
|
||||||
|
* @return how much has been peeked (wraps around if read exceeds
|
||||||
|
* the end of the buffer):
|
||||||
|
*/
|
||||||
bool full_read(size_t size, T* dst);
|
bool full_read(size_t size, T* dst);
|
||||||
|
|
||||||
|
/** Advance read pointer by size
|
||||||
|
*/
|
||||||
bool skip(size_t size);
|
bool skip(size_t size);
|
||||||
|
|
||||||
void write(size_t size, const T* src);
|
void write(size_t size, const T* src);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue