| 115 | } |
| 116 | |
| 117 | void NoteChance::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 118 | { |
| 119 | if (!mEnabled) |
| 120 | { |
| 121 | PlayNoteOutput(time, pitch, velocity, voiceIdx, modulation); |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | if (velocity > 0) |
| 126 | ComputeSliders(0); |
| 127 | |
| 128 | float random; |
| 129 | if (mDeterministic) |
| 130 | { |
| 131 | const int kStepResolution = 128; |
| 132 | uint64_t step = int(TheTransport->GetMeasureTime(time) * kStepResolution); |
| 133 | int randomIndex = step % ((mLength * kStepResolution) / TheTransport->GetTimeSigTop()); |
| 134 | random = ((abs(DeterministicRandom(mSeed, randomIndex)) % 10000) / 10000.0f); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | random = ofRandom(1); |
| 139 | } |
| 140 | |
| 141 | bool accept = random <= mChance; |
| 142 | if (accept || velocity == 0) |
| 143 | PlayNoteOutput(time, pitch, velocity, voiceIdx, modulation); |
| 144 | |
| 145 | if (velocity > 0) |
| 146 | { |
| 147 | if (accept) |
| 148 | mLastAcceptTime = time; |
| 149 | else |
| 150 | mLastRejectTime = time; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | void NoteChance::Reseed() |
| 155 | { |
nothing calls this directly
no test coverage detected