38 ~Voice() { setAsUnassigned(
nullptr); }
42 std::array<VoiceUnisonPart, kMaxNumVoicesUnison> unisonParts;
46 std::array<VoiceSamplePlaybackGuide, kNumSources> guides;
57 std::array<int32_t, kNumPatchSources> sourceValues;
59 std::bitset<kNumExpressionDimensions> expressionSourcesCurrentlySmoothing;
60 std::bitset<kNumExpressionDimensions> expressionSourcesFinalValueChanged;
61 std::array<int32_t, kNumExpressionDimensions> localExpressionSourceValuesBeforeSmoothing;
63 std::array<Envelope, kNumEnvelopes> envelopes;
70 std::array<int32_t, 2> inputCharacteristics;
71 int32_t noteCodeAfterArpeggiation;
73 uint32_t portaEnvelopePos;
74 int32_t portaEnvelopeMaxAmplitude;
76 std::array<uint32_t, 2> lastSaturationTanHWorkingValue;
78 int32_t overallOscAmplitudeLastTime;
79 std::array<int32_t, kNumSources> sourceAmplitudesLastTime;
80 std::array<int32_t, kNumModulators> modulatorAmplitudeLastTime;
81 std::array<uint32_t, kNumSources> sourceWaveIndexesLastTime;
83 int32_t filterGainLastTime;
85 bool previouslyIgnoredNoteOff;
87 uint32_t orderSounded;
89 int32_t overrideAmplitudeEnvelopeReleaseRate;
91 bool justCreated{
false};
96 bool soundRenderingInStereo,
bool applyingPanAtVoiceLevel, uint32_t sourcesChanged,
bool doLPF,
97 bool doHPF, int32_t externalPitchAdjust);
102 int32_t newNoteCodeAfterArpeggiation, uint8_t velocity, uint32_t newSampleSyncLength, int32_t ticksLate,
103 uint32_t samplesLate,
bool resetEnvelopes, int32_t fromMIDIChannel,
const int16_t* mpeValues);
106 void randomizeOscPhases(
const Sound& sound);
108 int32_t newNoteCodeAfterArpeggiation, int32_t newInputMIDIChannel,
const int16_t* newMPEValues);
109 bool hasReleaseStage();
110 void unassignStuff(
bool deletingSong);
111 [[nodiscard]] uint32_t getPriorityRating()
const;
112 void expressionEventImmediate(
const Sound& sound, int32_t voiceLevelValue, int32_t s);
113 void expressionEventSmooth(int32_t newValue, int32_t s);
126 return envelopes[0].state >= EnvelopeStage::FAST_RELEASE
127 && envelopes[0].fastReleaseIncrement >= SOFT_CULL_INCREMENT;
130 bool speedUpRelease(uint32_t minFastReleaseIncrement = SOFT_CULL_INCREMENT);
131 bool shouldBeDeleted() {
return delete_this_voice_; }
134 [[nodiscard]] std::strong_ordering operator<=>(
const Voice& other)
const {
135 return this->getPriorityRating() <=> other.getPriorityRating();
141 bool delete_this_voice_{
false};
143 void renderBasicSource(Sound& sound, ParamManagerForTimeline* paramManager, int32_t s, int32_t* oscBuffer,
144 int32_t numSamples,
bool stereoBuffer, int32_t sourceAmplitude,
145 bool* unisonPartBecameInactive, int32_t overallPitchAdjust,
bool doOscSync,
146 uint32_t* oscSyncPos, uint32_t* oscSyncPhaseIncrements, int32_t amplitudeIncrement,
147 uint32_t* getPhaseIncrements,
bool getOutAfterPhaseIncrements, int32_t waveIndexIncrement);
148 static bool adjustPitch(uint32_t& phaseIncrement, int32_t adjustment);
150 void renderSineWaveWithFeedback(int32_t* thisSample, int32_t numSamples, uint32_t* phase, int32_t amplitude,
151 uint32_t phaseIncrement, int32_t feedbackAmount, int32_t* lastFeedbackValue,
152 bool add, int32_t amplitudeIncrement);
153 void renderFMWithFeedback(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
154 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
155 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
156 void renderFMWithFeedbackAdd(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
157 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
158 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
159 bool areAllUnisonPartsInactive(ModelStackWithSoundFlags& modelStack)
const;
160 void setupPorta(
const Sound& sound);
161 int32_t combineExpressionValues(
const Sound& sound, int32_t expressionDimension)
const;