37 ~Voice() { setAsUnassigned(
nullptr); }
41 std::array<VoiceUnisonPart, kMaxNumVoicesUnison> unisonParts;
45 std::array<VoiceSamplePlaybackGuide, kNumSources> guides;
56 std::array<int32_t, kNumPatchSources> sourceValues;
58 std::bitset<kNumExpressionDimensions> expressionSourcesCurrentlySmoothing;
59 std::bitset<kNumExpressionDimensions> expressionSourcesFinalValueChanged;
60 std::array<int32_t, kNumExpressionDimensions> localExpressionSourceValuesBeforeSmoothing;
62 std::array<Envelope, kNumEnvelopes> envelopes;
69 std::array<int32_t, 2> inputCharacteristics;
70 int32_t noteCodeAfterArpeggiation;
72 uint32_t portaEnvelopePos;
73 int32_t portaEnvelopeMaxAmplitude;
75 std::array<uint32_t, 2> lastSaturationTanHWorkingValue;
77 int32_t overallOscAmplitudeLastTime;
78 std::array<int32_t, kNumSources> sourceAmplitudesLastTime;
79 std::array<int32_t, kNumModulators> modulatorAmplitudeLastTime;
80 std::array<uint32_t, kNumSources> sourceWaveIndexesLastTime;
82 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);
123 bool forceNormalRelease();
125 bool speedUpRelease();
128 [[nodiscard]] std::strong_ordering operator<=>(
const Voice& other)
const {
129 return this->getPriorityRating() <=> other.getPriorityRating();
136 void renderBasicSource(Sound& sound, ParamManagerForTimeline* paramManager, int32_t s, int32_t* oscBuffer,
137 int32_t numSamples,
bool stereoBuffer, int32_t sourceAmplitude,
138 bool* unisonPartBecameInactive, int32_t overallPitchAdjust,
bool doOscSync,
139 uint32_t* oscSyncPos, uint32_t* oscSyncPhaseIncrements, int32_t amplitudeIncrement,
140 uint32_t* getPhaseIncrements,
bool getOutAfterPhaseIncrements, int32_t waveIndexIncrement);
141 static bool adjustPitch(uint32_t& phaseIncrement, int32_t adjustment);
143 void renderSineWaveWithFeedback(int32_t* thisSample, int32_t numSamples, uint32_t* phase, int32_t amplitude,
144 uint32_t phaseIncrement, int32_t feedbackAmount, int32_t* lastFeedbackValue,
145 bool add, int32_t amplitudeIncrement);
146 void renderFMWithFeedback(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
147 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
148 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
149 void renderFMWithFeedbackAdd(int32_t* thisSample, int32_t numSamples, int32_t* fmBuffer, uint32_t* phase,
150 int32_t amplitude, uint32_t phaseIncrement, int32_t feedbackAmount,
151 int32_t* lastFeedbackValue, int32_t amplitudeIncrement);
152 bool areAllUnisonPartsInactive(ModelStackWithSoundFlags& modelStack)
const;
153 void setupPorta(
const Sound& sound);
154 int32_t combineExpressionValues(
const Sound& sound, int32_t expressionDimension)
const;