MCPcopy Create free account
hub / github.com/LabSound/LabSound / process

Method process

src/extended/PWMNode.cpp:41–66  ·  view source on GitHub ↗

Processes the source to destination bus.

Source from the content-addressed store, hash-verified

39
40 // Processes the source to destination bus.
41 virtual void process(ContextRenderLock &,
42 const lab::AudioBus * source, lab::AudioBus * destination,
43 int framesToProcess) override
44 {
45 if (!source->numberOfChannels() || !destination->numberOfChannels())
46 return;
47
48 const float * carrierP = source->channelByType(Channel::Left)->data();
49 const float * modP = source->channelByType(Channel::Right)->data();
50
51 if (!modP && carrierP)
52 {
53 destination->copyFrom(*source);
54 }
55 else if (modP && carrierP)
56 {
57 float * destP = destination->channel(0)->mutableData();
58 int n = framesToProcess;
59 while (n--)
60 {
61 float carrier = *carrierP++;
62 float mod = *modP++;
63 *destP++ = (carrier > mod) ? 1.0f : -1.0f;
64 }
65 }
66 }
67
68 virtual void reset() override {}
69

Callers

nothing calls this directly

Calls 6

channelByTypeMethod · 0.80
mutableDataMethod · 0.80
channelMethod · 0.80
numberOfChannelsMethod · 0.45
dataMethod · 0.45
copyFromMethod · 0.45

Tested by

no test coverage detected