| 90 | } |
| 91 | |
| 92 | void KarplusStrong::Process(double time) |
| 93 | { |
| 94 | PROFILER(KarplusStrong); |
| 95 | |
| 96 | IAudioReceiver* target = GetTarget(); |
| 97 | |
| 98 | if (!mEnabled || target == nullptr) |
| 99 | return; |
| 100 | |
| 101 | SyncBuffers(mWriteBuffer.NumActiveChannels()); |
| 102 | |
| 103 | mNoteInputBuffer.Process(time); |
| 104 | |
| 105 | ComputeSliders(0); |
| 106 | |
| 107 | int bufferSize = target->GetBuffer()->BufferSize(); |
| 108 | assert(bufferSize == gBufferSize); |
| 109 | |
| 110 | mWriteBuffer.Clear(); |
| 111 | mPolyMgr.Process(time, &mWriteBuffer, bufferSize); |
| 112 | |
| 113 | for (int ch = 0; ch < mWriteBuffer.NumActiveChannels(); ++ch) |
| 114 | { |
| 115 | Mult(mWriteBuffer.GetChannel(ch), mVolume, bufferSize); |
| 116 | if (!mVoiceParams.mInvert) //unnecessary if inversion is eliminating dc offset |
| 117 | mDCRemover[ch].Filter(mWriteBuffer.GetChannel(ch), bufferSize); |
| 118 | } |
| 119 | |
| 120 | mBiquad.ProcessAudio(time, &mWriteBuffer); |
| 121 | |
| 122 | for (int ch = 0; ch < mWriteBuffer.NumActiveChannels(); ++ch) |
| 123 | { |
| 124 | GetVizBuffer()->WriteChunk(mWriteBuffer.GetChannel(ch), mWriteBuffer.BufferSize(), ch); |
| 125 | Add(target->GetBuffer()->GetChannel(ch), mWriteBuffer.GetChannel(ch), gBufferSize); |
| 126 | } |
| 127 | |
| 128 | GetBuffer()->Reset(); |
| 129 | } |
| 130 | |
| 131 | void KarplusStrong::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 132 | { |
nothing calls this directly
no test coverage detected