| 102 | } |
| 103 | |
| 104 | void EQModule::Process(double time) |
| 105 | { |
| 106 | PROFILER(EQModule); |
| 107 | |
| 108 | if (mLiteCpuModulation) |
| 109 | { |
| 110 | ComputeSliders(0); |
| 111 | |
| 112 | for (auto& filter : mFilters) |
| 113 | { |
| 114 | if (filter.mEnabled) |
| 115 | { |
| 116 | bool updated = filter.UpdateCoefficientsIfNecessary(); |
| 117 | if (updated) |
| 118 | mNeedToUpdateFrequencyResponseGraph = true; |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | IAudioReceiver* target = GetTarget(); |
| 124 | |
| 125 | if (target == nullptr) |
| 126 | return; |
| 127 | |
| 128 | SyncBuffers(); |
| 129 | |
| 130 | if (mEnabled) |
| 131 | { |
| 132 | Clear(gWorkBuffer, GetBuffer()->BufferSize()); |
| 133 | |
| 134 | ChannelBuffer* out = target->GetBuffer(); |
| 135 | gWorkChannelBuffer.SetNumActiveChannels(out->NumActiveChannels()); |
| 136 | |
| 137 | if (!mLiteCpuModulation) //should we try to recalculate filters every sample? |
| 138 | { |
| 139 | for (int i = 0; i < GetBuffer()->BufferSize(); ++i) |
| 140 | { |
| 141 | ComputeSliders(i); |
| 142 | |
| 143 | for (auto& filter : mFilters) |
| 144 | { |
| 145 | if (filter.mEnabled) |
| 146 | { |
| 147 | bool updated = filter.UpdateCoefficientsIfNecessary(); |
| 148 | if (updated) |
| 149 | mNeedToUpdateFrequencyResponseGraph = true; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch) |
| 154 | { |
| 155 | float sample = GetBuffer()->GetChannel(ch)[i]; |
| 156 | for (auto& filter : mFilters) |
| 157 | { |
| 158 | if (filter.mEnabled) |
| 159 | sample = filter.mFilter[ch].Filter(sample); |
| 160 | } |
| 161 | gWorkChannelBuffer.GetChannel(ch)[i] = sample; |
nothing calls this directly
no test coverage detected