aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_ring_array.h
diff options
context:
space:
mode:
authorChun-Min Chang <[email protected]>2021-07-27 11:22:59 -0700
committerMatthew Gregan <[email protected]>2021-07-28 09:29:48 +1200
commitf4ef497bbe74cac2af30de74e2a80fba9c0888f0 (patch)
tree6c650e3b40bde3105648987bf070b878337a53d6 /src/cubeb_ring_array.h
parente1456788c48c5ed6b55bc107a7342d63f2a08413 (diff)
downloadcubeb-f4ef497bbe74cac2af30de74e2a80fba9c0888f0.tar.gz
cubeb-f4ef497bbe74cac2af30de74e2a80fba9c0888f0.zip
Run .clang-format
Format all the code under `include` and `src` except those files under `src/speex` with style setting in `.clang-format` file by the following script: ```sh FILE_LIST="$(find "include" "src" -not -path "src/speex/*" | grep -E ".*(\.cpp|\.c|\.h|\.hpp|\.hh)$")" echo "Files found to format:\n---\n$FILE_LIST\n---" clang-format --verbose -i $FILE_LIST ```
Diffstat (limited to 'src/cubeb_ring_array.h')
-rw-r--r--src/cubeb_ring_array.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/cubeb_ring_array.h b/src/cubeb_ring_array.h
index 51b3b32..05a8fe9 100644
--- a/src/cubeb_ring_array.h
+++ b/src/cubeb_ring_array.h
@@ -16,17 +16,16 @@
them in the correct order. */
typedef struct {
- AudioBuffer * buffer_array; /**< Array that hold pointers of the allocated space for the buffers. */
- unsigned int tail; /**< Index of the last element (first to deliver). */
- unsigned int count; /**< Number of elements in the array. */
- unsigned int capacity; /**< Total length of the array. */
+ AudioBuffer * buffer_array; /**< Array that hold pointers of the allocated
+ space for the buffers. */
+ unsigned int tail; /**< Index of the last element (first to deliver). */
+ unsigned int count; /**< Number of elements in the array. */
+ unsigned int capacity; /**< Total length of the array. */
} ring_array;
static int
-single_audiobuffer_init(AudioBuffer * buffer,
- uint32_t bytesPerFrame,
- uint32_t channelsPerFrame,
- uint32_t frames)
+single_audiobuffer_init(AudioBuffer * buffer, uint32_t bytesPerFrame,
+ uint32_t channelsPerFrame, uint32_t frames)
{
assert(buffer);
assert(bytesPerFrame > 0 && channelsPerFrame && frames > 0);
@@ -36,7 +35,7 @@ single_audiobuffer_init(AudioBuffer * buffer,
if (buffer->mData == NULL) {
return CUBEB_ERROR;
}
- PodZero(static_cast<char*>(buffer->mData), size);
+ PodZero(static_cast<char *>(buffer->mData), size);
buffer->mNumberChannels = channelsPerFrame;
buffer->mDataByteSize = size;
@@ -48,15 +47,12 @@ single_audiobuffer_init(AudioBuffer * buffer,
@param ra The ring_array pointer of allocated structure.
@retval 0 on success. */
int
-ring_array_init(ring_array * ra,
- uint32_t capacity,
- uint32_t bytesPerFrame,
- uint32_t channelsPerFrame,
- uint32_t framesPerBuffer)
+ring_array_init(ring_array * ra, uint32_t capacity, uint32_t bytesPerFrame,
+ uint32_t channelsPerFrame, uint32_t framesPerBuffer)
{
assert(ra);
- if (capacity == 0 || bytesPerFrame == 0 ||
- channelsPerFrame == 0 || framesPerBuffer == 0) {
+ if (capacity == 0 || bytesPerFrame == 0 || channelsPerFrame == 0 ||
+ framesPerBuffer == 0) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
ra->capacity = capacity;
@@ -70,8 +66,7 @@ ring_array_init(ring_array * ra,
}
for (unsigned int i = 0; i < ra->capacity; ++i) {
- if (single_audiobuffer_init(&ra->buffer_array[i],
- bytesPerFrame,
+ if (single_audiobuffer_init(&ra->buffer_array[i], bytesPerFrame,
channelsPerFrame,
framesPerBuffer) != CUBEB_OK) {
return CUBEB_ERROR;
@@ -87,7 +82,7 @@ void
ring_array_destroy(ring_array * ra)
{
assert(ra);
- if (ra->buffer_array == NULL){
+ if (ra->buffer_array == NULL) {
return;
}
for (unsigned int i = 0; i < ra->capacity; ++i) {
@@ -95,12 +90,13 @@ ring_array_destroy(ring_array * ra)
operator delete(ra->buffer_array[i].mData);
}
}
- delete [] ra->buffer_array;
+ delete[] ra->buffer_array;
}
/** Get the allocated buffer to be stored with fresh data.
@param ra The ring_array pointer.
- @retval Pointer of the allocated space to be stored with fresh data or NULL if full. */
+ @retval Pointer of the allocated space to be stored with fresh data or NULL
+ if full. */
AudioBuffer *
ring_array_get_free_buffer(ring_array * ra)
{
@@ -156,4 +152,4 @@ ring_array_get_dummy_buffer(ring_array * ra)
return &ra->buffer_array[0];
}
-#endif //CUBEB_RING_ARRAY_H
+#endif // CUBEB_RING_ARRAY_H