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;
86 bool previouslyIgnoredNoteOff;
88 uint32_t orderSounded;
90 int32_t overrideAmplitudeEnvelopeReleaseRate;
92 bool justCreated{
false};
97 bool soundRenderingInStereo,
bool applyingPanAtVoiceLevel, uint32_t sourcesChanged,
bool doLPF,
98 bool doHPF, int32_t externalPitchAdjust);
103 int32_t newNoteCodeAfterArpeggiation, uint8_t velocity, uint32_t newSampleSyncLength, int32_t ticksLate,
104 uint32_t samplesLate,
bool resetEnvelopes, int32_t fromMIDIChannel,
const int16_t* mpeValues);
107 void randomizeOscPhases(
const Sound& sound);
109 int32_t newNoteCodeAfterArpeggiation, int32_t newInputMIDIChannel,
const int16_t* newMPEValues);
110 bool hasReleaseStage();
111 void unassignStuff(
bool deletingSong);
112 [[nodiscard]] uint32_t getPriorityRating()
const;
113 void expressionEventImmediate(
const Sound& sound, int32_t voiceLevelValue, int32_t s);
114 void expressionEventSmooth(int32_t newValue, int32_t s);
124 bool forceNormalRelease();
126 bool speedUpRelease();
129 [[nodiscard]] std::strong_ordering operator<=>(
const Voice& other)
const {
130 return this->getPriorityRating() <=> other.getPriorityRating();
137 void renderBasicSource(Sound& sound, ParamManagerForTimeline* paramManager, int32_t s, int32_t* oscBuffer,
138 int32_t numSamples,
bool stereoBuffer, int32_t sourceAmplitude,
139 bool* unisonPartBecameInactive, int32_t overallPitchAdjust,
bool doOscSync,
140 uint32_t* oscSyncPos, uint32_t* oscSyncPhaseIncrements, int32_t amplitudeIncrement,
141 uint32_t* getPhaseIncrements,
bool getOutAfterPhaseIncrements, int32_t waveIndexIncrement);
142 static bool adjustPitch(uint32_t& phaseIncrement, int32_t adjustment);
144 void renderSineWaveWithFeedback(int32_t* thisSample, int32_t numSamples, uint32_t* phase, int32_t amplitude,
145 uint32_t phaseIncrement, int32_t feedbackAmount, int32_t* lastFeedbackValue,
146 bool add, int32_t amplitudeIncrement);
147 void renderFMWithFeedback(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
148 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
149 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
150 void renderFMWithFeedbackAdd(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
151 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
152 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
153 bool areAllUnisonPartsInactive(ModelStackWithSoundFlags& modelStack)
const;
154 void setupPorta(
const Sound& sound);
155 int32_t combineExpressionValues(
const Sound& sound, int32_t expressionDimension)
const;