fix(embed): WM_GETMINMAXINFO size hints, remove dead selectedId_, fix selectedZone_ comment, decay embedPeak_ on early returns
This commit is contained in:
@@ -82,14 +82,12 @@ void ReaSamplerEmbed::refresh() {
|
|||||||
if (!processor_) {
|
if (!processor_) {
|
||||||
samples_.clear();
|
samples_.clear();
|
||||||
map_.zones.clear();
|
map_.zones.clear();
|
||||||
selectedId_.clear();
|
|
||||||
selectedZone_ = -1;
|
selectedZone_ = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto banks = processor_->bridge().readReasamplerExtState(reasampler::kProjExtBanksKey);
|
auto banks = processor_->bridge().readReasamplerExtState(reasampler::kProjExtBanksKey);
|
||||||
samples_ = banks ? listSamples(*banks) : std::vector<SampleChoice>{};
|
samples_ = banks ? listSamples(*banks) : std::vector<SampleChoice>{};
|
||||||
map_ = processor_->performanceMap();
|
map_ = processor_->performanceMap();
|
||||||
selectedId_ = processor_->selectedSampleId();
|
|
||||||
if (selectedZone_ >= static_cast<int>(map_.zones.size())) selectedZone_ = -1;
|
if (selectedZone_ >= static_cast<int>(map_.zones.size())) selectedZone_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +104,20 @@ TPtrInt ReaSamplerEmbed::embed_message(int msg, TPtrInt parm2, TPtrInt parm3) {
|
|||||||
return 0;
|
return 0;
|
||||||
case REAPER_FXEMBED_WM_DESTROY:
|
case REAPER_FXEMBED_WM_DESTROY:
|
||||||
return 0;
|
return 0;
|
||||||
|
case REAPER_FXEMBED_WM_GETMINMAXINFO: {
|
||||||
|
auto* hints = reinterpret_cast<REAPER_FXEMBED_SizeHints*>(parm3);
|
||||||
|
if (!hints) return 0;
|
||||||
|
// Minimum usable strip height: the keymap must not collapse below its floor
|
||||||
|
// (kEmbedKeymapMinHeight) plus the level band.
|
||||||
|
hints->min_width = 64;
|
||||||
|
hints->max_width = 0; // 0 = unconstrained
|
||||||
|
hints->min_height = kEmbedKeymapMinHeight + kEmbedLevelBandHeight;
|
||||||
|
hints->max_height = 0; // 0 = unconstrained
|
||||||
|
// Preferred aspect: wide strip, roughly 8:1 (w:h). 16.16 fixed point.
|
||||||
|
hints->preferred_aspect = (8 << 16) / 1;
|
||||||
|
hints->minimum_aspect = (4 << 16) / 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
case REAPER_FXEMBED_WM_PAINT:
|
case REAPER_FXEMBED_WM_PAINT:
|
||||||
return paint(parm2, parm3) ? 1 : 0;
|
return paint(parm2, parm3) ? 1 : 0;
|
||||||
@@ -114,7 +126,7 @@ TPtrInt ReaSamplerEmbed::embed_message(int msg, TPtrInt parm2, TPtrInt parm3) {
|
|||||||
return onMouseDown(parm3) ? REAPER_FXEMBED_RETNOTIFY_INVALIDATE : 0;
|
return onMouseDown(parm3) ? REAPER_FXEMBED_RETNOTIFY_INVALIDATE : 0;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0; // unhandled messages (cursor, wheel, hittest, minmax) fall through
|
return 0; // unhandled messages (cursor, wheel, hittest) fall through
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ private:
|
|||||||
// Snapshotted for the current paint (refreshed each paint off the audio thread).
|
// Snapshotted for the current paint (refreshed each paint off the audio thread).
|
||||||
std::vector<SampleChoice> samples_;
|
std::vector<SampleChoice> samples_;
|
||||||
PerformanceMap map_;
|
PerformanceMap map_;
|
||||||
std::string selectedId_;
|
// The zone the last click selected (local/visual only — S6 selection constraint; the
|
||||||
// The zone the last click selected (mirrored to the processor's editor-shared selection
|
// processor's editor-shared selection is NOT updated from here); -1 = none.
|
||||||
// where meaningful); -1 = none. Drives the strip's highlight.
|
// Drives the strip's highlight.
|
||||||
int selectedZone_ = -1;
|
int selectedZone_ = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ tresult PLUGIN_API ReaSamplerProcessor::process(ProcessData& data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.numOutputs <= 0 || !data.outputs || data.numSamples <= 0) {
|
if (data.numOutputs <= 0 || !data.outputs || data.numSamples <= 0) {
|
||||||
|
embedPeak_.store(0.f, std::memory_order_relaxed);
|
||||||
return kResultOk;
|
return kResultOk;
|
||||||
}
|
}
|
||||||
AudioBusBuffers& out = data.outputs[0];
|
AudioBusBuffers& out = data.outputs[0];
|
||||||
@@ -356,6 +357,7 @@ tresult PLUGIN_API ReaSamplerProcessor::process(ProcessData& data) {
|
|||||||
// 64-bit host processing is not supported by the mono float core; emit silence
|
// 64-bit host processing is not supported by the mono float core; emit silence
|
||||||
// rather than mis-render. REAPER runs 32-bit float by default.
|
// rather than mis-render. REAPER runs 32-bit float by default.
|
||||||
if (data.symbolicSampleSize != kSample32) {
|
if (data.symbolicSampleSize != kSample32) {
|
||||||
|
embedPeak_.store(0.f, std::memory_order_relaxed);
|
||||||
for (int32 ch = 0; ch < out.numChannels; ++ch) {
|
for (int32 ch = 0; ch < out.numChannels; ++ch) {
|
||||||
if (double* buf = out.channelBuffers64[ch]) {
|
if (double* buf = out.channelBuffers64[ch]) {
|
||||||
for (int32 i = 0; i < frames; ++i) buf[i] = 0.0;
|
for (int32 i = 0; i < frames; ++i) buf[i] = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user