2024-12-01 19:35:24 +00:00
|
|
|
//| Copyright: (C) 2020-2024 Kevin Larke <contact AT larke DOT org>
|
|
|
|
//| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
|
2024-10-12 19:29:39 +00:00
|
|
|
#ifndef cwFlow_h
|
|
|
|
#define cwFlow_h
|
2021-08-15 20:07:12 +00:00
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
|
|
|
namespace flow
|
|
|
|
{
|
|
|
|
|
2021-12-11 20:19:15 +00:00
|
|
|
typedef handle<struct flow_str> handle_t;
|
2021-08-15 20:07:12 +00:00
|
|
|
|
2021-12-19 17:10:35 +00:00
|
|
|
void print_abuf( const struct abuf_str* abuf );
|
|
|
|
void print_external_device( const external_device_t* dev );
|
2024-10-14 18:20:13 +00:00
|
|
|
|
2024-06-11 00:40:41 +00:00
|
|
|
// Parse the cfg's but don't yet instantiate the network.
|
|
|
|
// Upon completion of this function the caller can
|
|
|
|
// query the network for configuration information which can
|
|
|
|
// be used to setup the extern_device_t array.
|
|
|
|
rc_t create(handle_t& hRef,
|
2024-09-20 22:13:17 +00:00
|
|
|
const object_t* classCfg, // processor class dictionary
|
|
|
|
const object_t* pgmCfg, // top level program cfg
|
2024-10-14 18:20:13 +00:00
|
|
|
const object_t* udpCfg = nullptr,
|
|
|
|
const char* projDir = nullptr,
|
|
|
|
ui_callback_t ui_callback = nullptr,
|
|
|
|
void* ui_callback_arg = nullptr);
|
2024-06-11 00:40:41 +00:00
|
|
|
|
2024-09-20 22:13:17 +00:00
|
|
|
// Network cfg. information which is available following create().
|
2024-06-11 00:40:41 +00:00
|
|
|
bool is_non_real_time( handle_t h );
|
|
|
|
double sample_rate( handle_t h );
|
|
|
|
unsigned frames_per_cycle( handle_t h );
|
2024-02-18 13:41:19 +00:00
|
|
|
unsigned preset_cfg_flags( handle_t h );
|
2021-12-19 17:10:35 +00:00
|
|
|
|
2024-09-20 22:13:17 +00:00
|
|
|
// Get the count and labels of the top level presets
|
|
|
|
unsigned preset_count( handle_t h );
|
|
|
|
const char* preset_label( handle_t h, unsigned preset_idx );
|
|
|
|
|
|
|
|
// Instantiate the network and prepare for runtime.
|
2024-10-14 18:20:13 +00:00
|
|
|
// The UI is not available until after initialization.
|
2024-10-12 19:29:39 +00:00
|
|
|
rc_t initialize( handle_t handle,
|
2024-09-20 22:13:17 +00:00
|
|
|
external_device_t* deviceA = nullptr,
|
|
|
|
unsigned deviceN = 0,
|
2024-10-12 19:29:39 +00:00
|
|
|
unsigned preset_idx = kInvalidIdx);
|
2024-09-20 22:13:17 +00:00
|
|
|
|
|
|
|
rc_t destroy( handle_t& hRef );
|
|
|
|
|
2024-10-12 19:29:39 +00:00
|
|
|
// The ui_net() is not available until the network has been initialized.
|
|
|
|
const ui_net_t* ui_net( handle_t h );
|
|
|
|
|
2021-12-12 21:41:57 +00:00
|
|
|
// Run one cycle of the network.
|
2021-12-19 17:10:35 +00:00
|
|
|
rc_t exec_cycle( handle_t h );
|
2021-12-12 21:41:57 +00:00
|
|
|
|
2024-09-20 22:13:17 +00:00
|
|
|
// Run a non-real-time program to completion.
|
2024-04-22 20:02:40 +00:00
|
|
|
rc_t exec( handle_t h );
|
2021-08-15 20:07:12 +00:00
|
|
|
|
2021-12-26 03:16:00 +00:00
|
|
|
rc_t apply_preset( handle_t h, const char* presetLabel );
|
2024-02-08 16:17:26 +00:00
|
|
|
rc_t apply_dual_preset( handle_t h, const char* presetLabel_0, const char* presetLabel_1, double coeff );
|
2024-04-22 20:02:40 +00:00
|
|
|
rc_t apply_preset( handle_t h, const multi_preset_selector_t& multi_preset_sel );
|
2024-02-08 16:17:26 +00:00
|
|
|
|
2021-12-26 03:16:00 +00:00
|
|
|
|
|
|
|
rc_t set_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, bool value );
|
|
|
|
rc_t set_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, int value );
|
|
|
|
rc_t set_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, unsigned value );
|
|
|
|
rc_t set_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, float value );
|
|
|
|
rc_t set_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, double value );
|
|
|
|
|
2023-01-05 12:26:25 +00:00
|
|
|
rc_t get_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, bool& valueRef );
|
|
|
|
rc_t get_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, int& valueRef );
|
|
|
|
rc_t get_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, unsigned& valueRef );
|
|
|
|
rc_t get_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, float& valueRef );
|
|
|
|
rc_t get_variable_value( handle_t h, const char* inst_label, const char* var_label, unsigned chIdx, double& valueRef );
|
2024-10-12 19:29:39 +00:00
|
|
|
|
|
|
|
|
2024-10-14 18:20:13 +00:00
|
|
|
// The 'user_id' shows up as the 'user_id' in the ui_var field.
|
|
|
|
rc_t set_variable_user_id( handle_t h, const ui_var_t* ui_var, unsigned user_id );
|
|
|
|
|
2024-10-12 19:29:39 +00:00
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, bool value );
|
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, int value );
|
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, unsigned value );
|
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, float value );
|
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, double value );
|
|
|
|
rc_t set_variable_value( handle_t h, const ui_var_t* ui_var, const char* value );
|
|
|
|
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, bool& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, int& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, unsigned& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, float& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, double& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const ui_var_t* ui_var, const char*& value_ref );
|
|
|
|
|
2023-01-05 12:26:25 +00:00
|
|
|
|
2021-12-19 17:10:35 +00:00
|
|
|
void print_class_list( handle_t h );
|
|
|
|
void print_network( handle_t h );
|
2021-08-15 20:07:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|