codestudy/potential

potential

dz / codestudy / potential

Summary

Study notes for some code files from the Potential plugin VCVRack suite.

Node Tree

Nodes

github
content Gihub Link for source code
hyperlink https://github.com/dbonel/potential
location codestudy/dz/potential.dz:5

test_reference
content Just a test reference
file reference codestudy/potential/plugin.cpp:12-14
location codestudy/dz/potential.dz:9

cpp
content The C++ code
children header_file_looks_like_boilerplate, magsign_cpp, init_entry_point
location codestudy/dz/potential.dz:13

init_entry_point
content Init Entry Point Function
children add_model_magsign
parents cpp
remarks This must be the top-level entry point
file reference codestudy/potential/plugin.cpp:5-15
location codestudy/dz/potential.dz:16

add_model_magsign
content The magsign model is added with some function pointer called "addModel"
children magsign_model_creation (this variable is what is added to in the init function)
parents init_entry_point
file reference codestudy/potential/plugin.cpp:8
location codestudy/dz/potential.dz:22

header_file_looks_like_boilerplate
content The main plugin.hpp header file looks like mostly boilerplate.
parents cpp
file reference codestudy/potential/plugin.hpp:0
location codestudy/dz/potential.dz:29

magsign_cpp
content magsign c++ file
children magsign_widget, magsign_struct, magsign_model_creation
parents cpp
file reference codestudy/potential/mag_sign.cpp:0
location codestudy/dz/potential.dz:34

magsign_struct
content magsign struct (C++ struct that seems to inherit from Module)
children magsign_widget (the other struct), magsign_processor, magsign_enums, magsign_constructor
parents magsign_cpp
file reference codestudy/potential/mag_sign.cpp:3-29
location codestudy/dz/potential.dz:39

magsign_enums
content MagSign enums
parents magsign_struct
file reference codestudy/potential/mag_sign.cpp:4-12
location codestudy/dz/potential.dz:44

magsign_constructor
content MagSign constructor
parents magsign_struct
file reference codestudy/potential/mag_sign.cpp:14-22
location codestudy/dz/potential.dz:49

magsign_processor
content MagSign process function
children magsign_process_inner_loop
parents magsign_struct
file reference codestudy/potential/mag_sign.cpp:24-29
location codestudy/dz/potential.dz:54

magsign_widget
content Magsign Widget Struct (Inherits from ModuleWidget)
children magsign_add_outputs, magsign_add_inputs, magsign_child_components
parents magsign_struct, magsign_cpp
file reference codestudy/potential/mag_sign.cpp:31-59
location codestudy/dz/potential.dz:59

magsign_model_creation
content Creating a global instance of MagSign called "modelMagSign" using some function called "createModel".
parents magsign_cpp, add_model_magsign
remarks "Model" as in "MVC Architecture?"
file reference codestudy/potential/mag_sign.cpp:61
location codestudy/dz/potential.dz:66

magsign_child_components
content calls to =addChild=, which I'm assuming are just like components.
parents magsign_widget
remarks borrowed terminology from DOM?
file reference codestudy/potential/mag_sign.cpp:36-43
location codestudy/dz/potential.dz:75

magsign_add_inputs
content adding 3 inputs to the module using =addInput()=.
children magsign_add_outputs (related)
parents magsign_widget
file reference codestudy/potential/mag_sign.cpp:45-50
location codestudy/dz/potential.dz:82

magsign_add_outputs
content Adding 3 outputs to the module using =addOutput()=.
parents magsign_widget, magsign_add_inputs
file reference codestudy/potential/mag_sign.cpp:52-57
location codestudy/dz/potential.dz:87

magsign_process_inner_loop
content inner loop of the MagSign Processor
children call_mag_sign_process_raw, get_inputs_outputs, mag_sign_process_raw (very similar structure)
parents magsign_processor
file reference codestudy/potential/mag_sign.cpp:25-27
location codestudy/dz/potential.dz:94

get_inputs_outputs
content These lines get input and output "ports" using a function called =ffi_port()=. The return type is =rustlib::Port=, so this is where the actual transition from CPP to Rust starts.
parents magsign_process_inner_loop
file reference codestudy/potential/mag_sign.cpp:25-26
location codestudy/dz/potential.dz:99

only_first_inputs_outputs
content Only the first inputs and outputs it seems. In C++, it's at array index 0. I'm guessing that this plugin has only one channel in and one channel out? and this is stored in the first input.
tags clarify, inputs[0], what, and, outputs[0], to, point
location codestudy/dz/potential.dz:107

call_mag_sign_process_raw
content A call to =rustlib::magsign_process_raw=. This is probably where the DSP happens in rust.
children mag_sign_process_raw (called inside of DSP callback)
parents magsign_process_inner_loop
file reference codestudy/potential/mag_sign.cpp:27
location codestudy/dz/potential.dz:114

rust
content The Rust Code
children MagSignInput_struct, mag_sign_process, MagSignOutput_struct, mag_sign_process_raw
location codestudy/dz/potential.dz:120

mag_sign_process_raw
content mag_sign_process_raw(). Get the raw pointers from inputs, outputs. then call mag_sign_process DSP call
children mag_sign_process (called inside of process_raw)
parents call_mag_sign_process_raw, magsign_process_inner_loop, rust
file reference codestudy/potential/mag_sign.rs:58-62
location codestudy/dz/potential.dz:123

mag_sign_process
content mag_sign_process(). Does the actual DSP. mag_sign_process()
children upper_half_processing, lower_half_processing
parents mag_sign_process_raw, rust
file reference codestudy/potential/mag_sign.rs:4-56
location codestudy/dz/potential.dz:134

MagSignInput_struct
content MagSignInput struct
children MagSignOutput_struct (related struct), RackInput_MagSignInput
parents rust
file reference codestudy/potential/mag_sign.rs:64-68
location codestudy/dz/potential.dz:142

RackInput_MagSignInput
content Implement RackInput trait for MagSignInput
children RackOutput_MagSignOutput (similar)
parents MagSignInput_struct
file reference codestudy/potential/mag_sign.rs:69-92
location codestudy/dz/potential.dz:147

MagSignOutput_struct
content MagSignOutput struct
children RackOutput_MagSignOutput
parents rust, MagSignInput_struct
file reference codestudy/potential/mag_sign.rs:94-98
location codestudy/dz/potential.dz:152

RackOutput_MagSignOutput
content Implement RackOutput trait for MagSignOutput
parents MagSignOutput_struct, RackInput_MagSignInput
file reference codestudy/potential/mag_sign.rs:99-122
location codestudy/dz/potential.dz:159

upper_half_processing
content Upper half processing: decomposition
children method_chaining_bipolar, lower_half_processing (done after upper half)
parents mag_sign_process
file reference codestudy/potential/mag_sign.rs:6-25
location codestudy/dz/potential.dz:166

lower_half_processing
content Lower half processing: decomposition
parents upper_half_processing, mag_sign_process
file reference codestudy/potential/mag_sign.rs:28-55
location codestudy/dz/potential.dz:171

method_chaining_bipolar
content Some method chaining on "bipolar" variable.
children bipolar_iter
parents upper_half_processing
file reference codestudy/potential/mag_sign.rs:12-24
location codestudy/dz/potential.dz:179

bipolar_iter
content iter(): just makes the elements here iterable. These must be the input samples.
children rust/std_iter, bipolar_zip
parents method_chaining_bipolar
file reference codestudy/potential/mag_sign.rs:13
location codestudy/dz/potential.dz:184

bipolar_zip
content nested zips: =.zip(magnitude.iter_mut().zip(sign.iter_mut()))=
children bipolar_for_each, rust/std_iter_zip
parents bipolar_iter
file reference codestudy/potential/mag_sign.rs:14
location codestudy/dz/potential.dz:190

bipolar_for_each
content for_each()
parents bipolar_zip
file reference codestudy/potential/mag_sign.rs:15-24