16 sampleIndexValue(m_parameterTree,
Property::SampleIndex, getUndoManager()),
17 selectedSampleValue(m_parameterTree,
Property::SelectedSample, getUndoManager())
23 selectedSampleValue(m_parameterTree,
Property::SelectedSample, getUndoManager())
29 sampleIndexValue(m_parameterTree,
Property::SampleIndex, getUndoManager()),
30 selectedSampleValue(m_parameterTree,
Property::SelectedSample, getUndoManager())
42 selectedSampleValue(m_parameterTree,
Property::SelectedSample, getUndoManager())
48 m_parameterTree = ValueTree();
49 sampleIndexValue.resetToDefault();
50 selectedSampleValue.resetToDefault();
147 std::vector<Range<int>> selections;
159 for (
int i = 0; i < selections.size(); i++)
168 String(range.getLength());
173 auto start = rangeString.upToFirstOccurrenceOf(
m_rangeDelimiter,
false,
false);
174 auto end = rangeString.fromFirstOccurrenceOf(
m_rangeDelimiter,
false,
false)
177 return Range<int>(start.getIntValue(), end.getIntValue());
182 OwnedArray<SampleBrowser::Sample> samples;
190 return std::move(samples);
206 int index = parentTree.indexOf(childWhichHasBeenAdded);
210 jassert(childWhichHasBeenAdded.getType() ==
Type::Sample);
216 int indexFromWhichChildWasRemoved)
220 sampleRemoved(childWhichHasBeenRemoved, indexFromWhichChildWasRemoved);
223 m_samples.remove(indexFromWhichChildWasRemoved);
248 : valueTree(sampleTree), m_undoManager(undoManager),
258 const Identifier& property)
262 onChanged(property, treeWhosePropertyHasChanged.getProperty(property));
286 auto deprecatedSamplePaths = engineCustomParams.getChildWithProperty(
288 if (deprecatedSamplePaths.isValid())
296 for (
auto sample : samplesTree)
310 return Result::fail(
"Did not rewrite samples paths, no samples tree found in " +
id);
Definition CustomParameterTree.h:15
void removeChild(const ValueTree &child)
Definition CustomParameterTree.cpp:52
UndoManager * getUndoManager() const
Definition CustomParameterTree.h:52
ValueTree m_parameterTree
Definition CustomParameterTree.h:113
const ValueTree & getParameterTree() const
Definition CustomParameterTree.h:55
const Identifier getType() const
Definition CustomParameterTree.h:58
ValueTree getChild(int index) const
Definition CustomParameterTree.cpp:54
void setUndoManager(UndoManager *um)
Definition CustomParameterTree.h:49
void addChild(const ValueTree &child, int index=-1)
Definition CustomParameterTree.cpp:47
ValueTree valueTree
Definition SampleDataTree.h:70
Sample(ValueTree tree, UndoManager *undoManager=nullptr)
Creates a Sample wrapper object.
Definition SampleDataTree.cpp:247
void valueTreePropertyChanged(ValueTree &treeWhosePropertyHasChanged, const Identifier &property) override
Definition SampleDataTree.cpp:257
A CustomParameterTree for managing a list of samples, with parameters for mute, solo,...
Definition SampleDataTree.h:9
void valueTreeParentChanged(ValueTree &treeWhoseParentHasChanged) override
Definition SampleDataTree.cpp:226
void setSampleIndex(int index)
Set the current index of the sample playback queue.
Definition SampleDataTree.cpp:193
std::function< void()> dropCompleted
Assign this to do something once a "drop" action has been completed. This is called internally by the...
Definition SampleDataTree.h:175
std::function< void(int sampleIndex)> sampleIndexChanged
Assign a lambda to this callback to do something when the sample_index property has been changed.
Definition SampleDataTree.h:181
void valueTreePropertyChanged(ValueTree &treeWhosePropertyHasChanged, const Identifier &property) override
Definition SampleDataTree.cpp:234
void valueTreeChildAdded(ValueTree &parentTree, ValueTree &childWhichHasBeenAdded) override
Definition SampleDataTree.cpp:204
static String rangeToString(const Range< int > &range)
Converts a range to a string in the format "start:end:length". Convert it back using stringToRange.
Definition SampleDataTree.cpp:165
std::function< void(Sample &newSample)> sampleAdded
Assign this to do something when a sample has been added to the tree.
Definition SampleDataTree.h:151
OwnedArray< Sample > m_samples
Definition SampleDataTree.h:283
static constexpr const char * m_rangeDelimiter
Definition SampleDataTree.h:284
CachedValue< int > sampleIndexValue
Get the current index of the sample playback queue.
Definition SampleDataTree.h:255
void valueTreeChildRemoved(ValueTree &parentTree, ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override
Definition SampleDataTree.cpp:215
OwnedArray< SampleBrowser::Sample > getSampleDataAsBrowserSamples()
Helper function to return an array of SampleBrowser::Sample objects populated from the SamplesTree....
Definition SampleDataTree.cpp:180
SamplesTree()
Creates a SamplesTree with a predefined type of Type::Samples.
Definition SampleDataTree.cpp:14
void removeSample(const String &name)
Removes a sample from the tree by name.
Definition SampleDataTree.cpp:116
CachedValue< int > selectedSampleValue
The index of the last sample to be selected by the user.
Definition SampleDataTree.h:260
void setSampleSelections(const std::vector< Range< int > > &selections)
Set the selection ranges for all samples in the tree. The index of the selection range in the vector ...
Definition SampleDataTree.cpp:157
void updateSample(const String &name, const String &path)
Updates a sample in the tree with a new name and path. If the sample exists, it's name and path will ...
Definition SampleDataTree.cpp:85
const int getNumSamples() const
Returns the number of samples in the samples tree.
Definition SampleDataTree.h:145
void addSample(const String &name, const String &path, bool isMuted)
Add a new sample into the tree.
Definition SampleDataTree.cpp:98
void setSampleSelection(int index, const Range< int > selection)
Set the selection range for a sample by index.
Definition SampleDataTree.cpp:134
static Range< int > stringToRange(const String &rangeString)
Converts a string to a range. The expected string is one generated from rangeToString....
Definition SampleDataTree.cpp:171
std::vector< Range< int > > getSampleSelections() const
Get the selection ranges for all samples in the tree. The index of the selection range in the vector ...
Definition SampleDataTree.cpp:145
std::function< void(ValueTree &childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved)> sampleRemoved
Assign this to do something when a sample has been removed from the tree.
Definition SampleDataTree.h:155
const StringArray getFiles() const
Compatibility method for KrotosSampleOscillatorSound which requires samples to be loaded all at once ...
Definition SampleDataTree.cpp:122
Range< int > getSampleSelection(int index) const
Get the selection range for a sample by index.
Definition SampleDataTree.cpp:140
static Result rewriteSamplePaths(ValueTree &engineKwidgetTree, File newAbsolutePath)
Rewrite relative SamplePath path values created by the PresetBundler into absolute ones of a given pa...
Definition SampleDataTree.cpp:281
std::function< void(int sampleIndex)> selectedSampleChanged
Assign a lambda to this callback to do something when the selected_sample property has been changed.
Definition SampleDataTree.h:187
SamplesTree & operator=(const SamplesTree &other)
Copy assignment operator.
Definition SampleDataTree.cpp:68
String convertFilePathString(const String &inputPath)
Converts a file path passed as a raw string, to the current platform. Has no effect if the path is al...
Definition helpers.cpp:129
String StringsIntoPath(Args... args)
Joins multiple string arguments into a path string.
Definition helpers.h:25
Definition AirAbsorptionFilter.cpp:2
Wrapper object for sample data used by the browser. The Value objects are shared reference objects wh...
Definition SampleBrowser.h:18
Definition SampleDataTree.h:18
static const Identifier Path
Definition SampleDataTree.h:20
static const Identifier Selection
Definition SampleDataTree.h:21
static const Identifier SelectedSample
Definition SampleDataTree.h:28
static const Identifier SampleIndex
Definition SampleDataTree.h:26
static const Identifier Name
Definition SampleDataTree.h:19
static const Identifier Solo
Definition SampleDataTree.h:23
static const Identifier Mute
Definition SampleDataTree.h:22
Definition SampleDataTree.h:12
static const Identifier Sample
Definition SampleDataTree.h:14
static const Identifier Samples
Definition SampleDataTree.h:13
static const Identifier id
Definition XmlType.h:41
static const Identifier value
Definition XmlType.h:42
static const Identifier customParams
Definition XmlType.h:20