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 init_entry_point, header_file_looks_like_boilerplate, magsign_cpp

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_struct, magsign_model_creation
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_constructor, magsign_processor, magsign_widget (the other struct), magsign_enums
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_add_inputs, magsign_add_outputs, magsign_child_components
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 add_model_magsign, magsign_cpp
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_widget, magsign_add_inputs
file reference codestudy/potential/mag_sign.cpp:52-57

magsign_process_inner_loop
content inner loop of the MagSign Processor
children get_inputs_outputs, call_mag_sign_process_raw, mag_sign_process_raw (very similar structure)
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 and, point, what, to, clarify, outputs[0], inputs[0]

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 MagSignInput_struct, mag_sign_process_raw, MagSignOutput_struct, mag_sign_process

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

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 RackInput_MagSignInput, MagSignOutput_struct (related struct)
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 lower_half_processing (done after upper half), method_chaining_bipolar
parents mag_sign_process
file reference codestudy/potential/mag_sign.rs:6-25

lower_half_processing
content Lower half processing: decomposition
parents upper_half_processing, mag_sign_process
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 bipolar_zip, rust/std_iter
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 rust/std_iter_zip, bipolar_for_each
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