MCPcopy Create free account
hub / github.com/christophhart/HISE / encodePoolAndUserPresets

Method encodePoolAndUserPresets

hi_scripting/scripting/api/ScriptExpansion.cpp:2000–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1998}
1999
2000void ScriptEncryptedExpansion::encodePoolAndUserPresets(ValueTree &hxiData, bool projectExport)
2001{
2002 auto& h = getMainController()->getExpansionHandler();
2003
2004 h.setErrorMessage("Preparing pool export", false);
2005
2006 if (!projectExport)
2007 {
2008 pool->getAdditionalDataPool().loadAllFilesFromProjectFolder();
2009 pool->getImagePool().loadAllFilesFromProjectFolder();
2010 pool->getAudioSampleBufferPool().loadAllFilesFromProjectFolder();
2011 pool->getMidiFilePool().loadAllFilesFromProjectFolder();
2012 }
2013 else
2014 {
2015 auto nativePool = getMainController()->getCurrentFileHandler().pool.get();
2016
2017 pool->getMidiFilePool().loadAllFilesFromProjectFolder();
2018
2019 auto& nip = nativePool->getImagePool();
2020 auto& nap = nativePool->getAudioSampleBufferPool();
2021
2022 BACKEND_ONLY(ExpansionHandler::ScopedProjectExporter sps(getMainController(), true));
2023
2024 auto embedImageFiles = GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::EmbedImageFiles);
2025
2026 if (embedImageFiles)
2027 {
2028 for (int i = 0; i < nip.getNumLoadedFiles(); i++)
2029 {
2030 PoolReference ref(getMainController(), nip.getReference(i).getFile().getFullPathName(), FileHandlerBase::Images);
2031 pool->getImagePool().loadFromReference(ref, PoolHelpers::LoadAndCacheStrong);
2032 }
2033 }
2034
2035 auto embedAudioFiles = GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::EmbedAudioFiles);
2036
2037 if (embedAudioFiles)
2038 {
2039 for (int i = 0; i < nap.getNumLoadedFiles(); i++)
2040 {
2041 PoolReference ref(getMainController(), nap.getReference(i).getFile().getFullPathName(), FileHandlerBase::AudioFiles);
2042 pool->getAudioSampleBufferPool().loadFromReference(ref, PoolHelpers::LoadAndCacheStrong);
2043 }
2044 }
2045 }
2046
2047 ValueTree poolData(ExpansionIds::PoolData);
2048
2049 for (auto fileType : getListOfPooledSubDirectories())
2050 {
2051 h.setErrorMessage("Exporting " + FileHandlerBase::getIdentifier(fileType), false);
2052
2053 if (!projectExport || fileType != FileHandlerBase::AdditionalSourceCode)
2054 addDataType(poolData, fileType);
2055 }
2056
2057 auto embedUserPresets = GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::EmbedUserPresets);

Callers

nothing calls this directly

Calls 11

getIdentifierFunction · 0.85
getCurrentFileHandlerMethod · 0.80
loadFromReferenceMethod · 0.80
setErrorMessageMethod · 0.45
getMethod · 0.45
getMainSynthChainMethod · 0.45
getNumLoadedFilesMethod · 0.45
getFileMethod · 0.45
getReferenceMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected