| 103 | } |
| 104 | |
| 105 | void UnstablePressure::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 106 | { |
| 107 | if (mEnabled) |
| 108 | { |
| 109 | if (voiceIdx == -1) |
| 110 | { |
| 111 | if (velocity > 0) |
| 112 | { |
| 113 | bool foundVoice = false; |
| 114 | for (size_t i = 0; i < mIsVoiceUsed.size(); ++i) |
| 115 | { |
| 116 | int voiceToCheck = (i + mVoiceRoundRobin) % kNumVoices; |
| 117 | if (mIsVoiceUsed[voiceToCheck] == false) |
| 118 | { |
| 119 | voiceIdx = voiceToCheck; |
| 120 | mVoiceRoundRobin = (mVoiceRoundRobin + 1) % kNumVoices; |
| 121 | foundVoice = true; |
| 122 | break; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | if (!foundVoice) |
| 127 | { |
| 128 | voiceIdx = mVoiceRoundRobin; |
| 129 | mVoiceRoundRobin = (mVoiceRoundRobin + 1) % kNumVoices; |
| 130 | } |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | voiceIdx = mPitchToVoice[pitch]; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | if (voiceIdx < 0 || voiceIdx >= kNumVoices) |
| 139 | voiceIdx = 0; |
| 140 | |
| 141 | mIsVoiceUsed[voiceIdx] = velocity > 0; |
| 142 | mPitchToVoice[pitch] = (velocity > 0) ? voiceIdx : -1; |
| 143 | |
| 144 | mModulation.GetPressure(voiceIdx)->AppendTo(modulation.pressure); |
| 145 | modulation.pressure = mModulation.GetPressure(voiceIdx); |
| 146 | } |
| 147 | |
| 148 | FillModulationBuffer(time, voiceIdx); |
| 149 | PlayNoteOutput(time, pitch, velocity, voiceIdx, modulation); |
| 150 | } |
| 151 | |
| 152 | void UnstablePressure::OnTransportAdvanced(float amount) |
| 153 | { |
nothing calls this directly
no test coverage detected