Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_preset_pack_manager.h
1// SPDX-FileCopyrightText: © 2022-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __SETTINGS_CHORD_PRESET_PACK_MANAGER_H__
5#define __SETTINGS_CHORD_PRESET_PACK_MANAGER_H__
6
7#include "zrythm-config.h"
8
9#include "gui/backend/backend/settings/chord_preset_pack.h"
10
16
17#define CHORD_PRESET_PACK_MANAGER (gZrythm->chord_preset_pack_manager_)
18
22class ChordPresetPackManager
23{
24public:
25 ChordPresetPackManager () { add_standard_packs (); }
26
32 ChordPresetPackManager (bool scan_for_packs) : ChordPresetPackManager ()
33 {
34 if (scan_for_packs)
35 {
36 add_user_packs ();
37 }
38 };
39
40 size_t get_num_packs () const;
41
42 ChordPresetPack * get_pack_at (size_t idx);
43
44 ChordPresetPack * get_pack_for_preset (const ChordPreset &pset);
45
46 int get_pack_index (const ChordPresetPack &pack) const;
47
51 int get_pset_index (const ChordPreset &pset);
52
59 void
60 add_preset (ChordPresetPack &pack, const ChordPreset &pset, bool serialize);
61
65 void add_pack (const ChordPresetPack &pack, bool serialize);
66
67 void delete_pack (const ChordPresetPack &pack, bool serialize);
68
69 void delete_preset (const ChordPreset &pset, bool serialize);
70
76 void serialize ();
77
78private:
79 void add_standard_packs ();
80 void add_user_packs ();
81 static fs::path get_user_packs_path ();
82 static constexpr const char * UserPacksDirName = "chord-preset-packs";
83 static constexpr const char * UserPackJsonFilename = "chord-presets.json";
84
85public:
89 std::vector<std::unique_ptr<ChordPresetPack>> packs_;
90};
91
95
96#endif // __SETTINGS_CHORD_PRESET_PACK_MANAGER_H__
std::vector< std::unique_ptr< ChordPresetPack > > packs_
Scanned preset packs.
int get_pset_index(const ChordPreset &pset)
Returns the preset index in its pack.
void serialize()
Serializes the chord presets.
void add_preset(ChordPresetPack &pack, const ChordPreset &pset, bool serialize)
Add a copy of the given preset to the given preset pack and optionally serializes the pack manager.
void add_pack(const ChordPresetPack &pack, bool serialize)
Add a copy of the given pack.
ChordPresetPackManager(bool scan_for_packs)
Construct a new Chord Preset Pack Manager object.
Chord preset pack.
A preset of chord descriptors.