19 static const Identifier
Name;
20 static const Identifier
Path;
22 static const Identifier
Mute;
23 static const Identifier
Solo;
37 class Sample :
public ValueTree::Listener
45 Sample(ValueTree tree, UndoManager* undoManager =
nullptr);
50 std::function<void(Identifier parameterProperty,
const var& value)>
onChanged{
nullptr};
115 void updateSample(
const String& name,
const String& path);
123 void addSample(
const String& name,
const String& path,
bool isMuted);
155 std::function<void(ValueTree& childWhichHasBeenRemoved,
int indexFromWhichChildWasRemoved)>
sampleRemoved{
274 void valueTreeChildAdded(ValueTree& parentTree, ValueTree& childWhichHasBeenAdded)
override;
279 int indexFromWhichChildWasRemoved)
override;
Definition CustomParameterTree.h:15
ValueTree m_parameterTree
Definition CustomParameterTree.h:113
A wrapper around an individual sample in the tree, with parameters for mute, solo,...
Definition SampleDataTree.h:38
CachedValue< bool > soloValue
Definition SampleDataTree.h:67
UndoManager * m_undoManager
Definition SampleDataTree.h:73
ValueTree valueTree
Definition SampleDataTree.h:70
std::function< void()> muteChanged
Assign a lambda to this to get a callback when the mute parameter changes.
Definition SampleDataTree.h:54
Sample(ValueTree tree, UndoManager *undoManager=nullptr)
Creates a Sample wrapper object.
Definition SampleDataTree.cpp:247
CachedValue< bool > muteValue
Definition SampleDataTree.h:66
CachedValue< String > pathValue
Definition SampleDataTree.h:68
std::function< void()> soloChanged
Definition SampleDataTree.h:55
std::function< void(Identifier parameterProperty, const var &value)> onChanged
Assign a lambda to be called when the sample is changed.
Definition SampleDataTree.h:50
int getIndex() const
Returns the index of the sample within the parent tree.
Definition SampleDataTree.h:61
void valueTreePropertyChanged(ValueTree &treeWhosePropertyHasChanged, const Identifier &property) override
Definition SampleDataTree.cpp:257
CachedValue< String > nameValue
Definition SampleDataTree.h:69
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
const OwnedArray< Sample > & getSamples() const
Definition SampleDataTree.h:140
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
Sample getSample(const String &name)
Returns a Sample object from the tree by name. This is a wrapper around the ValueTree object with typ...
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
Definition AirAbsorptionFilter.cpp:2
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