From 4360502ecfb78f889aed854f775bdc2846f14a5b Mon Sep 17 00:00:00 2001 From: Petr Semiletov Date: Wed, 25 Sep 2024 21:15:02 +0300 Subject: [PATCH] - CDrumCell from Multi --- Source/PluginEditor.cpp | 39 ++++++++++++++++++++++++++++++++++++++- Source/PluginEditor.h | 6 ++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 5c473fd..dc3de29 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -335,7 +335,7 @@ CDrumCell::CDrumCell() cell_label.setFont (f_samplename_font); cell_label.setText ("EMPTY CELL", juce::dontSendNotification); - //cell_label.cell = this; + //cell_label.cell = this; //for CDrumCell xoffs += cell_label.getWidth(); xoffs += XFILLER; @@ -1538,6 +1538,7 @@ bool CCellLabel::isInterestedInFileDrag (const StringArray &files) }; +/* void CCellLabel::filesDropped (const StringArray &files, int x, int y) { if (! editor) @@ -1558,6 +1559,42 @@ void CCellLabel::filesDropped (const StringArray &files, int x, int y) cell->set_name (s->name); setColour (juce::Label::backgroundColourId, juce::Colour (180, 209, 220)); }; +*/ + +void CCellLabel::filesDropped (const StringArray &files, int x, int y) +{ + if (! editor) + return; + + std::string fname = files[0].toStdString(); + + cell->editor->tmr_leds.stopTimer(); + cell->editor->audioProcessor.suspendProcessing (true); + + + cell->editor->need_to_update_cells = false; //чтобы кит не подгрузился по таймеру + + if (! editor->audioProcessor.drumkit) + editor->audioProcessor.drumkit = new CDrumKit(); + + cell->editor->audioProcessor.drumkit->kit_type = KIT_TYPE_QDRUMLABOOH; + + cell->editor->audioProcessor.drumkit->kit_name = cell->editor->l_kit_name.getText().toStdString(); + +// std::cout << "cell_number: " << cell_number << std::endl; + + CDrumSample *s = cell->editor->audioProcessor.drumkit->load_sample_to_index (cell->cell_number, + fname, + cell->editor->audioProcessor.session_samplerate); + + cell->editor->audioProcessor.drumkit->loaded = true; //типа кит целиком загружен + + setText (s->name, juce::dontSendNotification); + cell->set_name (s->name); + setColour (juce::Label::backgroundColourId, juce::Colour (180, 209, 220)); + + cell->editor->audioProcessor.suspendProcessing (false); +} void CAudioProcessorEditor::save_quick_kit() diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index bbb66e1..51d2880 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -149,7 +149,7 @@ class CDrumCell: public juce::Component/*, juce::Button *bt_fx_close; - //CCellLabel cell_label; +// CCellLabel cell_label; Label cell_label; @@ -183,6 +183,7 @@ class CDrumCell: public juce::Component/*, juce::GroupComponent gr_group; + CAudioProcessorEditor *editor = 0; //uplink CLed led; @@ -192,7 +193,8 @@ class CDrumCell: public juce::Component/*, CFx fx; - CCellLabel cell_label; + //CCellLabel cell_label; + Label cell_label; size_t cell_number;