Skip to content

Instantly share code, notes, and snippets.

@meshula
Created December 1, 2025 18:03
Show Gist options
  • Select an option

  • Save meshula/6e49c907d9e22bed0c8b30d54a9e5c53 to your computer and use it in GitHub Desktop.

Select an option

Save meshula/6e49c907d9e22bed0c8b30d54a9e5c53 to your computer and use it in GitHub Desktop.
noodle
// node creation and deletion
virtual char const* const* node_names() const = 0;
virtual ln_Node node_create(const std::string& name, ln_Node id) = 0;
virtual void node_delete(ln_Node node) = 0;
// returns true if rename was successful
virtual bool node_rename(ln_Node node, const std::string& name) = 0;
// node access
virtual float node_get_timing(ln_Node node) = 0;
virtual float node_get_self_timing(ln_Node node) = 0;
virtual void node_start_stop(ln_Node node, float when) = 0;
virtual void node_bang(ln_Node node) = 0;
virtual ln_Pin node_input_with_index(ln_Node node, int output) = 0;
virtual ln_Pin node_output_named(ln_Node node, const std::string& output_name) = 0;
virtual ln_Pin node_output_with_index(ln_Node node, int output) = 0;
virtual ln_Pin node_param_named(ln_Node node, const std::string& output_name) = 0;
// pins
virtual void pin_set_param_value(const std::string& node_name, const std::string& param_name, float) = 0;
virtual void pin_set_setting_float_value(const std::string& node_name, const std::string& setting_name, float) = 0;
virtual void pin_set_float_value(ln_Pin pin, float) = 0;
virtual float pin_float_value(ln_Pin pin) = 0;
virtual void pin_set_setting_int_value(const std::string& node_name, const std::string& setting_name, int) = 0;
virtual void pin_set_int_value(ln_Pin pin, int) = 0;
virtual int pin_int_value(ln_Pin pin) = 0;
virtual void pin_set_setting_bool_value(const std::string& node_name, const std::string& setting_name, bool) = 0;
virtual void pin_set_bool_value(ln_Pin pin, bool) = 0;
virtual bool pin_bool_value(ln_Pin pin) = 0;
virtual void pin_set_setting_string_value(const std::string& node_name, const std::string& setting_name, const std::string&) = 0;
virtual void pin_set_string_value(ln_Pin pin, const std::string&) = 0;
virtual std::string pin_string_value(ln_Pin pin) = 0;
virtual void pin_set_setting_bus_value(const std::string& node_name, const std::string& setting_name, const std::string& path) = 0;
virtual void pin_set_bus_from_file(ln_Pin pin, const std::string& path) = 0;
virtual void pin_set_enumeration_value(ln_Pin pin, const std::string& value) = 0;
virtual void pin_set_setting_enumeration_value(const std::string& node_name, const std::string& setting_name, const std::string& value) = 0;
// string based interfaces
virtual void pin_create_output(const std::string& node_name, const std::string& output_name, int channel) = 0;
// connections
virtual void connect_bus_out_to_bus_in(ln_Node node_out_id, ln_Pin output_pin_id, ln_Node node_in_id) = 0;
virtual void connect_bus_out_to_param_in(ln_Node output_node_id, ln_Pin output_pin_id, ln_Pin pin_id) = 0;
virtual void disconnect(ln_Connection connection_id) = 0;
};
//--------------------------------------------------------------------------
// Runtime
//--------------------------------------------------------------------------
struct ProviderHarness {
ProviderHarness() = delete;
explicit ProviderHarness(Provider&);
~ProviderHarness();
Provider& provider;
bool show_profiler = false;
bool show_debug = false;
bool show_demo = false;
bool show_ids = false;
bool run();
// save and load do their work irrespective of dirty state.
// check needs_saving to determine if the user should be presented
// with a save as dialog, or if save should not be called.
// the Context is not responsible for the document on disk, only reading and writing,
// so path is not tracked.
bool needs_saving() const;
void save(const std::string& path);
void load(const std::string& path);
void export_cpp(const std::string& path);
void save_test(const std::string& path);
void save_json(const std::string& path);
void clear_all();
private:
struct State;
State* _s;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment