|
Vital
|
A utility class for loading and saving configuration, preset, and state data for the Vital synthesizer. More...
#include <load_save.h>
Classes | |
| class | FileSorterAscending |
| A helper class for sorting files in ascending order based on their names. More... | |
Public Types | |
| enum | PresetStyle { kBass , kLead , kKeys , kPad , kPercussion , kSequence , kExperimental , kSfx , kTemplate , kNumPresetStyles } |
| Enumeration of preset styles that categorize sounds. More... | |
Static Public Member Functions | |
| static void | convertBufferToPcm (json &data, const std::string &field) |
| Converts a float buffer field in JSON to PCM format in base64. | |
| static void | convertPcmToFloatBuffer (json &data, const std::string &field) |
| Converts a PCM buffer field in JSON to a float buffer in base64. | |
| static json | stateToJson (SynthBase *synth, const CriticalSection &critical_section) |
| Converts the state of a given SynthBase to JSON. | |
| static void | loadControls (SynthBase *synth, const json &data) |
| Loads controls from the given JSON data into a SynthBase instance. | |
| static void | loadModulations (SynthBase *synth, const json &modulations) |
| Loads modulation connections from JSON data into a SynthBase instance. | |
| static void | loadSample (SynthBase *synth, const json &sample) |
| Loads a sample configuration into the SynthBase from a JSON object. | |
| static void | loadWavetables (SynthBase *synth, const json &wavetables) |
| Loads wavetable configurations into a SynthBase from a JSON array. | |
| static void | loadLfos (SynthBase *synth, const json &lfos) |
| Loads LFO states (line shapes) from a JSON array into a SynthBase. | |
| static void | loadSaveState (std::map< std::string, String > &save_info, json data) |
| Extracts and stores basic preset info (name, author, comments, style, macros) from JSON data. | |
| static void | initSaveInfo (std::map< std::string, String > &save_info) |
| Initializes save_info with default values for preset information. | |
| static json | updateFromOldVersion (json state) |
| Updates a JSON state from an older version of Vital's format to the current version. | |
| static bool | jsonToState (SynthBase *synth, std::map< std::string, String > &save_info, json state) |
| Loads a JSON state into the given SynthBase, applying older version updates if necessary. | |
| static String | getAuthorFromFile (const File &file) |
| Extracts the author's name from a given preset file. | |
| static String | getStyleFromFile (const File &file) |
| Extracts the style from a given preset file. | |
| static std::string | getAuthor (json file) |
| Extracts the author name from a JSON object representing a preset/state. | |
| static std::string | getLicense (json state) |
| Extracts the license information from a JSON state, if present. | |
| static File | getConfigFile () |
| Retrieves the main configuration file path for Vital. | |
| static void | writeCrashLog (String crash_log) |
| Writes a crash log to a file in the data directory. | |
| static void | writeErrorLog (String error_log) |
| Appends an error message to an error log file. | |
| static json | getConfigJson () |
| Parses and returns the main configuration JSON. | |
| static File | getFavoritesFile () |
| Retrieves the file storing the user's favorites. | |
| static File | getDefaultSkin () |
| Retrieves the file specifying the default skin. | |
| static json | getFavoritesJson () |
| Parses and returns the favorites JSON data. | |
| static void | addFavorite (const File &new_favorite) |
| Adds a new favorite preset or item to the favorites file. | |
| static void | removeFavorite (const File &old_favorite) |
| Removes a favorite item from the favorites. | |
| static std::set< std::string > | getFavorites () |
| Retrieves all favorites as a set of string paths. | |
| static bool | hasDataDirectory () |
| Checks if a data directory is properly configured (exists and has packs.json). | |
| static File | getAvailablePacksFile () |
| Retrieves the file listing available packs. | |
| static json | getAvailablePacks () |
| Parses and returns JSON data about available packs. | |
| static File | getInstalledPacksFile () |
| Retrieves the file that stores information about installed packs. | |
| static json | getInstalledPacks () |
| Returns a JSON list of installed packs. | |
| static void | saveInstalledPacks (const json &packs) |
| Saves the given JSON pack configuration to the installed packs file. | |
| static void | markPackInstalled (int id) |
| Marks a pack as installed by ID in the packs file. | |
| static void | markPackInstalled (const std::string &name) |
| Marks a pack as installed by name in the packs file. | |
| static void | saveDataDirectory (const File &data_directory) |
| Saves the given directory as the data directory in the configuration. | |
| static bool | isInstalled () |
| Checks if Vital is fully installed (data directory present). | |
| static bool | wasUpgraded () |
| Checks if Vital was upgraded from a previous version. | |
| static bool | isExpired () |
| Checks if this build of Vital has expired. | |
| static bool | doesExpire () |
| Checks if this build of Vital includes an expiration mechanism. | |
| static int | getDaysToExpire () |
| Returns the number of days remaining until expiration. | |
| static bool | shouldCheckForUpdates () |
| Checks if Vital should perform update checks. | |
| static bool | shouldWorkOffline () |
| Checks if Vital should operate in offline mode. | |
| static std::string | getLoadedSkin () |
| Retrieves the currently loaded skin name. | |
| static bool | shouldAnimateWidgets () |
| Determines if widget animations are enabled. | |
| static bool | displayHzFrequency () |
| Determines if frequencies should be displayed in Hz. | |
| static bool | authenticated () |
| Checks if the user is authenticated. | |
| static int | getOversamplingAmount () |
| Retrieves the current oversampling amount. | |
| static float | loadWindowSize () |
| Loads the saved window size scaling factor. | |
| static String | loadVersion () |
| Loads the saved synth version string. | |
| static String | loadContentVersion () |
| Loads the saved content version string. | |
| static void | saveJsonToConfig (json config_state) |
| Saves a given JSON object to the configuration file. | |
| static void | saveJsonToFavorites (json favorites_json) |
| Saves a JSON object of favorites to the favorites file. | |
| static void | saveAuthor (std::string author) |
| Saves the provided author name to the config. | |
| static void | savePreferredTTWTLanguage (std::string language) |
| Saves a preferred Text-To-Wavetable (TTWT) language to the config. | |
| static void | saveLayoutConfig (vital::StringLayout *layout) |
| Saves layout configuration (keyboard layout and octave controls). | |
| static void | saveVersionConfig () |
| Saves the current synth version to the config file. | |
| static void | saveContentVersion (std::string version) |
| Saves the current content version to the config file. | |
| static void | saveUpdateCheckConfig (bool check_for_updates) |
| Saves the user's preference regarding update checks. | |
| static void | saveWorkOffline (bool work_offline) |
| Saves the user's preference for working offline. | |
| static void | saveLoadedSkin (const std::string &name) |
| Saves the currently loaded skin name to the config. | |
| static void | saveAnimateWidgets (bool animate_widgets) |
| Saves the widget animation preference. | |
| static void | saveDisplayHzFrequency (bool display_hz) |
| Saves the preference to display frequency in Hz. | |
| static void | saveAuthenticated (bool authenticated) |
| Saves the user's authentication status. | |
| static void | saveWindowSize (float window_size) |
| Saves the window size scaling factor. | |
| static void | saveMidiMapConfig (MidiManager *midi_manager) |
| Saves MIDI mapping configuration. | |
| static void | loadConfig (MidiManager *midi_manager, vital::StringLayout *layout=nullptr) |
| Loads configuration data into a MidiManager and optional StringLayout. | |
| static std::wstring | getComputerKeyboardLayout () |
| Retrieves the saved computer keyboard layout for playing notes. | |
| static std::string | getPreferredTTWTLanguage () |
| Returns the preferred Text-To-Wavetable language, if set. | |
| static std::string | getAuthor () |
| Retrieves the saved author name from the config. | |
| static std::pair< wchar_t, wchar_t > | getComputerKeyboardOctaveControls () |
| Retrieves the keys used for octave shifts on the computer keyboard layout. | |
| static void | saveAdditionalFolders (const std::string &name, std::vector< std::string > folders) |
| Saves additional folder paths for presets, wavetables, or samples. | |
| static std::vector< std::string > | getAdditionalFolders (const std::string &name) |
| Retrieves a list of additional folder paths for a given category. | |
| static File | getDataDirectory () |
| Gets the current data directory from the config. | |
| static std::vector< File > | getDirectories (const String &folder_name) |
| Retrieves directories of a given folder name under the data directory structure. | |
| static std::vector< File > | getPresetDirectories () |
| Gets directories that should contain presets. | |
| static std::vector< File > | getWavetableDirectories () |
| Gets directories that should contain wavetables. | |
| static std::vector< File > | getSkinDirectories () |
| Gets directories that should contain skins. | |
| static std::vector< File > | getSampleDirectories () |
| Gets directories that should contain samples. | |
| static std::vector< File > | getLfoDirectories () |
| Gets directories that should contain LFO shapes. | |
| static File | getUserDirectory () |
| Retrieves the user directory inside the data directory. | |
| static File | getUserPresetDirectory () |
| Retrieves the user's preset directory. | |
| static File | getUserWavetableDirectory () |
| Retrieves the user's wavetable directory. | |
| static File | getUserSkinDirectory () |
| Retrieves the user's skin directory. | |
| static File | getUserSampleDirectory () |
| Retrieves the user's sample directory. | |
| static File | getUserLfoDirectory () |
| Retrieves the user's LFO directory. | |
| static void | getAllFilesOfTypeInDirectories (Array< File > &files, const String &extensions, const std::vector< File > &directories) |
| Scans a set of directories for files matching certain extensions. | |
| static void | getAllPresets (Array< File > &presets) |
| Retrieves all preset files from preset directories. | |
| static void | getAllWavetables (Array< File > &wavetables) |
| Retrieves all wavetables from wavetable directories. | |
| static void | getAllSkins (Array< File > &skins) |
| Retrieves all skins from skin directories. | |
| static void | getAllLfos (Array< File > &lfos) |
| Retrieves all LFO shapes from LFO directories. | |
| static void | getAllSamples (Array< File > &samples) |
| Retrieves all samples (wav files) from sample directories. | |
| static void | getAllUserPresets (Array< File > &presets) |
| Retrieves all user presets (from data and user directories). | |
| static void | getAllUserWavetables (Array< File > &wavetables) |
| Retrieves all user wavetables (from data and user directories). | |
| static void | getAllUserLfos (Array< File > &lfos) |
| Retrieves all user LFO shapes (from data and user directories). | |
| static void | getAllUserSamples (Array< File > &samples) |
| Retrieves all user samples (from data and user directories). | |
| static int | compareFeatureVersionStrings (String a, String b) |
| Compares two feature version strings (ignoring patch-level differences). | |
| static int | compareVersionStrings (String a, String b) |
| Compares two version strings. | |
| static File | getShiftedFile (const String directory_name, const String &extensions, const std::string &additional_folders_name, const File ¤t_file, int shift) |
| Given a directory name and extensions, returns a file shifted by some offset from the current file. | |
Static Public Attributes | |
| static const int | kMaxCommentLength = 500 |
| Maximum length of preset comments. | |
| static const std::string | kUserDirectoryName = "User" |
| Various folder and directory name constants. | |
| static const std::string | kPresetFolderName = "Presets" |
| static const std::string | kWavetableFolderName = "Wavetables" |
| static const std::string | kSkinFolderName = "Skins" |
| static const std::string | kSampleFolderName = "Samples" |
| static const std::string | kLfoFolderName = "LFOs" |
| static const std::string | kAdditionalWavetableFoldersName = "wavetable_folders" |
| static const std::string | kAdditionalSampleFoldersName = "sample_folders" |
A utility class for loading and saving configuration, preset, and state data for the Vital synthesizer.
This class provides a comprehensive set of static methods for:
|
static |
Adds a new favorite preset or item to the favorites file.
| new_favorite | The file to be added as a favorite. |
|
static |
Checks if the user is authenticated.
|
static |
Compares two feature version strings (ignoring patch-level differences).
| a | The first version string. |
| b | The second version string. |
|
static |
Compares two version strings.
| a | The first version string. |
| b | The second version string. |
|
static |
Converts a float buffer field in JSON to PCM format in base64.
| data | The JSON object containing the field. |
| field | The name of the field to convert. |
|
static |
Converts a PCM buffer field in JSON to a float buffer in base64.
| data | The JSON object containing the field. |
| field | The name of the field to convert. |
|
static |
Determines if frequencies should be displayed in Hz.
|
static |
Checks if this build of Vital includes an expiration mechanism.
|
static |
Retrieves a list of additional folder paths for a given category.
| name | The category name (e.g., "wavetable_folders"). |
|
static |
Scans a set of directories for files matching certain extensions.
| files | An Array<File> to store the results. |
| extensions | A string specifying the file extensions to look for. |
| directories | A vector of File objects representing directories to search. |
|
static |
Retrieves all LFO shapes from LFO directories.
| lfos | An Array<File> to store the found LFO files. |
|
static |
Retrieves all preset files from preset directories.
| presets | An Array<File> to store the found preset files. |
|
static |
Retrieves all samples (wav files) from sample directories.
| samples | An Array<File> to store the found sample files. |
|
static |
Retrieves all skins from skin directories.
| skins | An Array<File> to store the found skins. |
|
static |
Retrieves all user LFO shapes (from data and user directories).
| lfos | An Array<File> to store the found user LFO files. |
|
static |
Retrieves all user presets (from data and user directories).
| presets | An Array<File> to store the found user presets. |
|
static |
Retrieves all user samples (from data and user directories).
| samples | An Array<File> to store the found user samples. |
|
static |
Retrieves all user wavetables (from data and user directories).
| wavetables | An Array<File> to store the found user wavetables. |
|
static |
Retrieves all wavetables from wavetable directories.
| wavetables | An Array<File> to store the found wavetables. |
|
static |
Retrieves the saved author name from the config.
|
static |
Extracts the author name from a JSON object representing a preset/state.
| file | A JSON object containing the author's field. |
|
static |
Extracts the author's name from a given preset file.
| file | The preset File to examine. |
|
static |
Parses and returns JSON data about available packs.
|
static |
Retrieves the file listing available packs.
|
static |
Retrieves the saved computer keyboard layout for playing notes.
|
static |
Retrieves the keys used for octave shifts on the computer keyboard layout.
|
static |
Retrieves the main configuration file path for Vital.
|
static |
Parses and returns the main configuration JSON.
|
static |
Gets the current data directory from the config.
|
static |
Returns the number of days remaining until expiration.
|
static |
Retrieves the file specifying the default skin.
|
static |
Retrieves directories of a given folder name under the data directory structure.
| folder_name | The name of the folder (e.g., "Presets"). |
|
static |
Retrieves all favorites as a set of string paths.
|
static |
Retrieves the file storing the user's favorites.
|
static |
Parses and returns the favorites JSON data.
|
static |
Returns a JSON list of installed packs.
|
static |
Retrieves the file that stores information about installed packs.
|
static |
Gets directories that should contain LFO shapes.
|
static |
Extracts the license information from a JSON state, if present.
| state | The JSON object potentially containing a "license" key. |
|
static |
Retrieves the currently loaded skin name.
|
static |
Retrieves the current oversampling amount.
|
static |
Returns the preferred Text-To-Wavetable language, if set.
|
static |
Gets directories that should contain presets.
|
static |
Gets directories that should contain samples.
|
static |
Given a directory name and extensions, returns a file shifted by some offset from the current file.
Used for navigating presets or wavetables by stepping forward/backward.
| directory_name | The directory name to search. |
| extensions | The file extensions to consider. |
| additional_folders_name | The config key for extra directories. |
| current_file | The current file. |
| shift | The integer offset to move (e.g., +1 for next file, -1 for previous). |
|
static |
Gets directories that should contain skins.
|
static |
Extracts the style from a given preset file.
| file | The preset File to examine. |
|
static |
Retrieves the user directory inside the data directory.
|
static |
Retrieves the user's LFO directory.
|
static |
Retrieves the user's preset directory.
|
static |
Retrieves the user's sample directory.
|
static |
Retrieves the user's skin directory.
|
static |
Retrieves the user's wavetable directory.
|
static |
Gets directories that should contain wavetables.
|
static |
Checks if a data directory is properly configured (exists and has packs.json).
|
static |
Initializes save_info with default values for preset information.
| save_info | The map to initialize. |
|
static |
Checks if this build of Vital has expired.
|
static |
Checks if Vital is fully installed (data directory present).
|
static |
Loads configuration data into a MidiManager and optional StringLayout.
| midi_manager | A pointer to the MidiManager for loading MIDI maps. |
| layout | An optional StringLayout pointer to set keyboard layouts. |
|
static |
Loads the saved content version string.
|
static |
Extracts and stores basic preset info (name, author, comments, style, macros) from JSON data.
| save_info | A map where info is stored as key-value pairs. |
| data | The JSON data containing preset info. |
|
static |
Loads the saved synth version string.
|
static |
Loads the saved window size scaling factor.
|
static |
Marks a pack as installed by name in the packs file.
| name | The name of the pack. |
|
static |
Marks a pack as installed by ID in the packs file.
| id | The integer ID of the pack. |
|
static |
Removes a favorite item from the favorites.
| old_favorite | The file to remove from favorites. |
|
static |
Saves additional folder paths for presets, wavetables, or samples.
| name | The category name (e.g., "wavetable_folders"). |
| folders | A vector of folder paths as strings. |
|
static |
Saves the widget animation preference.
| animate_widgets | True if widgets should animate, false otherwise. |
|
static |
Saves the user's authentication status.
| authenticated | True if authenticated, false otherwise. |
|
static |
Saves the provided author name to the config.
| author | The author's name. |
|
static |
Saves the current content version to the config file.
| version | The new content version string. |
|
static |
Saves the given directory as the data directory in the configuration.
| data_directory | The File representing the chosen data directory. |
|
static |
Saves the preference to display frequency in Hz.
| display_hz | True if displaying in Hz, false otherwise. |
|
static |
Saves the given JSON pack configuration to the installed packs file.
| packs | A JSON object representing the current installed packs. |
|
static |
Saves a given JSON object to the configuration file.
| config_state | The JSON object to save. |
|
static |
Saves a JSON object of favorites to the favorites file.
| favorites_json | The JSON object of favorites. |
|
static |
Saves layout configuration (keyboard layout and octave controls).
| layout | A pointer to a StringLayout representing the computer keyboard layout. |
|
static |
Saves the currently loaded skin name to the config.
| name | The skin name as a string. |
|
static |
Saves MIDI mapping configuration.
| midi_manager | A pointer to the MidiManager from which to extract mappings. |
|
static |
Saves a preferred Text-To-Wavetable (TTWT) language to the config.
| language | The language code as a string. |
|
static |
Saves the user's preference regarding update checks.
| check_for_updates | True if updates should be checked, false otherwise. |
|
static |
Saves the current synth version to the config file.
|
static |
Saves the window size scaling factor.
| window_size | The scaling factor to save. |
|
static |
Saves the user's preference for working offline.
| work_offline | True to work offline, false otherwise. |
|
static |
Determines if widget animations are enabled.
|
static |
Checks if Vital should perform update checks.
|
static |
Checks if Vital should operate in offline mode.
Converts the state of a given SynthBase to JSON.
Captures all synth settings, modulations, wavetables, LFO sources, etc.
| synth | A pointer to the SynthBase instance. |
| critical_section | A reference to a CriticalSection for thread safety. |
Updates a JSON state from an older version of Vital's format to the current version.
Applies various transformations to parameter names, ranges, or modulation destinations to maintain compatibility.
| state | The original JSON state. |
|
static |
Checks if Vital was upgraded from a previous version.
|
static |
Writes a crash log to a file in the data directory.
| crash_log | The crash log text. |
|
static |
Appends an error message to an error log file.
| error_log | The error message to write. |
|
static |
|
static |
|
static |
|
static |
Maximum length of preset comments.
|
static |
|
static |
|
static |
|
static |
Various folder and directory name constants.
|
static |