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_) {
|
||||
samples_.clear();
|
||||
map_.zones.clear();
|
||||
selectedId_.clear();
|
||||
selectedZone_ = -1;
|
||||
return;
|
||||
}
|
||||
auto banks = processor_->bridge().readReasamplerExtState(reasampler::kProjExtBanksKey);
|
||||
samples_ = banks ? listSamples(*banks) : std::vector<SampleChoice>{};
|
||||
map_ = processor_->performanceMap();
|
||||
selectedId_ = processor_->selectedSampleId();
|
||||
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;
|
||||
case REAPER_FXEMBED_WM_DESTROY:
|
||||
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
|
||||
case REAPER_FXEMBED_WM_PAINT:
|
||||
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;
|
||||
#endif
|
||||
default:
|
||||
return 0; // unhandled messages (cursor, wheel, hittest, minmax) fall through
|
||||
return 0; // unhandled messages (cursor, wheel, hittest) fall through
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user