2013-01-16 13:37:48 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2009 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2010-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2013-01-16 13:37:48 -05:00
|
|
|
|
2008-02-01 22:57:35 -05:00
|
|
|
#ifndef __gtk2_ardour_rhythm_ferret_h__
|
|
|
|
#define __gtk2_ardour_rhythm_ferret_h__
|
|
|
|
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/scale.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/radiobutton.h>
|
|
|
|
#include <gtkmm/radiobuttongroup.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/image.h>
|
|
|
|
#include <gtkmm/comboboxtext.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
|
|
|
|
#include "ardour_dialog.h"
|
2010-12-28 20:33:49 -05:00
|
|
|
#include "region_selection.h"
|
2008-02-01 22:57:35 -05:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
2020-09-26 11:14:59 -04:00
|
|
|
class AudioReadable;
|
2008-02-01 22:57:35 -05:00
|
|
|
}
|
|
|
|
|
2010-07-06 07:33:27 -04:00
|
|
|
class Editor;
|
2008-02-01 22:57:35 -05:00
|
|
|
class RegionView;
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
class RhythmFerret : public ArdourDialog
|
|
|
|
{
|
|
|
|
public:
|
2008-02-01 22:57:35 -05:00
|
|
|
/* order of these enums must match the _analyse_mode_strings
|
2017-07-01 15:11:14 -04:00
|
|
|
* in rhythm_ferret.cc
|
|
|
|
*/
|
2008-02-01 22:57:35 -05:00
|
|
|
enum AnalysisMode {
|
|
|
|
PercussionOnset,
|
|
|
|
NoteOnset
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Action {
|
|
|
|
SplitRegion,
|
2011-01-19 13:35:11 -05:00
|
|
|
SnapRegionsToGrid,
|
2008-02-01 22:57:35 -05:00
|
|
|
ConformRegion
|
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-07-06 07:33:27 -04:00
|
|
|
RhythmFerret (Editor&);
|
2008-02-01 22:57:35 -05:00
|
|
|
|
|
|
|
void set_session (ARDOUR::Session*);
|
2017-04-06 18:29:02 -04:00
|
|
|
void on_response (int);
|
2008-03-17 16:54:03 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2008-03-17 16:54:03 -04:00
|
|
|
void on_hide ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2010-07-06 07:33:27 -04:00
|
|
|
Editor& editor;
|
2008-02-01 22:57:35 -05:00
|
|
|
|
2010-04-30 09:29:14 -04:00
|
|
|
Gtk::ComboBoxText operation_selector;
|
2008-02-01 22:57:35 -05:00
|
|
|
|
|
|
|
Gtk::ComboBoxText analysis_mode_selector;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
/* transient detection widgets */
|
|
|
|
|
2008-02-01 22:57:35 -05:00
|
|
|
Gtk::Adjustment detection_threshold_adjustment;
|
|
|
|
Gtk::HScale detection_threshold_scale;
|
|
|
|
Gtk::Adjustment sensitivity_adjustment;
|
|
|
|
Gtk::HScale sensitivity_scale;
|
|
|
|
Gtk::Button analyze_button;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
/* onset detection widgets */
|
|
|
|
|
|
|
|
Gtk::ComboBoxText onset_detection_function_selector;
|
|
|
|
Gtk::Adjustment peak_picker_threshold_adjustment;
|
|
|
|
Gtk::HScale peak_picker_threshold_scale;
|
|
|
|
Gtk::Adjustment silence_threshold_adjustment;
|
|
|
|
Gtk::HScale silence_threshold_scale;
|
2016-05-01 12:48:27 -04:00
|
|
|
#ifdef HAVE_AUBIO4
|
|
|
|
Gtk::Adjustment minioi_adjustment;
|
|
|
|
Gtk::HScale minioi_scale;
|
|
|
|
#endif
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
/* generic stuff */
|
|
|
|
|
2008-02-01 22:57:35 -05:00
|
|
|
Gtk::Adjustment trigger_gap_adjustment;
|
|
|
|
Gtk::SpinButton trigger_gap_spinner;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2008-02-01 22:57:35 -05:00
|
|
|
Gtk::Button action_button;
|
|
|
|
|
|
|
|
std::vector<std::string> analysis_mode_strings;
|
2008-09-10 11:03:30 -04:00
|
|
|
std::vector<std::string> onset_function_strings;
|
2010-04-30 09:29:14 -04:00
|
|
|
std::vector<std::string> operation_strings;
|
2008-02-01 22:57:35 -05:00
|
|
|
|
2008-02-02 12:22:04 -05:00
|
|
|
ARDOUR::AnalysisFeatureList current_results;
|
2008-02-01 22:57:35 -05:00
|
|
|
|
2010-12-28 20:33:49 -05:00
|
|
|
void clear_transients ();
|
|
|
|
/** Regions that we have added transient marks to */
|
|
|
|
RegionSelection regions_with_transients;
|
|
|
|
|
2008-02-01 22:57:35 -05:00
|
|
|
AnalysisMode get_analysis_mode () const;
|
|
|
|
Action get_action() const;
|
2008-09-10 11:03:30 -04:00
|
|
|
void analysis_mode_changed ();
|
|
|
|
int get_note_onset_function ();
|
2008-02-01 22:57:35 -05:00
|
|
|
|
|
|
|
void run_analysis ();
|
2023-02-16 18:33:28 -05:00
|
|
|
int run_percussion_onset_analysis (std::shared_ptr<ARDOUR::AudioReadable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
|
|
|
|
int run_note_onset_analysis (std::shared_ptr<ARDOUR::AudioReadable> region, ARDOUR::sampleoffset_t offset, ARDOUR::AnalysisFeatureList& results);
|
2008-02-01 22:57:35 -05:00
|
|
|
|
|
|
|
void do_action ();
|
|
|
|
void do_split_action ();
|
2008-02-02 12:22:04 -05:00
|
|
|
void do_region_split (RegionView* rv, const ARDOUR::AnalysisFeatureList&);
|
2008-02-01 22:57:35 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_rhythm_ferret_h__ */
|