40 "analyticsEventChangedMidiTriggerEngine"};
45 :
KwidgetGUI(owner), m_soSound(sound), m_owner(owner),
47 Drawable::createFromImageData(KrotosBinaryData::Plus_Icon_svg, KrotosBinaryData::Plus_Icon_svgSize)),
48 m_zoomInButtonImageMouseOver(
49 Drawable::createFromImageData(KrotosBinaryData::Plus_Icon_svg, KrotosBinaryData::Plus_Icon_svgSize)),
50 m_zoomOutButtonImage(Drawable::createFromImageData(KrotosBinaryData::Minus_Icon_svg,
51 KrotosBinaryData::Minus_Icon_svgSize)),
52 m_zoomOutButtonImageMouseOver(Drawable::createFromImageData(KrotosBinaryData::Minus_Icon_svg,
53 KrotosBinaryData::Minus_Icon_svgSize)),
54 m_sampleBrowserButton(
""), m_removeEngineButton(
"", DrawableButton::ImageStretched)
92 m_Pan.
getSlider().setSliderStyle(Slider::SliderStyle::LinearHorizontal);
183 if (owningKwidget !=
nullptr)
206 m_Pan.
getSlider().setSliderStyle(Slider::SliderStyle::LinearHorizontal);
250 if (midiParameter !=
nullptr)
252 const String midiName = midiParameter->
getValue();
263 if (&owner !=
nullptr)
305 m_defaultDeleteButton = Drawable::createFromImageData(KrotosBinaryData::remove_engine_icon_default_png,
306 KrotosBinaryData::remove_engine_icon_default_pngSize);
308 m_hoverDeleteButton = Drawable::createFromImageData(KrotosBinaryData::remove_engine_icon_hover_png,
309 KrotosBinaryData::remove_engine_icon_hover_pngSize);
323 std::function<void(
int)> removeEngineCallback = [
this](
int option) {
330 MessageManager::callAsync([
this]() {
340 AlertWindow::showAsync(MessageBoxOptions()
341 .withIconType(MessageBoxIconType::WarningIcon)
342 .withTitle(
"Removing Engine")
343 .withMessage(
"Are you sure you want to proceed with the\nremoval? This "
344 "action cannot be undone!")
345 .withButton(
"Cancel")
346 .withButton(
"Remove")
347 .withAssociatedComponent(
this),
348 removeEngineCallback);
491 Range<double> scrollbarRange(0.0, 1.0);
495 1.0, NotificationType::dontSendNotification);
580 const bool engineHasAudioSegments = sampleEngine->getNumAudioSegments() > 1;
581 if (engineHasAudioSegments)
584 auto nextSegmentIndex = (
m_selectedSegment + 1) % sampleEngine->getNumAudioSegments();
594 const bool engineHasAudioSegments = sampleEngine->getNumAudioSegments() > 1;
595 if (engineHasAudioSegments)
598 auto nextSegmentIndex = (sampleEngine->getNumAudioSegments() - 1 +
m_selectedSegment) %
599 sampleEngine->getNumAudioSegments();
612 if (lastSampleDeleted)
618 selectSample(jmax<int>(indexFromWhichChildWasRemoved - 1, 0));
663 browser->onSampleSelected = [
this](
int sampleIndex) {
665 PopupMenu::dismissAllActiveMenus();
668 browser->onSampleDeleted = [
this](
int sampleIndex) {
670 PopupMenu::dismissAllActiveMenus();
675 browser->onSampleSolo = [
this](
int sampleIndex,
bool soloState) {
selectSample(sampleIndex,
false); };
679 menu.addCustomItem(item::Browser, std::move(browser));
681 menu.addItem(item::Add,
"Add More Samples",
true,
false,
682 Drawable::createFromImageData(KrotosBinaryData::Add_Sample_Icon_svg,
683 KrotosBinaryData::Add_Sample_Icon_svgSize));
684 menu.addItem(item::RemoveAll,
"Remove All Samples",
true,
false,
685 Drawable::createFromImageData(KrotosBinaryData::Remove_All_Samples_svg,
686 KrotosBinaryData::Remove_All_Samples_svgSize));
688 std::function<void(
int)> menuCallback = [&](
int itemResultID) {
689 switch (itemResultID)
694 case item::RemoveAll:
695 std::function<void(
int)> removeCallback = [
this, target = WeakReference<Component>{
this}](
int option) {
696 if (target && option == 0)
708 AlertWindow::showAsync(MessageBoxOptions()
709 .withIconType(MessageBoxIconType::WarningIcon)
710 .withTitle(
"Sample Removal")
711 .withMessage(
"Are you sure you want to proceed with the\nremoval? This "
712 "action cannot be undone!")
713 .withButton(
"Cancel")
714 .withButton(
"Remove")
721 menu.showMenuAsync(PopupMenu::Options{}
723 .withMinimumNumColumns(1)
732 m_tabbedComponent = std::make_unique<TabbedComponent>(TabbedButtonBar::TabsAtTop);
817 m_Start.setLookAndFeel(
nullptr);
818 m_Size.setLookAndFeel(
nullptr);
819 m_Rate.setLookAndFeel(
nullptr);
821 m_Width.setLookAndFeel(
nullptr);
828 Colour bgColour(31, 37, 46);
829 g.setColour(bgColour);
830 g.fillRoundedRectangle(getLocalBounds().reduced(2).toFloat(), 3.0f);
832 g.setColour(Colours::black);
833 g.drawRoundedRectangle(getLocalBounds().reduced(1).toFloat(), 5.0f, 2.0f);
843 NotificationType::dontSendNotification);
872 auto adsr0 =
m_ampEnvTab.findChildWithID(kwidgetID +
":Adsr0");
873 if (adsr0 !=
nullptr)
879 auto adsr1 =
m_pitchEnvTab.findChildWithID(kwidgetID +
":Adsr1");
880 if (adsr1 !=
nullptr)
926 MouseCursor::hideWaitCursor();
931 MouseCursor::showWaitCursor();
935 for (
const auto& s : files)
937 if (s.containsChar(
'\n'))
960 std::vector<Range<int>> selections)
963 for (
auto& selection : selections)
971 auto files = StringArray::fromLines(samplePaths);
972 if (files.size() == 1)
985 PopupMenu resultsMenu;
987 std::reverse(pathsAndScores.begin(), pathsAndScores.end());
988 for (
const auto& [path, score] : pathsAndScores)
991 auto itemText =
"[" + String(score, 2) +
"] " + fileName;
992 resultsMenu.addItem(++idx, itemText);
994 auto item = resultsMenu.showMenu(PopupMenu::Options());
996 return item > 0 ? String(pathsAndScores[item - 1].first) : samplePaths;
1001 jassert(!pathsAndScores.empty());
1002 if (pathsAndScores.size() <= 2)
1005 return String(pathsAndScores.front().first);
1010 auto n = (int)pathsAndScores.size() - 1;
1011 auto randomIndex = Random::getSystemRandom().nextInt(n);
1012 return String(pathsAndScores[randomIndex].first);
1027 const double newStart = currentRange.getStart() + ((currentRange.getLength() - newThumbSize) / 2);
1029 NotificationType::dontSendNotification);
1034 if (newRange.isEmpty())
1039 static_cast<double>(newRange.getLength()),
1040 NotificationType::dontSendNotification);
1046 const Colour defaultIconColour(177, 177, 177);
1047 const Colour hoverIconColour(217, 217, 217);
1097 jassert(segmentIndex >= 0);
1108 auto sampleName = sample ? sample->nameValue : String();
1119 sampler && cueSelected && segmentIndex < sampler->getNumSamples())
1121 sampler->setNextSegmentIndex(segmentIndex);
WaveformMode
Definition AreaSelectionComp.h:7
static File convertFilePath(const String &)
Definition AssetManager.cpp:604
static String convertFilePathString(const String &)
Definition AssetManager.cpp:583
std::function< void()> onStateChange
Definition AttachedComboBox.h:24
ComboBox & getControlComponent()
Definition AttachedComboBox.cpp:20
void setValueSuffix(String valueSuffix)
Definition AttachedSlider.h:56
Label & getLabel()
Definition AttachedSlider.cpp:163
void setDebugColour(Colour newColour)
Definition AttachedSlider.cpp:171
void setValueFormat(String valueFormat)
Definition AttachedSlider.h:59
Slider & getSlider()
Definition AttachedSlider.cpp:165
void setLabelPosition(LabelPosition position)
Definition AttachedSlider.h:49
A wrapper around juce::ValueTree designed to store custom plugin state (strings, arrays,...
Definition CustomParameter.h:9
const var & getValue() const
Definition CustomParameter.cpp:39
void removeAllChildren()
Removes all children from the tree.
Definition CustomParameterTree.h:88
float get() const
Definition KParameter.cpp:126
void set(float newValue)
Definition KParameter.cpp:128
Definition KrotosSynthesiserSound.h:19
void clearAndFreeBuffer()
Definition KrotosSynthesiserSound.cpp:115
void removeListener(Listener *l)
Definition KrotosSynthesiserSound.h:49
SampleEngine * getSampleEngine() override
Definition KrotosSynthesiserSound.h:44
void addListener(Listener *l)
Definition KrotosSynthesiserSound.h:48
A wrapper around an individual sample in the tree, with parameters for mute, solo,...
Definition SampleDataTree.h:38
A CustomParameterTree for managing a list of samples, with parameters for mute, solo,...
Definition SampleDataTree.h:9
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
std::function< void(Sample &newSample)> sampleAdded
Assign this to do something when a sample has been added to the tree.
Definition SampleDataTree.h:151
const OwnedArray< Sample > & getSamples() const
Definition SampleDataTree.h:140
OwnedArray< SampleBrowser::Sample > getSampleDataAsBrowserSamples()
Helper function to return an array of SampleBrowser::Sample objects populated from the SamplesTree....
Definition SampleDataTree.cpp:180
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
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
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
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
Definition AirAbsorptionFilter.cpp:2
MIDIMode
Definition SampleEngine.h:54
static const Identifier AlertHeightID
Definition Krotos_LookAndFeel.h:24
static const Identifier AlertWidthID
Definition Krotos_LookAndFeel.h:23
static const Identifier Samples
Definition SampleDataTree.h:13