We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af038a5 commit 2002514Copy full SHA for 2002514
1 file changed
plinth-core/src/buffers/buffer.rs
@@ -42,6 +42,16 @@ impl Buffer {
42
self.samples[0].capacity()
43
}
44
45
+ /// Never lowers capacity
46
+ pub fn ensure_capacity(&mut self, capacity: usize) {
47
+ if capacity <= self.capacity() {
48
+ return;
49
+ }
50
+
51
+ let additional = capacity - self.capacity();
52
+ self.reserve(additional);
53
54
55
pub fn resize(&mut self, length: usize) {
56
for channel in self.samples.iter_mut() {
57
channel.resize(length, 0.0);
0 commit comments