Skip to content

Commit 690dcfd

Browse files
author
Nathan Ho
committed
more work on comments
1 parent af7f5c4 commit 690dcfd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

01-BoringMixer/BoringMixer.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,38 @@ static InterfaceTable *ft;
55

66
// declare struct to hold unit generator state
77
struct BoringMixer : public Unit {
8-
// this is blank because this particular ugen is stateless.
9-
// in more advanced examples we'll have stuff here.
8+
// in later examples, we will declare state variables here.
109
};
1110

12-
// in some older plugins these function declarations are wrapped in 'extern "C" { ... }'
11+
// older plugins wrap these function declarations in 'extern "C" { ... }'
1312
// no need to do that these days.
1413
static void BoringMixer_next(BoringMixer* unit, int inNumSamples);
1514
static void BoringMixer_Ctor(BoringMixer* unit);
1615

1716
// the constructor function is called when a Synth containing this ugen is played.
18-
// it MUST be named PluginName_Ctor.
19-
// in later examples, this function will initialize state variables.
17+
// it MUST be named "PluginName_Ctor", and the argument must be "unit."
2018
void BoringMixer_Ctor(BoringMixer* unit) {
21-
// set a calculation function.
22-
// in later examples, we will have multiple calculation functions depending on input and output rates.
19+
// in later examples, we will initialize state variables here.
20+
21+
// set a calculation function. for now, we only have one calculation function.
2322
SETCALC(BoringMixer_next);
2423
// calculate one sample of output.
2524
// this allows plugging into other ugens with initial-rate inputs
2625
BoringMixer_next(unit, 1);
2726
}
2827

29-
// the calculation function can have any name, but this is conventional.
28+
// the calculation function can have any name, but this is conventional. the first argument must be "unit."
3029
// this function is called every control period (64 samples is typical)
30+
// Don't change the names of the arguments, or the helper macros won't work.
3131
void BoringMixer_next(BoringMixer* unit, int inNumSamples) {
3232

3333
// IN and OUT are helper macros that return audio-rate input and output buffers.
34-
// in SC source code, these buffers are often called "wire bufs" since they are how ugens communicate.
34+
// In old ugens you'll see ZIN and ZOUT, which are not recommended.
3535
float *left = IN(0); // first input
3636
float *right = IN(1); // second input
3737
float *out = OUT(0); // first output
3838

39-
// loop through samples
39+
// Loop through samples and do the computation.
4040
for (int i = 0; i < inNumSamples; i++) {
4141
out[i] = (left[i] + right[i]) * 0.5;
4242
}

0 commit comments

Comments
 (0)