From 226e904a2c7dfb37fbe10ec9c1ecb7d84b9b098c Mon Sep 17 00:00:00 2001 From: Petr Semiletov Date: Mon, 23 Sep 2024 13:27:52 +0300 Subject: [PATCH] 6.0.0 --- NEWS | 11 +-- Source/PluginEditor.cpp | 203 ++++++++++------------------------------ Source/PluginEditor.h | 37 +++----- Source/kits.cpp | 61 +++++------- docs/donate.html | 2 - docs/manual.html | 19 ++-- 6 files changed, 101 insertions(+), 232 deletions(-) diff --git a/NEWS b/NEWS index 54d32e7..206b40b 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,8 @@ - Drumlabooh 5.0.0 + Drumlabooh 6.0.0 - What's new? - The UI was heavy redesigned to add new controls and options. The drumkits list now visible all the time instead of lurky combo box. This allows select kits in a more natural way. The new kits scanner provides kits list faster than before. - To speed-up the loading of large kits with the samplerate that differs from session's samplerate, you can make a resampled copy of the kit using a new "Adapt" button. - Another big enhancement is the MIDI mapping support via plugin's engine. Please read the Manual for details. With built-in mapping modes, you can turn on GM-compatibility mode for e-drums, pads or made Ardour's drum grooves sound right. Almost all Drumlabooh native format kits are updated for such compatibility. SFZ mapping setting are also supported. - Pan mode and panning code are fixed, all panning modes now works as intended. The status log area has been added to make changes more visible. Many code was refactored and rewritten. + Just after a previous "big update" here is another one. Ready-to-use drumkits are good thing, but what about all that thouthands sample packs, commercial and free? We need a way to load and play any samples, not just from the drumkits! + Thus, Drumlabooh 6 introduces the conception of Quick Kits (see the "Quick Custom Kits" section of the Manual). Using buttons "+" and "-" near the cell/slot name, you can add any external samples to the sample slots, remove samples from the slots, and save it as the Quick Kit with some name. + Other news and fixes for this release - GUI at the multi-channel mode has been fixed; many few and boring fixes. Windows build rolled back to compile with JUCE 7, to make it compatible with Windows 7. + The Manual at the homesite (https://psemiletov.github.io/drumlabooh/) is rewritten a lot. Stay tuned, Peter Semiletov diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 9a7c39e..5c473fd 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -236,8 +236,8 @@ CDrumCell::CDrumCell() editor->dlg_fileopen = std::make_unique ("Select file to load...", - File::getSpecialLocation (juce::File::userHomeDirectory), - "*.wav;*.aiff;*.flac;*.mp3;*.ogg"); + File::getSpecialLocation (juce::File::userHomeDirectory), + "*.wav;*.aiff;*.flac;*.mp3;*.ogg"); auto folderChooserFlags = juce::FileBrowserComponent::openMode; @@ -246,7 +246,6 @@ CDrumCell::CDrumCell() juce::File f (editor->dlg_fileopen->getResult()); if (! f.exists()) return; - editor->tmr_leds.stopTimer(); editor->audioProcessor.suspendProcessing (true); @@ -255,7 +254,6 @@ CDrumCell::CDrumCell() editor->need_to_update_cells = false; //чтобы кит не подгрузился по таймеру - if (! editor->audioProcessor.drumkit) editor->audioProcessor.drumkit = new CDrumKit(); @@ -263,7 +261,7 @@ CDrumCell::CDrumCell() editor->audioProcessor.drumkit->kit_name = editor->l_kit_name.getText().toStdString(); - std::cout << "cell_number: " << cell_number << std::endl; +// std::cout << "cell_number: " << cell_number << std::endl; CDrumSample *s = editor->audioProcessor.drumkit->load_sample_to_index (cell_number, fname, @@ -298,34 +296,31 @@ CDrumCell::CDrumCell() bt_cell_clear.onClick = [this] { - - if (! editor) - return; + if (! editor) + return; - if (! editor->audioProcessor.drumkit) - return; + if (! editor->audioProcessor.drumkit) + return; - if (editor->audioProcessor.drumkit->kit_type != KIT_TYPE_QDRUMLABOOH) - { - editor->log ("WRONG KIT TYPE! NEED TO BE THE QUICK KIT\n"); - return; - } + if (editor->audioProcessor.drumkit->kit_type != KIT_TYPE_QDRUMLABOOH) + { + editor->log ("WRONG KIT TYPE! NEED TO BE THE QUICK KIT\n"); + return; + } - editor->tmr_leds.stopTimer(); - editor->audioProcessor.suspendProcessing (true); + editor->tmr_leds.stopTimer(); + editor->audioProcessor.suspendProcessing (true); - - editor->audioProcessor.drumkit->remove_sample_at_index (cell_number); - - cell_label.setText ("EMPTY CELL", juce::dontSendNotification); - set_name (""); - cell_label.setColour (juce::Label::backgroundColourId, juce::Colour (131, 152, 160)); + editor->audioProcessor.drumkit->remove_sample_at_index (cell_number); + + cell_label.setText ("EMPTY CELL", juce::dontSendNotification); + set_name (""); + cell_label.setColour (juce::Label::backgroundColourId, juce::Colour (131, 152, 160)); - editor->audioProcessor.suspendProcessing (false); - editor->tmr_leds.startTimer (1000 / 15); //15 FPS - - }; + editor->audioProcessor.suspendProcessing (false); + editor->tmr_leds.startTimer (1000 / 15); //15 FPS + }; //xoffs += XFILLER; @@ -339,8 +334,6 @@ CDrumCell::CDrumCell() // label.setColour (juce::Label::backgroundColourId, juce::Colour (255, 222, 89)); cell_label.setFont (f_samplename_font); cell_label.setText ("EMPTY CELL", juce::dontSendNotification); - - //cell_label.cell = this; @@ -458,8 +451,8 @@ CDrumCell::CDrumCell() editor->dlg_fileopen = std::make_unique ("Select file to load...", - File::getSpecialLocation (juce::File::userHomeDirectory), - "*.wav;*.aiff;*.flac;*.mp3;*.ogg"); + File::getSpecialLocation (juce::File::userHomeDirectory), + "*.wav;*.aiff;*.flac;*.mp3;*.ogg"); auto folderChooserFlags = juce::FileBrowserComponent::openMode; @@ -468,7 +461,6 @@ CDrumCell::CDrumCell() juce::File f (editor->dlg_fileopen->getResult()); if (! f.exists()) return; - editor->tmr_leds.stopTimer(); editor->audioProcessor.suspendProcessing (true); @@ -477,7 +469,6 @@ CDrumCell::CDrumCell() editor->need_to_update_cells = false; //чтобы кит не подгрузился по таймеру - if (! editor->audioProcessor.drumkit) editor->audioProcessor.drumkit = new CDrumKit(); @@ -517,7 +508,6 @@ CDrumCell::CDrumCell() bt_cell_clear.setSize (16, 16); bt_cell_clear.setTooltip ("Remove sample from quick kit"); - bt_cell_clear.onClick = [this] { @@ -546,29 +536,19 @@ CDrumCell::CDrumCell() editor->audioProcessor.suspendProcessing (false); editor->tmr_leds.startTimer (1000 / 15); //15 FPS - }; - //xoffs += XFILLER; - - - -// xoffs += led.getWidth(); -// xoffs += XFILLER; - + addAndMakeVisible (cell_label); cell_label.setTopLeftPosition (xoffs, YFILLER); -// cell_label.setSize (180, 32); cell_label.setSize (262, 32); cell_label.setColour (juce::Label::textColourId, juce::Colours::black); cell_label.setColour (juce::Label::backgroundColourId, juce::Colour (180, 209, 220)); -// label.setColour (juce::Label::backgroundColourId, juce::Colour (255, 222, 89)); cell_label.setFont (f_samplename_font); cell_label.setText ("EMPTY CELL", juce::dontSendNotification); //cell_label.cell = this; - xoffs += cell_label.getWidth(); xoffs += XFILLER; @@ -595,7 +575,6 @@ CDrumCell::CDrumCell() if (! wnd_fx) { wnd_fx = new CDocumentWindow ("FX", Colours::darkslategrey, DocumentWindow::TitleBarButtons::closeButton, false); - // wnd_fx = new CDocumentWindow ("FX", juce::Colour (246, 226, 206), DocumentWindow::TitleBarButtons::closeButton, false); wnd_fx->setContentNonOwned (&fx, true); } @@ -607,8 +586,8 @@ CDrumCell::CDrumCell() else wnd_fx->addToDesktop();//ComponentPeer::StyleFlags::windowIsTemporary | ComponentPeer::StyleFlags::windowHasTitleBar | ComponentPeer::StyleFlags::windowHasCloseButton); - wnd_fx->setVisible (! wnd_fx->isVisible()); - wnd_fx->setTopLeftPosition (bt_fx.getScreenX() + bt_fx.getWidth(), bt_fx.getScreenY() + bt_fx.getHeight()); + wnd_fx->setVisible (! wnd_fx->isVisible()); + wnd_fx->setTopLeftPosition (bt_fx.getScreenX() + bt_fx.getWidth(), bt_fx.getScreenY() + bt_fx.getHeight()); }; } @@ -667,6 +646,7 @@ void CDrumCell::attach_params (CAudioProcessorEditor *ed, int cellno) } #else + //MULTICHANNEL VERSION void CDrumCell::attach_params (CAudioProcessorEditor *ed, int cellno) @@ -730,7 +710,7 @@ void CAudioProcessorEditor::load_kit() { CDrumSample *s = audioProcessor.drumkit->a_samples[i]; - if (!s) + if (! s) continue; drumcells[i].set_name (s->name); @@ -807,7 +787,6 @@ void CAudioProcessorEditor::load_kit (const std::string &kitpath) void CAudioProcessorEditor::log (const std::string &s) { - String v = s + "\n"; log_area.setFont (f_log); log_area.insertTextAtCaret (s); log_area.setCaretPosition (0); @@ -834,7 +813,6 @@ void CAudioProcessorEditor::adapt() if (! audioProcessor.drumkit->loaded) return; - if (audioProcessor.drumkit->kit_type == KIT_TYPE_DRUMLABOOH) { adapt_drumlabooh(); @@ -955,16 +933,10 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud } */ update_kits_list(); - - //NamedValueSet& drumkits_listbox_props = drumkits_listbox.getProperties(); - //drumkits_listbox_props.set ("fontSize", 24); drumkits_listbox.setRowHeight (32); drumkits_listbox.setModel (&drumkits_model); - //int yoffs = YFILLER * 2 ; - //int xoffs = XFILLER * 2; - //TOP SECTION @@ -996,14 +968,11 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud gr_topbar.setSize (hl_homepage.getRight() + XFILLER, l_plugin_name.getHeight() + YFILLER / 2); gr_topbar.setTopLeftPosition (1, 1); - - + //TOP SECTION END - //LEFT SECTION - //DRUMKITS SELECTOR addAndMakeVisible (gr_drumkits); @@ -1017,8 +986,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud gr_drumkits.setSize (drumkits_listbox.getWidth() + XFILLER * 4, drumkits_listbox.getHeight() + YFILLER * 2); - - //KIT INFO addAndMakeVisible (gr_kitinfo); @@ -1026,10 +993,9 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud gr_kitinfo.setSize (gr_drumkits.getWidth(), 220 + YFILLER); addAndMakeVisible (l_kit_name); + l_kit_name.setText ("EMPTY KIT", NotificationType::dontSendNotification); - l_kit_name.setEditable (false, true); - l_kit_name.setFont (f_kitname_font); l_kit_name.setTopLeftPosition (gr_kitinfo.getX() + XFILLER, gr_kitinfo.getY()); l_kit_name.setSize (280, 48); @@ -1040,8 +1006,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud //kit_image.setCentrePosition ((gr_kitinfo.getX() + gr_kitinfo.getWidth() / 2), (gr_kitinfo.getY() + gr_kitinfo.getHeight() / 2)); kit_image.setCentrePosition ((gr_kitinfo.getX() + gr_kitinfo.getWidth() / 2), (gr_kitinfo.getY() + gr_kitinfo.getHeight() / 2)); - - /* cmb_drumkit_selector.setText ("CLICK HERE TO SELECT THE DRUMKIT", juce::NotificationType::dontSendNotification); @@ -1076,7 +1040,8 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud bt_file_open.onClick = [this] { dlg_fileopen = std::make_unique ("Select file to load...", - File::getSpecialLocation (juce::File::userHomeDirectory)); + File::getSpecialLocation (juce::File::userHomeDirectory), + "*.xml;*.txt;*.sfz"); auto folderChooserFlags = juce::FileBrowserComponent::openMode; @@ -1086,7 +1051,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud if (! f.exists()) return; - std::string full (f.getFullPathName().toRawUTF8()); bool supported = false; @@ -1103,7 +1067,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud if (ends_with (full, "drumkitq.txt")) supported = true; - if (! supported) return; @@ -1112,19 +1075,15 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud tmr_leds.stopTimer(); audioProcessor.load_kit (full); - - //update GUI - -// load_kit(); need_to_update_cells = false; log (audioProcessor.drumkit->kit_name); log (bytes_to_file_size (audioProcessor.drumkit->total_samples_size())); + //update gui with timer tmr_leds.startTimer (1000 / 15); //15 FPS }); - }; @@ -1155,15 +1114,11 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud //END KIT BUTTONS ///////////////////////////////// - - //RIGHT AREA //DRUMCELLS - -// yoffs += 52; drumcells_container.setSize (drumcells[0].getWidth() + XFILLER, drumcells[0].getHeight() * 36); @@ -1176,26 +1131,18 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud // load_kit (audioProcessor.drumkit_path); - addAndMakeVisible (drumcells_group); drumcells_viewer.setViewedComponent (&drumcells_container, false); drumcells_viewer.setScrollBarsShown (true, false); -// drumcells_viewer.setSize (drumcells_container.getWidth() + (XFILLER * 5), 600); drumcells_viewer.setSize (drumcells_container.getWidth() + (XFILLER * 5), 525); drumcells_viewer.setScrollBarThickness (24); drumcells_group.setTopLeftPosition (gr_drumkits.getRight() + XFILLER, gr_topbar.getBottom()); - - -// drumcells_group.setSize (drumcells_viewer.getWidth() + (XFILLER * 3), 699 + (YFILLER * 2)); -// drumcells_group.setSize (drumcells_viewer.getWidth() + (XFILLER * 3), gr_kitbuttons.getBottom()); - //drumcells_group.setSize (drumcells_viewer.getWidth() + (XFILLER * 3), 550); drumcells_group.setSize (drumcells_viewer.getWidth() + (XFILLER * 3), 570); - drumcells_viewer.setTopLeftPosition (drumcells_group.getX() + XFILLER, drumcells_group.getY() + YFILLER); //cmb_drumkit_selector.setSize (drumcells_group.getWidth() - (64 + XFILLER), 48); @@ -1205,24 +1152,19 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud ///////////////////////// //DRUMCELLS END - - + ////////////OPTIONS addAndMakeVisible (gr_options); gr_options.setTopLeftPosition (gr_kitbuttons.getX(), gr_kitbuttons.getBottom()); - - addAndMakeVisible (l_midimap_mode); l_midimap_mode.setTopLeftPosition (gr_options.getX() + XFILLER, gr_options.getY() + YFILLER); l_midimap_mode.setSize (120, 32); l_midimap_mode.setTooltip ("Map drums by the order (Auto)\n or from the kit settings (Kit)"); - cmb_midimap_mode.setColour (juce::ComboBox::backgroundColourId, juce::Colour (87, 110, 113)); cmb_midimap_mode.setColour (juce::ComboBox::textColourId, Colours::white); - addAndMakeVisible (cmb_midimap_mode); cmb_midimap_mode.setSize (180 + XFILLER, 42); @@ -1233,15 +1175,13 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud cmb_midimap_mode.addItem ("Kit", MIDIMAPMODE_FROMKIT); att_midimap_mode.reset (new juce::AudioProcessorValueTreeState::ComboBoxAttachment (valueTreeState, "midimap_mode", cmb_midimap_mode)); - - addAndMakeVisible (l_base_note); l_base_note.setSize (120, 48); l_base_note.setTopLeftPosition (gr_options.getX() + XFILLER, cmb_midimap_mode.getBottom() + YFILLER); - l_base_note.setTooltip ("Number of MIDI note from which\n we start to map instruments in Auto mode, \n default 36"); + l_base_note.setTooltip ("Number of MIDI note from which\n we start to map instruments in Auto mode,\n default 36"); addAndMakeVisible (sl_base_note); sl_base_note.setSliderStyle (juce::Slider::SliderStyle::IncDecButtons); @@ -1251,9 +1191,7 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud sl_base_note.setValue (audioProcessor.base_note_number, dontSendNotification); sl_base_note.addListener (this); sl_base_note.setTooltip ("Number of MIDI note from which\n we start to map instruments, \n default 36"); - - - + addAndMakeVisible (bt_ignore_midi_velocity); att_ignore_midi_velocity.reset (new juce::AudioProcessorValueTreeState::ButtonAttachment (valueTreeState, "ignore_midi_velocity", bt_ignore_midi_velocity)); @@ -1265,15 +1203,12 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud #ifndef MULTICHANNEL - // PAN MODE + // PAN MODE addAndMakeVisible (l_pan_mode); -// l_pan_mode.setTopLeftPosition (bt_global_analog_on.getX(), bt_global_analog_on.getBottom() + YFILLER); - l_pan_mode.setTopLeftPosition (cmb_midimap_mode.getRight() + XFILLER * 4, l_midimap_mode.getY()); - l_pan_mode.setSize (100, 32); cmb_pan_mode.setColour (juce::ComboBox::backgroundColourId, juce::Colour (87, 110, 113)); @@ -1283,7 +1218,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud // cmb_pan_mode.onChange = [this] { panner_modeMenuChanged(); }; cmb_pan_mode.setSize (180 + XFILLER, 42); - cmb_pan_mode.addItem ("equal power panning, law: -3 dB", PANMODE01); //sin/cos panner cmb_pan_mode.addItem ("square root panner, law: -3 dB", PANMODE02); cmb_pan_mode.addItem ("linear panner, law: 0 dB", PANMODE03); @@ -1296,8 +1230,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud cmb_pan_mode.setTopLeftPosition (l_pan_mode.getRight(), l_pan_mode.getY()); - - //////////////NEW GLOBAL ANALOG addAndMakeVisible (bt_global_analog_on); bt_global_analog_on.setButtonText ("Analog"); @@ -1330,7 +1262,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud log_area.setReadOnly (true); log_area.setTopLeftPosition (sl_global_analog_amount.getRight(), l_midimap_mode.getY()); log_area.setSize (224, 148); - gr_options.setSize (drumcells_group.getRight(), sl_base_note.getHeight() + cmb_pan_mode.getHeight() + @@ -1342,21 +1273,17 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud gr_options.getBottom()); #else - addAndMakeVisible (log_area); log_area.setFont (f_log); log_area.setTopLeftPosition (cmb_midimap_mode.getRight() + XFILLER * 2, l_midimap_mode.getY()); log_area.setSize (354, 148); - gr_options.setSize (/*810*/gr_topbar.getRight(), sl_base_note.getHeight() + cmb_midimap_mode.getHeight() + bt_ignore_midi_velocity.getHeight() + YFILLER * 2); //gr_options.setSize (810, bt_ignore_midi_velocity.getBottom()); - - setSize (gr_topbar.getRight() + XFILLER / 2, gr_options.getBottom() + 2); @@ -1365,11 +1292,11 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud //////////////////////// - if (audioProcessor.drumkit) - { - log (audioProcessor.drumkit->kit_name); - log (bytes_to_file_size (audioProcessor.drumkit->total_samples_size())); - } + if (audioProcessor.drumkit) + { + log (audioProcessor.drumkit->kit_name); + log (bytes_to_file_size (audioProcessor.drumkit->total_samples_size())); + } //load_kit(); @@ -1379,8 +1306,6 @@ CAudioProcessorEditor::CAudioProcessorEditor (CAudioProcessor &parent, juce::Aud drumcells[i].cell_label.setColour (juce::Label::backgroundColourId, juce::Colour (131, 152, 160)); } - - tmr_leds.uplink = this; tmr_leds.startTimer (1000 / 15); //15 FPS @@ -1473,19 +1398,6 @@ void CAudioProcessorEditor::sliderValueChanged (juce::Slider* slider) } } - -/* -void CToggleButton.paintButton ( Graphics & g, - bool shouldDrawButtonAsHighlighted, - bool shouldDrawButtonAsDown - ) -{ - - -} -*/ - - void CTimer::hiResTimerCallback() { if (! uplink) @@ -1523,19 +1435,15 @@ void CTimer::hiResTimerCallback() continue; } - #endif - bool actv = s->active; uplink->drumcells[i].led.is_on = actv; uplink->drumcells[i].led.velocity = s->velocity; uplink->drumcells[i].led.repaint(); - } + } } - - CDrumkitsListBoxModel::CDrumkitsListBoxModel() { // JgtGetBoards(); //builds board array and sets numBoards @@ -1565,7 +1473,7 @@ void CDrumkitsListBoxModel::paintListBoxItem (int rowNumber, Graphics &g, int wi else //g.fillAll (Colours::cornflowerblue); //g.fillAll (Colours::plum); - g.fillAll (Colours::paleturquoise); + g.fillAll (Colours::paleturquoise); g.setFont (20); @@ -1586,7 +1494,6 @@ void CDrumkitsListBoxModel::selectedRowsChanged (int lastRowSelected) if (! editor) return; - //editor->log ("LOADING NEW KIT, WAIT...\n"); //std::string full = editor->kits_scanner.map_kits[kits_scanner.v_kits_names [cmb_drumkit_selector.getSelectedId() - 1]]; std::string full = editor->audioProcessor.scanner.map_kits[editor->audioProcessor.scanner.v_kits_names [lastRowSelected]]; //why not direct index? @@ -1607,16 +1514,14 @@ void CDrumkitsListBoxModel::selectedRowsChanged (int lastRowSelected) editor->log ("***\n"); editor->log ("\n"); - editor->log (bytes_to_file_size (editor->audioProcessor.drumkit->total_samples_size())); + editor->log (bytes_to_file_size (editor->audioProcessor.drumkit->total_samples_size())); editor->log ("\n"); editor->log (editor->audioProcessor.drumkit->kit_name); editor->log ("loaded:\n"); } - } - bool CCellLabel::isInterestedInFileDrag (const StringArray &files) { String fname = files[0]; @@ -1638,7 +1543,6 @@ void CCellLabel::filesDropped (const StringArray &files, int x, int y) if (! editor) return; - std::string fname = files[0].toStdString(); if (! editor->audioProcessor.drumkit) @@ -1649,7 +1553,6 @@ void CCellLabel::filesDropped (const StringArray &files, int x, int y) fname, editor->audioProcessor.session_samplerate); - setText (s->name, juce::dontSendNotification); cell->set_name (s->name); @@ -1659,7 +1562,6 @@ void CCellLabel::filesDropped (const StringArray &files, int x, int y) void CAudioProcessorEditor::save_quick_kit() { - if (! audioProcessor.drumkit) { log ("NO DRUMKIT\n"); @@ -1674,11 +1576,10 @@ void CAudioProcessorEditor::save_quick_kit() } if (audioProcessor.drumkit->kit_type != KIT_TYPE_QDRUMLABOOH) - { - log ("WRONG DRUMKIT TYPE, YOU CAN SAVE QUICK KITS ONLY\n"); - return; - } - + { + log ("WRONG DRUMKIT TYPE, YOU CAN SAVE QUICK KITS ONLY\n"); + return; + } std::string kit_path; @@ -1697,8 +1598,7 @@ void CAudioProcessorEditor::save_quick_kit() //std::filesystem::create_directories (kit_path); std::filesystem::create_directories (p); - - + log ("created directory: " + kit_path + "\n"); std::string kit_filename; @@ -1724,4 +1624,3 @@ void CAudioProcessorEditor::save_quick_kit() audioProcessor.suspendProcessing (false); tmr_leds.startTimer (1000 / 15); //15 FPS } - diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 2bc8d08..bbb66e1 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -117,8 +117,6 @@ class CCellLabel: public juce::Label, }; - - #ifndef MULTICHANNEL @@ -132,8 +130,7 @@ class CDrumCell: public juce::Component/*, size_t cell_number; CAudioProcessorEditor *editor = 0; //uplink - - + juce::GroupComponent gr_group; juce::Slider sl_pan; juce::Slider sl_vol; @@ -188,26 +185,23 @@ class CDrumCell: public juce::Component/*, CAudioProcessorEditor *editor = 0; //uplink - CLed led; CDocumentWindow *wnd_fx; CFx fx; - juce::TextButton bt_fx; - - juce::TextButton bt_file_open; - juce::TextButton bt_cell_clear; - - - - juce::Button *bt_fx_close; CCellLabel cell_label; size_t cell_number; + juce::TextButton bt_fx; + juce::Button *bt_fx_close; + juce::TextButton bt_file_open; + juce::TextButton bt_cell_clear; + + CDrumCell(); ~CDrumCell() override; @@ -237,7 +231,7 @@ class CAudioProcessorEditor: public juce::AudioProcessorEditor, juce::AudioProcessorValueTreeState& valueTreeState; - std::unique_ptr att_ignore_midi_velocity; + std::unique_ptr att_ignore_midi_velocity; juce::ToggleButton bt_ignore_midi_velocity; CDrumkitsListBoxModel drumkits_model; @@ -245,26 +239,24 @@ class CAudioProcessorEditor: public juce::AudioProcessorEditor, TextEditor log_area; - - ////////////////////////////////// //OPTIONS CONTROLS #ifndef MULTICHANNEL - std::unique_ptr att_global_analog_on = nullptr; + std::unique_ptr att_global_analog_on = nullptr; juce::ToggleButton bt_global_analog_on; - std::unique_ptr att_global_analog_amount = nullptr; + std::unique_ptr att_global_analog_amount = nullptr; juce::Slider sl_global_analog_amount; - std::unique_ptr att_pan_mode; + std::unique_ptr att_pan_mode; juce::Label l_pan_mode { {}, "Pan mode" }; juce::ComboBox cmb_pan_mode; #endif - std::unique_ptr att_midimap_mode; + std::unique_ptr att_midimap_mode; juce::Label l_midimap_mode { {}, "MIDI map mode" }; juce::ComboBox cmb_midimap_mode; @@ -278,12 +270,11 @@ class CAudioProcessorEditor: public juce::AudioProcessorEditor, //END OF OPTIONS CONTROLS juce::TextButton bt_file_open; - std::unique_ptr dlg_fileopen; + std::unique_ptr dlg_fileopen; juce::TextButton bt_kit_adapt; juce::TextButton bt_kit_save; - - + juce::TooltipWindow tooltip_window; juce::GroupComponent gr_kitinfo; diff --git a/Source/kits.cpp b/Source/kits.cpp index 3b90f73..81654a3 100644 --- a/Source/kits.cpp +++ b/Source/kits.cpp @@ -60,6 +60,9 @@ juce::AudioBuffer * CDrumLayer::load_whole_sample (const std::string &fna { // std::cout << "@@@@@ CDrumLayer::load_whole_sample: " << fname << std::endl; + if (fname.empty()) + return 0; + if (! file_exists (fname)) return 0; @@ -111,7 +114,7 @@ juce::AudioBuffer * CDrumLayer::load_whole_sample (const std::string &fna // if (! reader->read (buffer, 0, bufsize, 0, true, true)) if (! reader->read (buffer, 0, bufsize, 0, true, false)) //read just left channel { - std::cout << "! reader->read " << std::endl; + // std::cout << "! reader->read " << std::endl; delete reader; delete buffer; @@ -420,6 +423,10 @@ bool CHydrogenXMLWalker::for_each (pugi::xml_node &node) if (node_name == "filename" && kit->temp_sample) { std::string fname = txt.as_string(); + + if (fname.empty()) + return false; + std::string path = kit->kit_dir + "/" + fname; std::string sample_name = kit->temp_sample->name; @@ -443,7 +450,7 @@ bool CHydrogenXMLWalker::for_each (pugi::xml_node &node) if (! kit->scan_mode && kit->sample_counter != 0) if (kit->temp_sample->v_layers.size() != 0) - kit->temp_sample->v_layers.back()->load (path.c_str()); + kit->temp_sample->v_layers.back()->load (path.c_str()); } @@ -458,7 +465,7 @@ void CDrumKit::load_txt (const std::string &data) if (data.empty()) return; - size_t i = kit_dir.rfind ("/"); + size_t i = kit_dir.rfind (DIR_SEPARATOR); kit_name = kit_dir.substr (i + 1); kit_type = KIT_TYPE_DRUMLABOOH; @@ -549,7 +556,7 @@ void CDrumKit::load_txt (const std::string &data) if (check_for_rnd) - temp_sample->layer_index_mode = LAYER_INDEX_MODE_RND; + temp_sample->layer_index_mode = LAYER_INDEX_MODE_RND; if (check_for_robin) temp_sample->layer_index_mode = LAYER_INDEX_MODE_ROBIN; @@ -644,7 +651,6 @@ void CDrumKit::load_txt (const std::string &data) image_fname = kitimg; loaded = true; - } @@ -667,8 +673,7 @@ void CDrumKit::load_qtxt (const std::string &data) while (getline (st, line)) { // std::cout << "line:" << line << std::endl; - - + if (line.empty()) continue; @@ -694,12 +699,6 @@ void CDrumKit::load_qtxt (const std::string &data) string sample_name = line.substr (0, pos); string fname = line.substr (pos + 1, line.size() - pos); - - // std::cout << "fname: " << fname << std::endl; - -// std::cout << "fname[0]: " << fname[0] << std::endl; - - if (fname.empty()) continue; @@ -714,15 +713,9 @@ void CDrumKit::load_qtxt (const std::string &data) //if (fname[0] == '/') if (path.is_absolute()) - { filename = fname; //absolute! - } else filename = kit_dir + "/" + fname; - - - std::cout << "load sample: " << filename << std::endl; - //АА ХЕЗ ТУТ ПУСТО! temp_sample = add_sample (sample_counter++); @@ -793,7 +786,7 @@ std::string guess_sample_name (const std::string &raw) //remove all non-letters for (size_t i = 0; i < t.size(); i++) - if (isalpha(t[i])) + if (isalnum (t[i])) result += t[i]; return result; @@ -872,12 +865,9 @@ void CDrumKit::load_sfz (const std::string &data) temp_sample->mapped_note = std::stoi (str_note); map_samples[temp_sample->mapped_note] = temp_sample; } - - } } - pos = line.find (">key="); if (pos != string::npos) { @@ -917,7 +907,7 @@ void CDrumKit::load_sfz (const std::string &data) if (! scan_mode) temp_sample->v_layers.back()->load (fname.c_str()); - temp_sample->name = guess_sample_name (just_name); + temp_sample->name = guess_sample_name (just_name); //FIXIT: возможно guess_sample_name лишнее, не помню } } @@ -969,6 +959,9 @@ void CDrumKit::load (const std::string &fname, int sample_rate) // if (! scan_mode) // cout << "@@@@@@@@@@@@ void CDrumKit::load: " << fname << "samplerate: " << sample_rate << endl; + if (fname.empty()) + return; + auto start = chrono::high_resolution_clock::now(); samplerate = sample_rate; @@ -988,17 +981,12 @@ void CDrumKit::load (const std::string &fname, int sample_rate) std::string source = string_file_load (kit_filename); if (source.empty()) return; - - cout << "1\n"; if (ends_with (kit_filename, "drumkit.txt")) { load_txt (source); return; } - -cout << "2\n"; - if (ends_with (kit_filename, "drumkitq.txt")) { @@ -1006,17 +994,14 @@ cout << "2\n"; return; } -cout << "3\n"; - - if (ends_with (kit_filename, ".sfz")) { load_sfz (source); return; } - //else Hydrogen format + //FIXKIT перенести в отдельную функцию kit_type = KIT_TYPE_HYDROGEN; @@ -1102,7 +1087,6 @@ CDrumKit::~CDrumKit() { if (a_samples[i]) delete a_samples[i]; - } } @@ -1239,7 +1223,8 @@ void CDrumKit::adapt_qkit (std::string new_dir_path) //used at Adapt button hand std::string result; - std::filesystem::create_directories (new_dir_path); + if (! std::filesystem::create_directories (new_dir_path)) + return; for (size_t i = 0; i < 36; i++) { @@ -1317,8 +1302,6 @@ void CDrumKit::adapt_qkit (std::string new_dir_path) //used at Adapt button hand string_save_to_file (new_dir_path + "/drumkitq.txt", result); - - } @@ -1333,7 +1316,6 @@ void CDrumKit::print() } cout << "samples count:" << sample_counter << endl; - cout << "void CDrumKit::print() -- end" << endl; } @@ -1368,6 +1350,7 @@ CDrumKitsScanner::~CDrumKitsScanner() } +//DEPRECATED void CDrumKitsScanner::scan_full() { std::vector v_kits_locations; @@ -1529,7 +1512,6 @@ void CDrumKitsScanner::scan() v_kits_locations.push_back ("c:\\drum_sklad"); - v_kits_locations.push_back ("d:\\drum_sklad"); v_kits_locations.push_back ("c:\\drumlabooh-kits"); v_kits_locations.push_back ("c:\\sfz-kits"); @@ -1613,7 +1595,6 @@ void CDrumKitsScanner::scan() //get the last part of kd kit_name = get_last_part (kd); - if (ext == "sfz") kit_name = get_last_part (kd); diff --git a/docs/donate.html b/docs/donate.html index f28ffeb..c6ff554 100644 --- a/docs/donate.html +++ b/docs/donate.html @@ -19,8 +19,6 @@

Drumlabooh | Драмлабух: DONATE

🥁 Manual | Руководство 🥁 -Drumkits | Драмкиты -🥁 Donate | Донат 🥁

diff --git a/docs/manual.html b/docs/manual.html index 69a58ca..f2f7c5e 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -102,7 +102,7 @@

2.3 Drumlabooh drum kits

2.4 Quick Custom Kits

-

Running Drumlabooh you can quickly make you own kit with external one-shot samples, for example from some drum sample pack. Here is the good resource - www.reddit.com/r/Drumkits/.

+

Running Drumlabooh you can quickly make you own kit with external one-shot samples, for example from some drum sample pack. Here are the good resources with free stuff - www.reddit.com/r/Drumkits/, www.goldbaby.co.nz/freestuff.html.

Quick kit is the "proxy" and simplified kit, that you can make for yourself just from Drumlabooh. To create such kit, do the following steps:

@@ -162,6 +162,7 @@

Full directories list, where Drumalbooh searches for the kits

$HOME/sfz-kits
 C:\sfz-kits
+D:\sfz-kits
 
@@ -333,7 +334,7 @@

2.3 Киты в формате Драмлабуха

2.4 Быстрые самодельные киты

-

Не китами едиными жив человек, в сети доступно много паков с сэмплами, например есть вот такой ресурс - www.reddit.com/r/Drumkits. Как же загрузить отдельные сэмплы в Лабуха? Неужели создавать традиционный драмкит? Нет. На сцену выходят Быстрые киты!

+

Не китами едиными жив человек, в сети доступно много паков с сэмплами, например есть вот такие ресурсы - www.reddit.com/r/Drumkits и www.goldbaby.co.nz/freestuff.html. Как же загрузить отдельные сэмплы в Лабуха? Неужели создавать традиционный драмкит? Нет. На сцену выходят Быстрые киты!

Быстрый кит не хранит в себе сами файлы сэмплов, а лишь запоминает пути к ним. Чтобы создать быстрый кит, надо:

@@ -394,7 +395,10 @@

Полный список папок, где Drumalbooh ищет китыФормат SFZ:

-
$HOME/sfz-kits
+
$HOME/sfz-kits
+C:\sfz-kits
+D:\sfz-kits
+
@@ -469,13 +473,12 @@

5.1 Как использовать многоканальность с Ар

4. Правый клик в верхней части микшерного канала дорожки и выберите Fan out to tracks или Fan out to buses. Подождите немного - и появится группа с моно-дорожками или шинами, в зависимости от того, куда вы распределяли - в дорожки или шины. Чтобы использовать на такой стерео-эффект, надо сделать правый клик на добавленном эффекте, выбрать в появившемя меню пункт Pin connection и соединить порты следующим образом:

-

-

+

5. Теперь все новые дорожки-каналы в группе. Объединены. Чтобы нормально работать с ними по отдельности, надо сделать правый клик на заголовке группы, и выбрать пункт меню Remove group:

- +

6. Теперь осталось удалить ненужные дорожки - например, в драмките только 18 инструментов, а у нас 36 дорожек!

@@ -487,9 +490,7 @@

5.2 Многоканальность в Reaper

2. Подтвердить в Build routing confirmation window.

-

3. Готово!

- -

В Линуксе, почему-то, этот способ не срабатывает с VSTi-версией плагина.

+

3. Готово! В Линуксе, почему-то, этот способ не срабатывает с VSTi-версией плагина.