Don't return MA_AT_END from ring buffers.

There is no notion of an "end" in a ring buffer. Also, this result is
returned when the operation completed successfully which makes a result
code other than MA_SUCCESS confusing.
This commit is contained in:
David Reid
2025-01-11 15:57:42 +10:00
parent 928ed8bd85
commit 547ef1c9b7
2 changed files with 3 additions and 10 deletions
+1
View File
@@ -1,6 +1,7 @@
v0.11.22 - TBD
=====================
* Add `MA_SOUND_FLAG_LOOPING` and `MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_LOOPING` flags. These can be used to initialize sounds and resource managed data sources to loop by default. This is the recommended way to enable looping for streams. The `isLooping` config option in `ma_sound_config` and `ma_resource_manager_data_source_config` has been deprecated. If you are using those, you should switch to the new flag or else you'll get compiler errors when upgrading to a future version.
* `ma_rb_commit_read()`, `ma_rb_commit_write()`, `ma_pcm_rb_commit_read()` and `ma_pcm_rb_commit_write()` no longer return `MA_AT_END`. The reason for this change is that there's no real notion of an "end" in a ring buffer which makes this result code confusing. In addition, it's possible for these functions to return something other than `MA_SUCCESS` when the operation completed successfully which adds to the confusion. The correct way to check if there is any more room in the ring buffer is to look at the frame count returned by `*rb_acquire_read/write()`.
* Fix a bug relating to node detachment.
* Fix a bug where amplification with `ma_device_set_master_volume()` does not work.
* Fix a bug where sounds loaded with `MA_SOUND_FLAG_DECODE` do not loop.
-8
View File
@@ -56592,11 +56592,7 @@ MA_API ma_result ma_rb_commit_read(ma_rb* pRB, size_t sizeInBytes)
ma_atomic_exchange_32(&pRB->encodedReadOffset, ma_rb__construct_offset(newReadOffsetLoopFlag, newReadOffsetInBytes));
if (ma_rb_pointer_distance(pRB) == 0) {
return MA_AT_END;
} else {
return MA_SUCCESS;
}
}
MA_API ma_result ma_rb_acquire_write(ma_rb* pRB, size_t* pSizeInBytes, void** ppBufferOut)
@@ -56678,11 +56674,7 @@ MA_API ma_result ma_rb_commit_write(ma_rb* pRB, size_t sizeInBytes)
ma_atomic_exchange_32(&pRB->encodedWriteOffset, ma_rb__construct_offset(newWriteOffsetLoopFlag, newWriteOffsetInBytes));
if (ma_rb_pointer_distance(pRB) == 0) {
return MA_AT_END;
} else {
return MA_SUCCESS;
}
}
MA_API ma_result ma_rb_seek_read(ma_rb* pRB, size_t offsetInBytes)