Skip to content

Commit

Permalink
Merge branch 'release/1.0' into community
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFreund committed Nov 3, 2023
2 parents 337c437 + f668c34 commit 17bb21d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/community_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ This list includes all preprocessor switches that can alter firmware behaviour a
[#122]: https://github.com/SynthstromAudible/DelugeFirmware/pull/122
[#125]: https://github.com/SynthstromAudible/DelugeFirmware/pull/125
[#129]: https://github.com/SynthstromAudible/DelugeFirmware/pull/129
[#630]: https://github.com/SynthstromAudible/DelugeFirmware/pull/630
[#138]: https://github.com/SynthstromAudible/DelugeFirmware/pull/138
[#141]: https://github.com/SynthstromAudible/DelugeFirmware/pull/141
[#157]: https://github.com/SynthstromAudible/DelugeFirmware/pull/157
Expand Down Expand Up @@ -404,6 +403,7 @@ This list includes all preprocessor switches that can alter firmware behaviour a
[#368]: https://github.com/SynthstromAudible/DelugeFirmware/pull/368
[#395]: https://github.com/SynthstromAudible/DelugeFirmware/pull/395
[#512]: https://github.com/SynthstromAudible/DelugeFirmware/pull/512
[#653]: https://github.com/SynthstromAudible/DelugeFirmware/pull/653
[#630]: https://github.com/SynthstromAudible/DelugeFirmware/pull/630
[#636]: https://github.com/SynthstromAudible/DelugeFirmware/pull/636
[#653]: https://github.com/SynthstromAudible/DelugeFirmware/pull/653
[Automation View Documentation]: https://github.com/SynthstromAudible/DelugeFirmware/blob/release/1.0/docs/features/automation_view.md
2 changes: 1 addition & 1 deletion src/deluge/dsp/master_compressor/master_compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void MasterCompressor::render(StereoSample* buffer, uint16_t numSamples, q31_t v
registerHit(over);
}
out = Compressor::render(numSamples, shape);
out = (multiply_32x32_rshift32(out, ratio) << 1) + (multiply_32x32_rshift32(clip, ONE_Q31 - ratio));
out = (multiply_32x32_rshift32(out, ratio) << 1) - (multiply_32x32_rshift32(clip, ONE_Q31 - ratio));
//out = multiply_32x32_rshift32(out, ratio) << 1;

//21 is the max internal volume (i.e. one_q31)
Expand Down
3 changes: 2 additions & 1 deletion src/deluge/hid/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ ActionResult buttonAction(deluge::hid::Button b, bool on, bool inCardRoutine) {
delta += releaseTime;
}
// We got a short press, maybe enable sticky keys
if (delta < kShortPressTime) {
//5th of a second
if (delta < kSampleRate / 5) {
// unstick shift if another button was pressed while shift was held, or we were already stuck and
// this short press is to get us unstuck.
shiftCurrentlyStuck = considerShiftReleaseForSticky && !shiftCurrentlyStuck;
Expand Down
12 changes: 11 additions & 1 deletion src/deluge/memory/cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed
stealable = static_cast<Stealable*>(reclamation_queue_[q].getFirst());
while (stealable != nullptr) {
// If we've already looked at this one as part of a bigger run, move on
//this works because the uint cast makes negatives high numbers instead
uint32_t lastTraversalQueue = stealable->lastTraversalNo - traversalNumberBeforeQueues;
if (lastTraversalQueue <= q) {

Expand All @@ -61,6 +62,7 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed
}

// If we're forbidden from stealing from a particular thing (usually SampleCache), then make sure we don't
// TODO: this should never happen
if (!stealable->mayBeStolen(thingNotToStealFrom)) {
numRefusedTheft++;

Expand Down Expand Up @@ -113,6 +115,8 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed

// If that one Stealable alone was big enough, that's great
if (amountToExtend <= 0) {
//need to reset this since it's getting stolen
longestRunSeenInThisQueue = 0xFFFFFFFF;
found = true;
break;
}
Expand All @@ -136,6 +140,10 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed
stealable = static_cast<Stealable*>(reclamation_queue_[q].getNext(stealable));
continue;
}
else {
//reset this since it's getting stolen
longestRunSeenInThisQueue = 0xFFFFFFFF;
}

newSpaceAddress = result.address;

Expand All @@ -146,8 +154,10 @@ uint32_t CacheManager::ReclaimMemory(MemoryRegion& region, int32_t totalSizeNeed
break;
}

// End of that particular queue - so go to the next one
longest_runs_[q] = longestRunSeenInThisQueue;

// End of that particular queue - so go to the next one

currentTraversalNo++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/deluge/model/mod_controllable/mod_controllable_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ModControllableAudio : public ModControllable {
static bool readParamTagFromFile(char const* tagName, ParamManagerForTimeline* paramManager,
int32_t readAutomationUpToPos);
static void initParams(ParamManager* paramManager);
void wontBeRenderedForAWhile();
virtual void wontBeRenderedForAWhile();
void endStutter(ParamManagerForTimeline* paramManager);
virtual bool setModFXType(ModFXType newType);
bool offerReceivedCCToLearnedParams(MIDIDevice* fromDevice, uint8_t channel, uint8_t ccNumber, uint8_t value,
Expand Down
6 changes: 3 additions & 3 deletions src/deluge/model/song/song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,8 @@ void Song::writeToFile() {
storageManager.writeOpeningTagBeginning("masterCompressor");
int32_t attack = AudioEngine::mastercompressor.attack;
int32_t release = AudioEngine::mastercompressor.release;
int32_t thresh = AudioEngine::mastercompressor.threshold;
int32_t ratio = AudioEngine::mastercompressor.ratio;
int32_t thresh = AudioEngine::mastercompressor.rawThreshold;
int32_t ratio = AudioEngine::mastercompressor.rawRatio;

storageManager.writeAttribute("attack", attack);
storageManager.writeAttribute("release", release);
Expand Down Expand Up @@ -4006,7 +4006,7 @@ void Song::setHibernatingMIDIInstrument(MIDIInstrument* newInstrument) {
void Song::deleteHibernatingMIDIInstrument() {
if (hibernatingMIDIInstrument) {
void* toDealloc = dynamic_cast<void*>(hibernatingMIDIInstrument);
hibernatingMIDIInstrument->~Instrument();
hibernatingMIDIInstrument->~MIDIInstrument();
delugeDealloc(toDealloc);
hibernatingMIDIInstrument = NULL;
}
Expand Down
32 changes: 17 additions & 15 deletions src/deluge/processing/engines/audio_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,29 +392,25 @@ void routine() {
}

#ifdef REPORT_CPU_USAGE
#define MIN_SAMPLES NUM_SAMPLES_FOR_CPU_USAGE_REPORT
#else
#define MINSAMPLES 16
#endif
#define MINSAMPLES NUM_SAMPLES_FOR_CPU_USAGE_REPORT
if (numSamples < (MINSAMPLES)) {
audioRoutineLocked = false;
return;
}
#ifdef REPORT_CPU_USAGE

numSamples = NUM_SAMPLES_FOR_CPU_USAGE_REPORT;
int32_t unadjustedNumSamplesBeforeLappingPlayHead = numSamples;
#else
#define MINSAMPLES 16

//// Disable cull smoothing until we know how to keep it from soft culling multiple times but audible hard culling anyway
// if (smoothedSamples < numSamples) {
// smoothedSamples = (numSamplesLastTime + numSamples) >> 1;
// }
// else {
smoothedSamples = numSamples;
// }
// if (!bypassCulling) {
// numSamplesLastTime = numSamples;
// }

if (numSamplesLastTime < numSamples) {
Debug::print("rendered ");
Debug::print(numSamplesLastTime);
Debug::print(" samples but output ");
Debug::println(numSamples);
}

// Consider direness and culling - before increasing the number of samples
int32_t numSamplesLimit = 40; //storageManager.devVarC;
Expand Down Expand Up @@ -596,7 +592,13 @@ void routine() {
}
}
}

//this sets a floor on the number of samples at 16, avoiding the audio DMA catching up to the
//output when cutting rendering short for clock at critical times
//the max error is 0.3ms. At 100bpm 24ppq it is 25ms per pulse
//this works out to a 1% error in the absolute worse case of alternating
//no extension and max extension, approximately 10x better than average usb midi accuracy.
numSamples = std::max<int32_t>(numSamples, MINSAMPLES);
numSamplesLastTime = numSamples;
memset(&renderingBuffer, 0, numSamples * sizeof(StereoSample));

static int32_t reverbBuffer[SSI_TX_BUFFER_NUM_SAMPLES] __attribute__((aligned(CACHE_LINE_SIZE)));
Expand Down

0 comments on commit 17bb21d

Please sign in to comment.