// insert_fx_enable — pure implementation. See insert_fx_enable.h. #include "core/ui/insert_fx_enable.h" namespace reasampler::ui { InsertFxRefusal insertFxRefusal(int focusedCaptureCount, bool trackSelected, bool masterOnlySelected) { if (focusedCaptureCount <= 0) return InsertFxRefusal::NoCapture; if (focusedCaptureCount > 1) return InsertFxRefusal::MultiCapture; if (!trackSelected) return masterOnlySelected ? InsertFxRefusal::MasterOnlySelected : InsertFxRefusal::NoTrack; return InsertFxRefusal::None; } bool insertFxButtonEnabled(int focusedCaptureCount) { return insertFxRefusal(focusedCaptureCount, /*trackSelected=*/true) == InsertFxRefusal::None; } std::string insertFxRefusalMessage(InsertFxRefusal refusal) { switch (refusal) { case InsertFxRefusal::None: return {}; case InsertFxRefusal::NoCapture: return "select a capture in the bank panel first, then insert it as an " "instrument on the selected track"; case InsertFxRefusal::MultiCapture: return "select exactly ONE capture -- a ReaSampler 9000 instance holds one " "capture, so a multi-capture selection has no single sound to load"; case InsertFxRefusal::NoTrack: return "select a track first -- the instrument is added to the selected " "track's FX chain"; case InsertFxRefusal::MasterOnlySelected: return "select a track other than the master -- the master track cannot " "host the instrument"; } return {}; } } // namespace reasampler::ui