Fix breakage of sister ring and related bugs
This commit is contained in:
parent
6d692ba5be
commit
f6e93911ae
3 changed files with 23 additions and 15 deletions
|
|
@ -1066,8 +1066,8 @@ void Synth::Impl::startVoice(Region* region, int delay, const TriggerEvent& trig
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ASSERT(selectedVoice->isFree());
|
ASSERT(selectedVoice->isFree());
|
||||||
selectedVoice->startVoice(region, delay, triggerEvent);
|
if (selectedVoice->startVoice(region, delay, triggerEvent))
|
||||||
ring.addVoiceToRing(selectedVoice);
|
ring.addVoiceToRing(selectedVoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Synth::Impl::noteOffDispatch(int delay, int noteNumber, float velocity) noexcept
|
void Synth::Impl::noteOffDispatch(int delay, int noteNumber, float velocity) noexcept
|
||||||
|
|
|
||||||
|
|
@ -358,19 +358,22 @@ Voice::Impl::Impl(int voiceNumber, Resources& resources)
|
||||||
getSCurve();
|
getSCurve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Voice::startVoice(Region* region, int delay, const TriggerEvent& event) noexcept
|
bool Voice::startVoice(Region* region, int delay, const TriggerEvent& event) noexcept
|
||||||
{
|
{
|
||||||
Impl& impl = *impl_;
|
Impl& impl = *impl_;
|
||||||
ASSERT(event.value >= 0.0f && event.value <= 1.0f);
|
ASSERT(event.value >= 0.0f && event.value <= 1.0f);
|
||||||
|
|
||||||
impl.region_ = region;
|
impl.region_ = region;
|
||||||
if (region->disabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
impl.triggerEvent_ = event;
|
impl.triggerEvent_ = event;
|
||||||
if (impl.triggerEvent_.type == TriggerEventType::CC)
|
if (impl.triggerEvent_.type == TriggerEventType::CC)
|
||||||
impl.triggerEvent_.number = region->pitchKeycenter;
|
impl.triggerEvent_.number = region->pitchKeycenter;
|
||||||
|
|
||||||
|
if (region->disabled()) {
|
||||||
|
impl.switchState(State::cleanMeUp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
impl.switchState(State::playing);
|
impl.switchState(State::playing);
|
||||||
|
|
||||||
ASSERT(delay >= 0);
|
ASSERT(delay >= 0);
|
||||||
|
|
@ -414,7 +417,7 @@ void Voice::startVoice(Region* region, int delay, const TriggerEvent& event) noe
|
||||||
impl.currentPromise_ = impl.resources_.filePool.getFilePromise(region->sampleId);
|
impl.currentPromise_ = impl.resources_.filePool.getFilePromise(region->sampleId);
|
||||||
if (!impl.currentPromise_) {
|
if (!impl.currentPromise_) {
|
||||||
impl.switchState(State::cleanMeUp);
|
impl.switchState(State::cleanMeUp);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
impl.updateLoopInformation();
|
impl.updateLoopInformation();
|
||||||
impl.speedRatio_ = static_cast<float>(impl.currentPromise_->information.sampleRate / impl.sampleRate_);
|
impl.speedRatio_ = static_cast<float>(impl.currentPromise_->information.sampleRate / impl.sampleRate_);
|
||||||
|
|
@ -455,6 +458,8 @@ void Voice::startVoice(Region* region, int delay, const TriggerEvent& event) noe
|
||||||
|
|
||||||
impl.resources_.modMatrix.initVoice(impl.id_, region->getId(), impl.initialDelay_);
|
impl.resources_.modMatrix.initVoice(impl.id_, region->getId(), impl.initialDelay_);
|
||||||
impl.saveModulationTargets(region);
|
impl.saveModulationTargets(region);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Voice::Impl::getCurrentSampleQuality() const noexcept
|
int Voice::Impl::getCurrentSampleQuality() const noexcept
|
||||||
|
|
@ -628,7 +633,8 @@ void Voice::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
ASSERT(static_cast<int>(buffer.getNumFrames()) <= impl.samplesPerBlock_);
|
ASSERT(static_cast<int>(buffer.getNumFrames()) <= impl.samplesPerBlock_);
|
||||||
buffer.fill(0.0f);
|
buffer.fill(0.0f);
|
||||||
|
|
||||||
if (impl.region_ == nullptr)
|
const Region* region = impl.region_;
|
||||||
|
if (region == nullptr || region->disabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto delay = min(static_cast<size_t>(impl.initialDelay_), buffer.getNumFrames());
|
const auto delay = min(static_cast<size_t>(impl.initialDelay_), buffer.getNumFrames());
|
||||||
|
|
@ -637,13 +643,13 @@ void Voice::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
|
|
||||||
{ // Fill buffer with raw data
|
{ // Fill buffer with raw data
|
||||||
ScopedTiming logger { impl.dataDuration_ };
|
ScopedTiming logger { impl.dataDuration_ };
|
||||||
if (impl.region_->isOscillator())
|
if (region->isOscillator())
|
||||||
impl.fillWithGenerator(delayed_buffer);
|
impl.fillWithGenerator(delayed_buffer);
|
||||||
else
|
else
|
||||||
impl.fillWithData(delayed_buffer);
|
impl.fillWithData(delayed_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (impl.region_->isStereo()) {
|
if (region->isStereo()) {
|
||||||
impl.ampStageStereo(buffer);
|
impl.ampStageStereo(buffer);
|
||||||
impl.panStageStereo(buffer);
|
impl.panStageStereo(buffer);
|
||||||
impl.filterStageStereo(buffer);
|
impl.filterStageStereo(buffer);
|
||||||
|
|
@ -653,12 +659,12 @@ void Voice::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
impl.panStageMono(buffer);
|
impl.panStageMono(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!impl.region_->flexAmpEG) {
|
if (!region->flexAmpEG) {
|
||||||
if (!impl.egAmplitude_.isSmoothing())
|
if (!impl.egAmplitude_.isSmoothing())
|
||||||
impl.switchState(State::cleanMeUp);
|
impl.switchState(State::cleanMeUp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (impl.flexEGs_[*impl.region_->flexAmpEG]->isFinished())
|
if (impl.flexEGs_[*region->flexAmpEG]->isFinished())
|
||||||
impl.switchState(State::cleanMeUp);
|
impl.switchState(State::cleanMeUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1476,12 +1482,13 @@ bool Voice::Impl::released() const noexcept
|
||||||
bool Voice::checkOffGroup(const Region* other, int delay, int noteNumber) noexcept
|
bool Voice::checkOffGroup(const Region* other, int delay, int noteNumber) noexcept
|
||||||
{
|
{
|
||||||
Impl& impl = *impl_;
|
Impl& impl = *impl_;
|
||||||
if (impl.region_ == nullptr || other == nullptr)
|
const Region* region = impl.region_;
|
||||||
|
if (region == nullptr || other == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (impl.triggerEvent_.type == TriggerEventType::NoteOn
|
if (impl.triggerEvent_.type == TriggerEventType::NoteOn
|
||||||
&& impl.region_->offBy == other->group
|
&& region->offBy == other->group
|
||||||
&& (impl.region_->group != other->group || noteNumber != impl.triggerEvent_.number)) {
|
&& (region->group != other->group || noteNumber != impl.triggerEvent_.number)) {
|
||||||
off(delay);
|
off(delay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,9 @@ public:
|
||||||
* @param region
|
* @param region
|
||||||
* @param delay
|
* @param delay
|
||||||
* @param evebt
|
* @param evebt
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
void startVoice(Region* region, int delay, const TriggerEvent& event) noexcept;
|
bool startVoice(Region* region, int delay, const TriggerEvent& event) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the sample quality determined by the active region.
|
* @brief Get the sample quality determined by the active region.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue