static void run(const std::string& expr, float a, float b, float c, ossia::audio_port& output, ossia::token_request tk, ossia::exec_state_facade st, State& self) { if (tk.date > tk.prev_date) { auto count = tk.date - tk.prev_date; if (!updateExpr(self, expr)) return; output.samples.resize(1); auto& cur = output.samples[0]; if ((int64_t)cur.size() < tk.offset + count) cur.resize(tk.offset + count); self.p1 = a; self.p2 = b; self.p3 = c; self.fs = st.sampleRate(); for (int64_t i = 0; i < count; i++) { self.cur_time = tk.prev_date + i; cur[tk.offset + i] = self.expr.value(); } } }
stitch_support_v1_update* MONGO_API_CALL stitch_support_v1_update_create(stitch_support_v1_lib* lib, const uint8_t* updateExprBSON, const uint8_t* arrayFiltersBSON, stitch_support_v1_matcher* matcher, stitch_support_v1_collator* collator, stitch_support_v1_status* status) { return enterCXX(mongo::getStatusImpl(status), [&]() { mongo::BSONObj updateExpr(mongo::fromInterfaceType(updateExprBSON)); mongo::BSONArray arrayFilters( (arrayFiltersBSON ? mongo::BSONObj(mongo::fromInterfaceType(arrayFiltersBSON)) : mongo::BSONObj())); return mongo::update_create(lib, updateExpr, arrayFilters, matcher, collator); }); }
static void run(const std::string& expr, float a, float b, float c, ossia::value_port& output, ossia::token_request tk, ossia::exec_state_facade st, State& self) { if (!updateExpr(self, expr)) return; self.cur_time = tk.date.impl; self.cur_deltatime = tk.date.impl - tk.prev_date.impl; self.cur_pos = tk.position; self.p1 = a; self.p2 = b; self.p3 = c; auto res = self.expr.value(); output.write_value(res, tk.tick_start()); }