|
Krotos Modules 3
|
#include <PresetBundler.h>
Classes | |
| struct | AudioAsset |
Public Member Functions | |
| PresetBundler (File preset) | |
| PresetBundler (ValueTree presetData) | |
| bool | createBundle (File outputLocation, String &errors) |
| int | setMaximumBundleSizeInMegaBytes (int newSizeMb) |
| void | setPresetFileExtension (String fileExtension) |
Static Public Member Functions | |
| static File | openBundle (File bundleArchive) |
| Extracts the contents of a bundle archive to the temporary "sandbox" directory. | |
| static File | getPresetFromBundleDirectory (File bundleDirectory) |
| Locates the preset file within a given bundle directory. | |
| static bool | validateBundleDirectory (File bundleDirectory) |
| Validates that a given directory is a valid bundle directory by checking it is a child file of the sandbox directory. | |
| static bool | isABundlePreset (const File &preset) |
| Returns whether this preset file is part of a bundle. This is just a simple check for that the provided file is a child of the sandbox directory that bundles are loaded into. | |
| static File | getSandboxDirectory () |
| Returns the path to the sandbox directory where the preset bundles are temporarily stored. | |
| static File | getSandboxDirectoryForBundle (const File &bundleFile) |
| Returns the path to the sandbox directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish". | |
| static File | getAudioAssetDirectoryForBundle (const File &bundleFile) |
| Returns the path to the audio assets directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish/Audio Assets". | |
| static File | getPresetDirectoryForBundle (const File &bundleFile) |
| Returns the path to the preset directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish/Presets". | |
Static Public Attributes | |
| static const String | BundleFileExtension {".kspb"} |
| The file extension for the bundle archive. | |
| static const String | PresetSubdirectory {"Presets"} |
| static const String | AudioAssetsSubdirectory {"Audio Assets"} |
Protected Member Functions | |
| File | getExportBundleRoot () |
| bool | createBundleFileStructure () |
| void | cleanUpFileStructure () |
| std::vector< AudioAsset > | getAssetsListFromPreset () |
| File | copyPresetForExport (String nameForPresetFile) |
| void | copyAudioAssetsForExport () |
| void | processExportedPresetFile (File exportPreset) |
| File | buildBundleArchive (String outputDirectoryPath) |
| int | getEstimatedAssetsSizeMB () |
| String | listMissingFiles () |
| std::vector< AudioAsset > | getAssetFilepaths () |
Protected Attributes | |
| String | m_factoryAssetsDirectory |
Private Member Functions | |
| void | initialise (ValueTree presetData) |
| void | clenseExportIDs () |
| bool | isValueAudioFile (String value) |
| bool | isValueMultipleFiles (String value) |
| void | getPresetFilepaths (StringArray &listOfFiles, XmlElement widgetElement) |
| void | findPathAttributesRecursive (StringArray &listOfFiles, XmlElement customParamsElement) |
| void | replacePaths (XmlElement &widgetElement) |
| void | replacePathRecursive (XmlElement &widgetElement) |
| String | convertFilepath (String filepathFromPreset) |
Private Attributes | |
| String | m_bundleRootId |
| ValueTree | m_presetFile |
| std::vector< AudioAsset > | m_assetFilepaths |
| int | m_maxSizeMegaBytes {1000} |
Static Private Attributes | |
| static String | m_presetFileExtension {".ksp"} |
Creates preset bundle files (.kspb) for export/import
The resulting .ksp file will be a zip archive. It will contain the preset file and all the assets that preset uses. The class will search and collect audio assets via the preset:
Bundle file structure example: Example.kspb: Presets/ Example.ksp Audio Assets/ Asset1/Afile.wav Asset2/Anotherfile.wav
| krotos::PresetBundler::PresetBundler | ( | File | preset | ) |
| preset | The preset file to be exported. |
| A | PresetManager/std::run_time will be thrown if the presetData value tree is invalid |
| krotos::PresetBundler::PresetBundler | ( | ValueTree | presetData | ) |
| preset | The preset file to be exported. |
| A | std::exception will be thrown if the presetData value tree is invalid |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
| bool krotos::PresetBundler::createBundle | ( | File | outputLocation, |
| String & | errors ) |
Generate the preset bundle archive
| outputLocation | The directory to save the bundle to | |
| [out] | if | createBundle fails then this will instead contain the error why. |
|
protected |
|
private |
|
inlineprotected |
|
protected |
|
static |
Returns the path to the audio assets directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish/Audio Assets".
| bundleFile | The name of the bundle file loaded |
|
protected |
|
protected |
|
static |
Returns the path to the preset directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish/Presets".
| bundleFile | The name of the bundle file loaded |
|
private |
|
static |
Locates the preset file within a given bundle directory.
| bundleDirectory | The directory containing the extracted bundle contents. |
|
static |
Returns the path to the sandbox directory where the preset bundles are temporarily stored.
|
static |
Returns the path to the sandbox directory for a particular bundle based on the name of the file being loaded, without extension. e.g.Fish.kspb would return "<sandbox>/Fish".
| bundleFile | The name of the bundle file loaded |
|
private |
|
static |
Returns whether this preset file is part of a bundle. This is just a simple check for that the provided file is a child of the sandbox directory that bundles are loaded into.
| preset | The preset file to check. |
|
private |
|
private |
|
protected |
|
static |
Extracts the contents of a bundle archive to the temporary "sandbox" directory.
| bundleArchive | The bundle archive file to extract. |
|
protected |
|
private |
|
private |
|
inline |
Set the maximum size a bundle can be. The bundle has a maximum size of 1000 MegaBytes by default which can be reset here. The size includes the preset file and all assets included.
| void krotos::PresetBundler::setPresetFileExtension | ( | String | fileExtension | ) |
Sets the file extension the preset data file will use in the bundle Default is krotos studio's .ksp
| fileExtension | The new preset file extension including the '.' |
|
static |
Validates that a given directory is a valid bundle directory by checking it is a child file of the sandbox directory.
| bundleDirectory | The directory to validate. |
|
static |
|
static |
The file extension for the bundle archive.
|
private |
|
private |
|
protected |
|
private |
|
private |
|
staticprivate |
|
static |