Resolve ReaSampler 9000 samples against the instance's own project, not the focused tab
sampleRoots matches getReaperParent(3) among EnumProjects' open projects; every instrument sample read goes through an ordered root list (one root today) so a later temp-bank root slots in after it.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// sample_roots.cpp — see sample_roots.h.
|
||||
|
||||
#include "core/instrument/map/sample_roots.h"
|
||||
|
||||
#include "core/capture/capture_paths.h" // projectDirOfRpp / resolveBankFile (persist's convention)
|
||||
|
||||
namespace reasampler::instrument::map {
|
||||
|
||||
std::string ownProjectDir(const void* own, const std::vector<ProjectTab>& open) {
|
||||
if (!own) return {};
|
||||
for (const ProjectTab& tab : open) {
|
||||
if (tab.project == own) return capture::projectDirOfRpp(tab.rppPath);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<std::string> sampleRootCandidates(const std::string& projectDir) {
|
||||
if (projectDir.empty()) return {};
|
||||
return {projectDir};
|
||||
}
|
||||
|
||||
std::vector<std::uint8_t> readFromFirstRoot(const std::vector<std::string>& roots,
|
||||
const std::string& relativePath,
|
||||
const FileReader& read) {
|
||||
for (const std::string& root : roots) {
|
||||
const std::string abs = capture::resolveBankFile(root, relativePath);
|
||||
if (abs.empty()) continue;
|
||||
std::vector<std::uint8_t> bytes = read(abs);
|
||||
if (!bytes.empty()) return bytes;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace reasampler::instrument::map
|
||||
Reference in New Issue
Block a user