Deluge Firmware 1.3.0
Build date: 2025.09.12
Loading...
Searching...
No Matches
Sound Class Referenceabstract
Inheritance diagram for Sound:
Collaboration diagram for Sound:

Public Types

using ActiveVoice = AudioEngine::VoicePool::pointer_type

Public Member Functions

virtual ArpeggiatorSettingsgetArpSettings (InstrumentClip *clip=nullptr)=0
virtual void setSkippingRendering (bool newSkipping)
ModFXType getModFXType () override
bool setModFXType (ModFXType newType) final
void patchedParamPresetValueChanged (uint8_t p, ModelStackWithSoundFlags *modelStack, int32_t oldValue, int32_t newValue)
void render (ModelStackWithThreeMainThings *modelStack, deluge::dsp::StereoBuffer< q31_t > output, int32_t *reverbBuffer, int32_t sideChainHitPending, int32_t reverbAmountAdjust=134217728, bool shouldLimitDelayFeedback=false, int32_t pitchAdjust=kMaxSampleValue, SampleRecorder *recorder=nullptr)
void ensureInaccessibleParamPresetValuesWithoutKnobsAreZero (Song *song) final
void ensureInaccessibleParamPresetValuesWithoutKnobsAreZero (ModelStackWithThreeMainThings *modelStack)
void ensureInaccessibleParamPresetValuesWithoutKnobsAreZeroWithMinimalDetails (ParamManager *paramManager)
void ensureParamPresetValueWithoutKnobIsZero (ModelStackWithAutoParam *modelStack)
void ensureParamPresetValueWithoutKnobIsZeroWithMinimalDetails (ParamManager *paramManager, int32_t p)
PatchCableAcceptance maySourcePatchToParam (PatchSource s, uint8_t p, ParamManager *paramManager)
void resyncGlobalLFOs ()
int8_t getKnobPos (uint8_t p, ParamManagerForTimeline *paramManager, uint32_t timePos, TimelineCounter *counter)
int32_t getKnobPosBig (int32_t p, ParamManagerForTimeline *paramManager, uint32_t timePos, TimelineCounter *counter)
bool learnKnob (MIDICable *cable, ParamDescriptor paramDescriptor, uint8_t whichKnob, uint8_t modKnobMode, uint8_t midiChannel, Song *song) final
bool hasFilters ()
void sampleZoneChanged (MarkerType markerType, int32_t s, ModelStackWithSoundFlags *modelStack)
void setNumUnison (int32_t newNum, ModelStackWithSoundFlags *modelStack)
void setUnisonDetune (int32_t newAmount, ModelStackWithSoundFlags *modelStack)
void setUnisonStereoSpread (int32_t newAmount)
void setModulatorTranspose (int32_t m, int32_t value, ModelStackWithSoundFlags *modelStack)
void setModulatorCents (int32_t m, int32_t value, ModelStackWithSoundFlags *modelStack)
Error readFromFile (Deserializer &reader, ModelStackWithModControllable *modelStack, int32_t readAutomationUpToPos, ArpeggiatorSettings *arpSettings)
void writeToFile (Serializer &writer, bool savingSong, ParamManager *paramManager, ArpeggiatorSettings *arpSettings, const char *pathAttribute=NULL)
void voiceUnassigned (ModelStackWithSoundFlags *modelStack)
bool isSourceActiveCurrently (int32_t s, ParamManagerForTimeline *paramManager)
bool isSourceActiveEverDisregardingMissingSample (int32_t s, ParamManager *paramManager)
bool isSourceActiveEver (int32_t s, ParamManager *paramManager)
bool isNoiseActiveEver (ParamManagerForTimeline *paramManager)
void noteOn (ModelStackWithThreeMainThings *modelStack, ArpeggiatorBase *arpeggiator, int32_t noteCode, int16_t const *mpeValues, uint32_t sampleSyncLength=0, int32_t ticksLate=0, uint32_t samplesLate=0, int32_t velocity=64, int32_t fromMIDIChannel=16)
void noteOff (ModelStackWithThreeMainThings *modelStack, ArpeggiatorBase *arpeggiator, int32_t noteCode)
void allNotesOff (ModelStackWithThreeMainThings *modelStack, ArpeggiatorBase *arpeggiator)
void noteOffPostArpeggiator (ModelStackWithSoundFlags *modelStack, int32_t noteCode=-32768)
void noteOnPostArpeggiator (ModelStackWithSoundFlags *modelStack, int32_t newNoteCodeBeforeArpeggiation, int32_t newNoteCodeAfterArpeggiation, int32_t velocity, int16_t const *mpeValues, uint32_t sampleSyncLength, int32_t ticksLate, uint32_t samplesLate, int32_t fromMIDIChannel=16)
void polyphonicExpressionEventOnChannelOrNote (int32_t newValue, int32_t expressionDimension, int32_t channelOrNoteNumber, MIDICharacteristic whichCharacteristic) override
int16_t getMaxOscTranspose (InstrumentClip *clip)
int16_t getMinOscTranspose ()
void setSynthMode (SynthMode value, Song *song)
SynthMode getSynthMode () const
virtual bool isDrum ()
void setupAsSample (ParamManagerForTimeline *paramManager)
void recalculateAllVoicePhaseIncrements (ModelStackWithSoundFlags *modelStack)
Error loadAllAudioFiles (bool mayActuallyReadFiles)
bool envelopeHasSustainCurrently (int32_t e, ParamManagerForTimeline *paramManager)
bool envelopeHasSustainEver (int32_t e, ParamManagerForTimeline *paramManager)
bool renderingOscillatorSyncCurrently (ParamManagerForTimeline *paramManager)
bool renderingOscillatorSyncEver (ParamManager *paramManager)
void setupAsBlankSynth (ParamManager *paramManager, bool is_dx=false)
void setupAsDefaultSynth (ParamManager *paramManager)
void modButtonAction (uint8_t whichModButton, bool on, ParamManagerForTimeline *paramManager) final
bool modEncoderButtonAction (uint8_t whichModEncoder, bool on, ModelStackWithThreeMainThings *modelStack) final
int32_t hasAnyTimeStretchSyncing (ParamManagerForTimeline *paramManager, bool getSampleLength=false, int32_t note=0)
int32_t hasCutOrLoopModeSamples (ParamManagerForTimeline *paramManager, int32_t note, bool *anyLooping=nullptr)
bool hasCutModeSamples (ParamManagerForTimeline *paramManager)
bool allowsVeryLateNoteStart (InstrumentClip *clip, ParamManagerForTimeline *paramManager)
void fastReleaseAllVoices (ModelStackWithSoundFlags *modelStack)
void recalculatePatchingToParam (uint8_t p, ParamManagerForTimeline *paramManager)
void doneReadingFromFile ()
virtual void setupPatchingForAllParamManagers (Song *song)
void compensateVolumeForResonance (ModelStackWithThreeMainThings *modelStack)
ModelStackWithAutoParamgetParamFromModEncoder (int32_t whichModEncoder, ModelStackWithThreeMainThings *modelStack, bool allowCreation=true) final
void reassessRenderSkippingStatus (ModelStackWithSoundFlags *modelStack, bool shouldJustCutModFX=false)
void getThingWithMostReverb (Sound **soundWithMostReverb, ParamManager **paramManagerWithMostReverb, GlobalEffectableForClip **globalEffectableWithMostReverb, int32_t *highestReverbAmountFound, ParamManagerForTimeline *paramManager)
virtual bool readTagFromFile (Deserializer &reader, char const *tagName)=0
void detachSourcesFromAudioFiles ()
int32_t getSmoothedPatchedParamValue (int32_t p, ParamManager &paramManager) const
void notifyValueChangeViaLPF (int32_t p, bool shouldDoParamLPF, ModelStackWithThreeMainThings const *modelStack, int32_t oldValue, int32_t newValue, bool fromAutomation)
void deleteMultiRange (int32_t s, int32_t r)
void wontBeRenderedForAWhile () override
ModelStackWithAutoParamgetParamFromMIDIKnob (MIDIKnob &knob, ModelStackWithThreeMainThings *modelStack) final
 Check that autoParam isn't NULL, after calling this.
virtual ArpeggiatorBasegetArp ()=0
void possiblySetupDefaultExpressionPatching (ParamManager *paramManager)
void saturate (int32_t *data, uint32_t *workingValue)
uint32_t getSyncedLFOPhaseIncrement (const LFOConfig &config)
bool hasActiveVoices () const override
 Does this sound have any active voices?
size_t numActiveVoices () const
 Get the number of active voices.
void killAllVoices () override
 Immediately ends all active voices.
const ActiveVoice & getLowestPriorityVoice () const
 Get the voice with the lowest priority.
const deluge::fast_vector< ActiveVoice > & voices () const
 Get the voices for this sound.
void freeActiveVoice (const ActiveVoice &voice, ModelStackWithSoundFlags *modelStack=nullptr, bool erase=true)
 Releases a given voice from the Sound.
bool anyNoteIsOn () override
bool allowNoteTails (ModelStackWithSoundFlags *modelStack, bool disregardSampleLoop=false) override
void prepareForHibernation () override
Public Member Functions inherited from ModControllableAudio
virtual void cloneFrom (ModControllableAudio *other)
void processStutter (deluge::dsp::StereoBuffer< q31_t > buffer, ParamManager *paramManager)
void processReverbSendAndVolume (deluge::dsp::StereoBuffer< q31_t > buffer, int32_t *reverbBuffer, int32_t postFXVolume, int32_t postReverbVolume, int32_t reverbSendAmount, int32_t pan=0, bool doAmplitudeIncrement=false)
void writeAttributesToFile (Serializer &writer)
void writeTagsToFile (Serializer &writer)
virtual Error readTagFromFile (Deserializer &reader, char const *tagName, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos, ArpeggiatorSettings *arpSettings, Song *song)
void processSRRAndBitcrushing (deluge::dsp::StereoBuffer< q31_t > buffer, int32_t *postFXVolume, ParamManager *paramManager)
void beginStutter (ParamManagerForTimeline *paramManager)
void endStutter (ParamManagerForTimeline *paramManager)
bool offerReceivedCCToLearnedParamsForClip (MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t value, ModelStackWithTimelineCounter *modelStack, int32_t noteRowIndex=-1)
bool offerReceivedCCToLearnedParamsForSong (MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t value, ModelStackWithThreeMainThings *modelStackWithThreeMainThings)
bool offerReceivedPitchBendToLearnedParams (MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, ModelStackWithTimelineCounter *modelStack, int32_t noteRowIndex=-1)
bool unlearnKnobs (ParamDescriptor paramDescriptor, Song *song)
bool isBitcrushingEnabled (ParamManager *paramManager)
bool isSRREnabled (ParamManager *paramManager)
bool hasBassAdjusted (ParamManager *paramManager)
bool hasTrebleAdjusted (ParamManager *paramManager)
Public Member Functions inherited from ModControllable
virtual uint8_t * getModKnobMode ()
virtual bool isKit ()
virtual bool isSong ()
virtual bool isEditingComp ()
virtual bool valueChangedEnoughToMatter (int32_t old_value, int32_t new_value, deluge::modulation::params::Kind kind, uint32_t paramID)
virtual int32_t getKnobPosForNonExistentParam (int32_t whichModEncoder, ModelStackWithAutoParam *modelStack)
virtual ActionResult modEncoderActionForNonExistentParam (int32_t offset, int32_t whichModEncoder, ModelStackWithAutoParam *modelStack)
virtual void monophonicExpressionEvent (int32_t newValue, int32_t expressionDimension)

Static Public Member Functions

static void writeParamsToFile (Serializer &writer, ParamManager *paramManager, bool writeAutomation)
static void readParamsFromFile (Deserializer &reader, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos)
static bool readParamTagFromFile (Deserializer &reader, char const *tagName, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos)
static void initParams (ParamManager *paramManager)
static Error createParamManagerForLoading (ParamManagerForTimeline *paramManager)
Static Public Member Functions inherited from ModControllableAudio
static void writeParamAttributesToFile (Serializer &writer, ParamManager *paramManager, bool writeAutomation, int32_t *valuesForOverride=nullptr)
static void writeParamTagsToFile (Serializer &writer, ParamManager *paramManager, bool writeAutomation, int32_t *valuesForOverride=nullptr)
static bool readParamTagFromFile (Deserializer &reader, char const *tagName, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos)
static void initParams (ParamManager *paramManager)

Public Attributes

Patcher patcher
ParamLPF paramLPF {}
Source sources [kNumSources]
std::array< int32_t, deluge::modulation::params::kNumParams - deluge::modulation::params::FIRST_GLOBAL > paramFinalValues {}
std::array< int32_t, util::to_underlying(kFirstLocalSource)> globalSourceValues {}
uint32_t sourcesChanged {}
LFO globalLFO1
LFO globalLFO3
LFOConfig lfoConfig [LFO_COUNT]
bool invertReversed {}
ModKnob modKnobs [kNumModButtons][kNumPhysicalModKnobs]
int32_t sideChainSendLevel = 0
PolyphonyMode polyphonic = PolyphonyMode::POLY
uint8_t maxVoiceCount = 8
int16_t transpose = 0
uint8_t numUnison = 1
int8_t unisonDetune = 8
uint8_t unisonStereoSpread = 0
uint8_t outputMidiChannel = MIDI_CHANNEL_NONE
uint8_t outputMidiNoteForDrum = MIDI_NOTE_NONE
int16_t modulatorTranspose [kNumModulators] = {0, -12}
int8_t modulatorCents [kNumModulators] = {0, 0}
PhaseIncrementFineTuner modulatorTransposers [kNumModulators]
PhaseIncrementFineTuner unisonDetuners [kMaxNumVoicesUnison]
int32_t unisonPan [kMaxNumVoicesUnison] {}
SynthMode synthMode = SynthMode::SUBTRACTIVE
bool modulator1ToModulator0 = false
int32_t volumeNeutralValueForUnison {0}
int32_t lastNoteCode = std::numeric_limits<int32_t>::min()
bool oscillatorSync = false
VoicePriority voicePriority = VoicePriority::MEDIUM
bool skippingRendering = true
std::bitset< kNumExpressionDimensions > expressionSourcesChangedAtSynthLevel {0}
std::array< int32_t, kNumExpressionDimensions > monophonicExpressionValues {}
std::array< uint32_t, kNumSources > oscRetriggerPhase {}
std::array< uint32_t, kNumModulators > modulatorRetriggerPhase {}
uint32_t timeStartedSkippingRenderingModFX {0}
uint32_t timeStartedSkippingRenderingLFO {0}
uint32_t timeStartedSkippingRenderingArp {0}
uint32_t startSkippingRenderingAtTime = 0
Public Attributes inherited from ModControllableAudio
int32_t bassFreq {}
int32_t trebleFreq {}
int32_t withoutTrebleL
int32_t bassOnlyL
int32_t withoutTrebleR
int32_t bassOnlyR
deluge::dsp::Delay delay
StutterConfig stutterConfig
bool sampleRateReductionOnLastTime
uint8_t clippingAmount
FilterMode lpfMode
FilterMode hpfMode
FilterRoute filterRoute
ModFXType modFXType_
ModFXProcessor modfx {}
deluge::dsp::RMSFeedbackCompressor compressor
deluge::dsp::GranularProcessorgrainFX {nullptr}
uint32_t lowSampleRatePos {}
uint32_t highSampleRatePos {}
deluge::dsp::StereoSample< q31_t > lastSample
deluge::dsp::StereoSample< q31_t > grabbedSample
deluge::dsp::StereoSample< q31_t > lastGrabbedSample
SideChain sidechain
deluge::fast_vector< MIDIKnobmidi_knobs
int32_t postReverbVolumeLastTime {}

Private Member Functions

uint32_t getGlobalLFOPhaseIncrement (LFO_ID lfoId, deluge::modulation::params::Global param)
void recalculateModulatorTransposer (uint8_t m, ModelStackWithSoundFlags *modelStack)
void setupUnisonDetuners (ModelStackWithSoundFlags *modelStack)
void setupUnisonStereoSpread ()
void calculateEffectiveVolume ()
void ensureKnobReferencesCorrectVolume (Knob &knob)
Error readTagFromFileOrError (Deserializer &reader, char const *tagName, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos, ArpeggiatorSettings *arpSettings, Song *song)
void writeSourceToFile (Serializer &writer, int32_t s, char const *tagName)
Error readSourceFromFile (Deserializer &reader, int32_t s, ParamManagerForTimeline *paramManager, int32_t readAutomationUpToPos)
void stopSkippingRendering (ArpeggiatorSettings *arpSettings)
void startSkippingRendering (ModelStackWithSoundFlags *modelStack)
void getArpBackInTimeAfterSkippingRendering (ArpeggiatorSettings *arpSettings)
void doParamLPF (int32_t numSamples, ModelStackWithSoundFlags *modelStack)
void stopParamLPF (ModelStackWithSoundFlags *modelStack)
bool renderingVoicesInStereo (ModelStackWithSoundFlags *modelStack)
void setupDefaultExpressionPatching (ParamManager *paramManager)
void pushSwitchActionOnEncoderForParam (int32_t p, bool on, ModelStackWithThreeMainThings *modelStack)
ModelStackWithAutoParamgetParamFromModEncoderDeeper (int32_t whichModEncoder, ModelStackWithThreeMainThings *modelStack, bool allowCreation=true)
const ActiveVoice & acquireVoice () noexcept(false)
 Acquire a voice for use by a note Internally this will either acquire a new voice or steal an existing one.
void checkVoiceExists (const ActiveVoice &voice, const char *error) const
 Check if a voice exists in the list of active voices.
const ActiveVoice & stealOneActiveVoice ()
 Steals a currently-in-use voice for use by another note.
void terminateOneActiveVoice ()
 Force a voice to release very quickly - will be almost instant but click-free.
void forceReleaseOneActiveVoice ()
 Force a voice to release, or speed up its release if it's already releasing.

Private Attributes

deluge::fast_vector< ActiveVoice > voices_
 the list of active voices for this sound

Additional Inherited Members

Protected Member Functions inherited from ModControllableAudio
void processFX (deluge::dsp::StereoBuffer< q31_t > buffer, ModFXType modFXType, int32_t modFXRate, int32_t modFXDepth, const deluge::dsp::Delay::State &delayWorkingState, int32_t *postFXVolume, ParamManager *paramManager, bool anySoundComingIn, q31_t reverbSendAmount)
void switchDelayPingPong ()
void switchDelayAnalog ()
void switchDelaySyncType ()
void switchDelaySyncLevel ()
void switchLPFMode ()
void switchHPFMode ()
void clearModFXMemory ()
char const * getFilterTypeDisplayName (FilterType currentFilterType)
char const * getFilterModeDisplayName (FilterType currentFilterType)
char const * getLPFModeDisplayName ()
char const * getHPFModeDisplayName ()
char const * getDelayTypeDisplayName ()
char const * getDelayPingPongStatusDisplayName ()
char const * getDelaySyncTypeDisplayName ()
void getDelaySyncLevelDisplayName (char *displayName)
char const * getSidechainDisplayName ()
void displayFilterSettings (bool on, FilterType currentFilterType)
void displayDelaySettings (bool on)
void displaySidechainAndReverbSettings (bool on)
void displayOtherModKnobSettings (uint8_t whichModButton, bool on)
 displays names of parameters assigned to gold knobs
bool enableGrain ()
void disableGrain ()
Protected Attributes inherited from ModControllableAudio
deluge::modulation::params::Kind unpatchedParamKind_
Protected Attributes inherited from ModControllable
deluge::modulation::params::Kind unpatchedParamKind_

Member Function Documentation

◆ acquireVoice()

const Sound::ActiveVoice & Sound::acquireVoice ( )
private

Acquire a voice for use by a note Internally this will either acquire a new voice or steal an existing one.

Returns
The acquired voice

◆ allowNoteTails()

bool Sound::allowNoteTails ( ModelStackWithSoundFlags * modelStack,
bool disregardSampleLoop = false )
overridevirtual

Reimplemented from ModControllable.

◆ anyNoteIsOn()

bool Sound::anyNoteIsOn ( )
overridevirtual

Implements Voiced.

◆ ensureInaccessibleParamPresetValuesWithoutKnobsAreZero()

void Sound::ensureInaccessibleParamPresetValuesWithoutKnobsAreZero ( Song * song)
finalvirtual

Reimplemented from ModControllableAudio.

◆ freeActiveVoice()

void Sound::freeActiveVoice ( const ActiveVoice & voice,
ModelStackWithSoundFlags * modelStack = nullptr,
bool erase = true )

Releases a given voice from the Sound.

Parameters
voiceThe voice to release
modelStackThe model stack to use for the release
eraseWhether to erase the voice from the list of active voices (default: true)

◆ getLowestPriorityVoice()

const Sound::ActiveVoice & Sound::getLowestPriorityVoice ( ) const
nodiscard

Get the voice with the lowest priority.

Returns
The voice with the lowest priority

◆ getModFXType()

ModFXType Sound::getModFXType ( )
overridevirtual

Implements ModControllableAudio.

◆ getParamFromMIDIKnob()

ModelStackWithAutoParam * Sound::getParamFromMIDIKnob ( MIDIKnob & knob,
ModelStackWithThreeMainThings * modelStack )
finalvirtual

Check that autoParam isn't NULL, after calling this.

Reimplemented from ModControllableAudio.

◆ getParamFromModEncoder()

ModelStackWithAutoParam * Sound::getParamFromModEncoder ( int32_t whichModEncoder,
ModelStackWithThreeMainThings * modelStack,
bool allowCreation = true )
finalvirtual

Reimplemented from ModControllable.

◆ hasActiveVoices()

bool Sound::hasActiveVoices ( ) const
inlinenodiscardoverridevirtual

Does this sound have any active voices?

Implements Voiced.

Reimplemented in SoundDrum.

◆ killAllVoices()

void Sound::killAllVoices ( )
overridevirtual

Immediately ends all active voices.

Implements Voiced.

Reimplemented in SoundDrum.

◆ learnKnob()

bool Sound::learnKnob ( MIDICable * cable,
ParamDescriptor paramDescriptor,
uint8_t whichKnob,
uint8_t modKnobMode,
uint8_t midiChannel,
Song * song )
finalvirtual

Learna knob to a particular parameter.

Parameters
cableThe source MIDI cable, or null if learning a mod knob

Reimplemented from ModControllableAudio.

◆ modButtonAction()

void Sound::modButtonAction ( uint8_t whichModButton,
bool on,
ParamManagerForTimeline * paramManager )
finalvirtual

Reimplemented from ModControllable.

◆ modEncoderButtonAction()

bool Sound::modEncoderButtonAction ( uint8_t whichModEncoder,
bool on,
ModelStackWithThreeMainThings * modelStack )
finalvirtual

Reimplemented from ModControllable.

◆ polyphonicExpressionEventOnChannelOrNote()

void Sound::polyphonicExpressionEventOnChannelOrNote ( int32_t newValue,
int32_t expressionDimension,
int32_t channelOrNoteNumber,
MIDICharacteristic whichCharacteristic )
overridevirtual

Reimplemented from ModControllable.

◆ prepareForHibernation()

void Sound::prepareForHibernation ( )
overridevirtual

Reimplemented from Voiced.

◆ readSourceFromFile()

Error Sound::readSourceFromFile ( Deserializer & reader,
int32_t s,
ParamManagerForTimeline * paramManager,
int32_t readAutomationUpToPos )
private

Reads the parameters from the reader's current file into paramManager stack usage would be unbounded if file contained infinite tags

◆ setModFXType()

bool Sound::setModFXType ( ModFXType newType)
finalvirtual

Reimplemented from ModControllableAudio.

◆ stealOneActiveVoice()

const Sound::ActiveVoice & Sound::stealOneActiveVoice ( )
private

Steals a currently-in-use voice for use by another note.

Returns
The stolen voice

Reconstruct the voice

◆ terminateOneActiveVoice()

void Sound::terminateOneActiveVoice ( )
private

Force a voice to release very quickly - will be almost instant but click-free.

Force a voice to release very quickly - will be almost instant but not click.

◆ wontBeRenderedForAWhile()

void Sound::wontBeRenderedForAWhile ( )
overridevirtual

Reimplemented from ModControllableAudio.


The documentation for this class was generated from the following files:
  • src/deluge/processing/sound/sound.h
  • src/deluge/processing/sound/sound.cpp