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

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

cpp
content The C++ code
children header_file_looks_like_boilerplate, magsign_cpp, init_entry_point

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

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

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

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

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

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

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

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

magsign_widget
content Magsign Widget Struct (Inherits from ModuleWidget)
children magsign_child_components, magsign_add_outputs, magsign_add_inputs
parents magsign_struct, magsign_cpp
file reference codestudy/potential/mag_sign.cpp:31-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

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

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

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

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

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

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 inputs[0], point, clarify, what, and, outputs[0], to

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

rust
content The Rust Code
children mag_sign_process, mag_sign_process_raw, MagSignOutput_struct, MagSignInput_struct

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 magsign_process_inner_loop, call_mag_sign_process_raw, rust
file reference codestudy/potential/mag_sign.rs:58-62

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

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

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

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

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

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

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

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

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

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

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