// See bake_reset.h.

#include "core/instrument/bake/bake_reset.h"

namespace reasampler::instrument::bake {

BakeReset resetAfterBake(const map::InstrumentParams& dialed) {
    BakeReset out;
    // The root is what the note was rendered at, so it is exactly what the new capture
    // plays back at unity — resetting it would detune every following iteration.
    out.params.rootOverride = dialed.rootOverride;
    // How far pitch tracks the keyboard is a fact about the mapping; a single rendered
    // note carries no trace of it.
    out.params.keyTrack = dialed.keyTrack;
    // There is no key-range parameter to carry (core/instrument/CLAUDE.md: no key-range
    // concept) — if one is ever added it belongs on this list, not in the defaults.

    // Play mode is on neither ratified list, so it is classified here, and the acceptance
    // criteria decide it: the bake's product is a finished one-shot carrying its own
    // attack, span and release. Trigger plays that back verbatim — note-off ignored, the
    // default AHD flat at unity over the whole span. Gate would re-gate it: the default
    // release would cut the printed tail at note-off, and every further iteration would cut
    // the previous one's again. "Neutral" for this control means "adds no processing",
    // which is Trigger, not the value struct's own Gate default.
    out.params.play.playMode = PlayMode::Trigger;
    return out;
}

}  // namespace reasampler::instrument::bake
