From eaa88423820fe9e50e67cecee76c57a1c671c94b Mon Sep 17 00:00:00 2001 From: tomara_x <86204514+tomara-x@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:25:53 +0300 Subject: [PATCH] limit render --- README.md | 2 +- src/process.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4cead9b..ee7087a 100644 --- a/README.md +++ b/README.md @@ -569,7 +569,7 @@ for more info about osc: https://opensoundcontrol.stanford.edu/spec-1_0.html - process the input array as input to the given audio node (array length must match the number of input channels the node has) output of the node is written to this circle's array (process one audio frame) - `render` - inputs: `n`, `0 -> 1` (input node), `n -> 2` (trigger) - - render n samples from the given audio node into the array when the second input is non-zero (node must have 0 ins, and 1 out) + - render n samples from the given audio node into the array when the second input is non-zero (node must have 0 ins, and 1 out). can process a maximum of 10 million samples at a time (a limit to avoid causing memory issues and excessive cpu usage) - `store` - inputs: `n -> 1` - store the input num into self's num, but doesn't open the white holes reading nums like usual diff --git a/src/process.rs b/src/process.rs index 6b4ff81..a1bb2d9 100644 --- a/src/process.rs +++ b/src/process.rs @@ -1332,7 +1332,8 @@ pub fn process( } if wh.link_types == (-1, 2) && num_query.get(wh.bh_parent).unwrap().0 != 0. { - let len = num_query.get(*id).unwrap().0 as usize; + let mut len = num_query.get(*id).unwrap().0 as usize; + len = std::cmp::Ord::min(len, 10000000); let output = &mut arr_query.get_mut(*id).unwrap().0; let net = &mut net_query.get_mut(*id).unwrap().0; if net.inputs() == 0 && net.outputs() == 1 {