| 63 | } |
| 64 | |
| 65 | void FollowingSong::Process(double time) |
| 66 | { |
| 67 | PROFILER(FollowingSong); |
| 68 | |
| 69 | IAudioReceiver* target = GetTarget(); |
| 70 | |
| 71 | if (!mEnabled || target == nullptr) |
| 72 | return; |
| 73 | |
| 74 | ComputeSliders(0); |
| 75 | |
| 76 | int bufferSize = target->GetBuffer()->BufferSize(); |
| 77 | float* out = target->GetBuffer()->GetChannel(0); |
| 78 | assert(bufferSize == gBufferSize); |
| 79 | |
| 80 | float volSq = mVolume * mVolume * .5f; |
| 81 | |
| 82 | if (!mLoadingSong && mPlay) |
| 83 | { |
| 84 | mLoadSongMutex.lock(); |
| 85 | |
| 86 | gWorkChannelBuffer.SetNumActiveChannels(1); |
| 87 | if (mSample.ConsumeData(time, &gWorkChannelBuffer, bufferSize, true)) |
| 88 | { |
| 89 | for (int i = 0; i < bufferSize; ++i) |
| 90 | { |
| 91 | float sample = gWorkChannelBuffer.GetChannel(0)[i] * volSq; |
| 92 | if (mMute) |
| 93 | sample = 0; |
| 94 | out[i] += sample; |
| 95 | GetVizBuffer()->Write(sample, 0); |
| 96 | } |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | GetVizBuffer()->WriteChunk(gZeroBuffer, bufferSize, 0); |
| 101 | } |
| 102 | mLoadSongMutex.unlock(); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | GetVizBuffer()->WriteChunk(gZeroBuffer, bufferSize, 0); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void FollowingSong::DrawModule() |
| 111 | { |
nothing calls this directly
no test coverage detected