MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Process

Method Process

Source/Metronome.cpp:53–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void Metronome::Process(double time)
54{
55 PROFILER(Metronome);
56
57 IAudioReceiver* target = GetTarget();
58
59 if (!mEnabled || target == nullptr)
60 return;
61
62 int bufferSize = target->GetBuffer()->BufferSize();
63 float* out = target->GetBuffer()->GetChannel(0);
64 assert(bufferSize == gBufferSize);
65
66 for (int i = 0; i < bufferSize; ++i)
67 {
68 float sample = mOsc.Audio(time, mPhase) * mVolume / 10;
69 out[i] += sample;
70 GetVizBuffer()->Write(sample, 0);
71
72 mPhase += mPhaseInc;
73 while (mPhase > FTWO_PI)
74 {
75 mPhase -= FTWO_PI;
76 }
77
78 time += gInvSampleRateMs;
79 }
80}
81
82void Metronome::OnTimeEvent(double time)
83{

Callers

nothing calls this directly

Calls 5

BufferSizeMethod · 0.80
GetBufferMethod · 0.80
GetChannelMethod · 0.80
AudioMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected