2005-10-27 15:46:27 -04:00
|
|
|
/*
|
2006-12-01 01:01:30 -05:00
|
|
|
Copyright (C) 2005-2006 Paul Davis
|
2005-10-27 15:46:27 -04:00
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-10-12 16:06:20 -04:00
|
|
|
#ifndef __ardour_sfdb_ui_h__
|
|
|
|
#define __ardour_sfdb_ui_h__
|
|
|
|
|
|
|
|
#include <string>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <vector>
|
2007-10-11 18:07:47 -04:00
|
|
|
#include <map>
|
2005-10-12 16:06:20 -04:00
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
#include <sigc++/signal.h>
|
|
|
|
|
2012-01-18 13:43:43 -05:00
|
|
|
#include <gtkmm/stock.h>
|
2005-10-12 23:48:57 -04:00
|
|
|
#include <gtkmm/box.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/button.h>
|
2005-10-12 23:48:57 -04:00
|
|
|
#include <gtkmm/checkbutton.h>
|
2007-01-05 14:53:38 -05:00
|
|
|
#include <gtkmm/comboboxtext.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/dialog.h>
|
2005-12-07 17:57:47 -05:00
|
|
|
#include <gtkmm/entry.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/filechooserwidget.h>
|
2005-12-07 17:57:47 -05:00
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/label.h>
|
2014-01-16 18:20:58 -05:00
|
|
|
#include <gtkmm/scale.h>
|
2009-05-13 20:13:27 -04:00
|
|
|
#include <gtkmm/textview.h>
|
2012-01-18 13:43:43 -05:00
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/notebook.h>
|
|
|
|
|
2005-12-07 17:57:47 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/audiofilesource.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "ardour/session_handle.h"
|
2005-10-12 16:06:20 -04:00
|
|
|
|
2012-12-23 13:25:26 -05:00
|
|
|
#include "ardour_window.h"
|
2006-03-22 12:03:00 -05:00
|
|
|
#include "editing.h"
|
2009-05-13 20:13:27 -04:00
|
|
|
#include "audio_clock.h"
|
2005-12-02 17:12:56 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GainMeter;
|
2012-04-05 17:31:55 -04:00
|
|
|
class Mootcher;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2014-01-16 18:20:58 -05:00
|
|
|
class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
|
2005-12-07 17:57:47 -05:00
|
|
|
{
|
|
|
|
public:
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileBox (bool persistent);
|
2006-12-01 01:01:30 -05:00
|
|
|
virtual ~SoundFileBox () {};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
void set_session (ARDOUR::Session* s);
|
2010-09-14 12:51:02 -04:00
|
|
|
bool setup_labels (const std::string& filename);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
void audition();
|
|
|
|
bool audition_oneshot();
|
|
|
|
bool autoplay () const;
|
2014-01-18 18:45:08 -05:00
|
|
|
void set_src_quality(ARDOUR::SrcQuality q) { _src_quality = q; }
|
2005-12-07 17:57:47 -05:00
|
|
|
|
|
|
|
protected:
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
ARDOUR::SoundFileInfo sf_info;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Table table;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Label length;
|
|
|
|
Gtk::Label format;
|
|
|
|
Gtk::Label channels;
|
|
|
|
Gtk::Label samplerate;
|
|
|
|
Gtk::Label timecode;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
Gtk::Label channels_value;
|
|
|
|
Gtk::Label samplerate_value;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Label format_text;
|
|
|
|
AudioClock length_clock;
|
|
|
|
AudioClock timecode_clock;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Frame border_frame;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Label preview_label;
|
|
|
|
|
|
|
|
Gtk::TextView tags_entry;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::VBox main_box;
|
|
|
|
Gtk::VBox path_box;
|
|
|
|
Gtk::HBox bottom_box;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Button play_btn;
|
|
|
|
Gtk::Button stop_btn;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::CheckButton autoplay_btn;
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Button apply_btn;
|
2014-01-16 18:20:58 -05:00
|
|
|
Gtk::HScale seek_slider;
|
|
|
|
|
|
|
|
PBD::ScopedConnectionList auditioner_connections;
|
|
|
|
void audition_active(bool);
|
|
|
|
void audition_progress(ARDOUR::framecnt_t, ARDOUR::framecnt_t);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
bool tags_entry_left (GdkEventFocus* event);
|
2007-10-11 18:07:47 -04:00
|
|
|
void tags_changed ();
|
|
|
|
void save_tags (const std::vector<std::string>&);
|
|
|
|
void stop_audition ();
|
2014-01-16 18:20:58 -05:00
|
|
|
bool seek_button_press(GdkEventButton*);
|
|
|
|
bool seek_button_release(GdkEventButton*);
|
|
|
|
bool _seeking;
|
2014-01-18 18:45:08 -05:00
|
|
|
ARDOUR::SrcQuality _src_quality;
|
2005-12-07 17:57:47 -05:00
|
|
|
};
|
|
|
|
|
2012-12-23 13:25:26 -05:00
|
|
|
class SoundFileBrowser : public ArdourWindow
|
2005-10-12 17:59:45 -04:00
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
private:
|
|
|
|
class FoundTagColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> pathname;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
FoundTagColumns() { add(pathname); }
|
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-11-14 17:04:14 -05:00
|
|
|
class FreesoundColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gtk::TreeModelColumn<std::string> id;
|
|
|
|
Gtk::TreeModelColumn<std::string> uri;
|
|
|
|
Gtk::TreeModelColumn<std::string> filename;
|
2012-03-09 17:02:48 -05:00
|
|
|
Gtk::TreeModelColumn<std::string> duration;
|
2012-12-21 12:28:44 -05:00
|
|
|
Gtk::TreeModelColumn<std::string> filesize;
|
|
|
|
Gtk::TreeModelColumn<std::string> smplrate;
|
2012-12-21 14:32:19 -05:00
|
|
|
Gtk::TreeModelColumn<std::string> license;
|
2013-06-14 14:17:24 -04:00
|
|
|
Gtk::TreeModelColumn<bool> started;
|
2012-03-09 17:02:48 -05:00
|
|
|
|
|
|
|
FreesoundColumns() {
|
|
|
|
add(id);
|
|
|
|
add(filename);
|
|
|
|
add(uri);
|
|
|
|
add(duration);
|
2012-12-21 12:28:44 -05:00
|
|
|
add(filesize);
|
|
|
|
add(smplrate);
|
2012-12-21 14:32:19 -05:00
|
|
|
add(license);
|
2013-06-14 14:17:24 -04:00
|
|
|
add(started);
|
2012-03-09 17:02:48 -05:00
|
|
|
}
|
2011-11-14 17:04:14 -05:00
|
|
|
};
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
FoundTagColumns found_list_columns;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> found_list;
|
|
|
|
|
2011-11-14 17:04:14 -05:00
|
|
|
FreesoundColumns freesound_list_columns;
|
2008-04-11 10:06:50 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> freesound_list;
|
|
|
|
|
2013-03-15 15:59:19 -04:00
|
|
|
Gtk::Button freesound_more_btn;
|
2013-06-14 14:17:24 -04:00
|
|
|
Gtk::Button freesound_similar_btn;
|
2011-11-14 17:04:14 -05:00
|
|
|
|
2013-06-14 14:17:24 -04:00
|
|
|
void handle_freesound_results(std::string theString);
|
2005-10-12 17:59:45 -04:00
|
|
|
public:
|
2012-12-23 15:34:43 -05:00
|
|
|
SoundFileBrowser (std::string title, ARDOUR::Session* _s, bool persistent);
|
2007-02-01 14:53:58 -05:00
|
|
|
virtual ~SoundFileBrowser ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-12-23 13:25:26 -05:00
|
|
|
int run ();
|
|
|
|
int status () const { return _status; }
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
virtual void set_session (ARDOUR::Session*);
|
2010-09-14 12:51:02 -04:00
|
|
|
std::vector<std::string> get_paths ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void clear_selection ();
|
2006-03-22 12:03:00 -05:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::FileChooserWidget chooser;
|
2008-04-11 10:06:50 -04:00
|
|
|
|
|
|
|
SoundFileBox preview;
|
|
|
|
|
|
|
|
Gtk::Entry found_entry;
|
|
|
|
Gtk::Button found_search_btn;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::TreeView found_list_view;
|
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
Gtk::Entry freesound_entry;
|
2011-11-14 17:04:14 -05:00
|
|
|
Gtk::ComboBoxText freesound_sort;
|
2013-03-15 15:59:19 -04:00
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
Gtk::Button freesound_search_btn;
|
|
|
|
Gtk::TreeView freesound_list_view;
|
2013-06-14 14:17:24 -04:00
|
|
|
Gtk::Notebook notebook;
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2011-11-14 17:04:14 -05:00
|
|
|
void freesound_search();
|
2013-06-14 14:17:24 -04:00
|
|
|
void refresh_display(std::string ID, std::string file);
|
2012-04-05 17:31:55 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
protected:
|
|
|
|
bool resetting_ourselves;
|
2012-12-21 14:32:21 -05:00
|
|
|
int matches;
|
2012-12-23 13:25:26 -05:00
|
|
|
int _status;
|
|
|
|
bool _done;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-05-17 06:58:00 -04:00
|
|
|
Gtk::FileFilter audio_and_midi_filter;
|
2008-02-18 14:45:52 -05:00
|
|
|
Gtk::FileFilter audio_filter;
|
|
|
|
Gtk::FileFilter midi_filter;
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtk::FileFilter custom_filter;
|
2007-05-15 22:21:41 -04:00
|
|
|
Gtk::FileFilter matchall_filter;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::HBox hpacker;
|
2012-12-23 13:25:26 -05:00
|
|
|
Gtk::VBox vpacker;
|
|
|
|
|
|
|
|
Gtk::Button ok_button;
|
|
|
|
Gtk::Button cancel_button;
|
|
|
|
Gtk::Button apply_button;
|
2007-02-01 14:53:58 -05:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
static std::string persistent_folder;
|
2007-02-01 14:53:58 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
GainMeter* gm;
|
|
|
|
Gtk::VBox meter_packer;
|
|
|
|
void add_gain_meter ();
|
|
|
|
void remove_gain_meter ();
|
|
|
|
void meter ();
|
|
|
|
void start_metering ();
|
|
|
|
void stop_metering ();
|
|
|
|
sigc::connection metering_connection;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
void update_preview ();
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2007-01-04 23:24:23 -05:00
|
|
|
void found_list_view_selected ();
|
2007-10-11 18:07:47 -04:00
|
|
|
void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
|
2007-01-04 23:24:23 -05:00
|
|
|
void found_search_clicked ();
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
void freesound_list_view_selected ();
|
|
|
|
void freesound_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
|
|
|
|
void freesound_search_clicked ();
|
2013-03-15 15:59:19 -04:00
|
|
|
void freesound_more_clicked ();
|
2013-06-14 14:17:24 -04:00
|
|
|
void freesound_similar_clicked ();
|
2013-03-15 15:59:19 -04:00
|
|
|
int freesound_page;
|
2012-01-18 13:43:43 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void chooser_file_activated ();
|
2013-06-14 14:17:24 -04:00
|
|
|
std::string freesound_get_audio_file(Gtk::TreeIter iter);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-02-18 14:45:52 -05:00
|
|
|
bool on_audio_filter (const Gtk::FileFilter::Info& filter_info);
|
|
|
|
bool on_midi_filter (const Gtk::FileFilter::Info& filter_info);
|
2012-05-17 06:58:00 -04:00
|
|
|
bool on_audio_and_midi_filter (const Gtk::FileFilter::Info& filter_info);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2012-12-23 13:39:19 -05:00
|
|
|
void set_action_sensitive (bool);
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
virtual bool reset_options() { return true; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void on_show();
|
2012-12-23 13:25:26 -05:00
|
|
|
virtual void do_something (int action);
|
2005-10-12 17:59:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class SoundFileChooser : public SoundFileBrowser
|
2005-10-12 16:06:20 -04:00
|
|
|
{
|
|
|
|
public:
|
2012-12-23 15:34:43 -05:00
|
|
|
SoundFileChooser (std::string title, ARDOUR::Session* _s = 0);
|
2006-12-01 01:01:30 -05:00
|
|
|
virtual ~SoundFileChooser () {};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string get_filename ();
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void on_hide();
|
2005-10-12 16:06:20 -04:00
|
|
|
};
|
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
class SoundFileOmega : public SoundFileBrowser
|
2005-10-12 17:59:45 -04:00
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2005-10-12 17:59:45 -04:00
|
|
|
public:
|
2012-12-23 15:34:43 -05:00
|
|
|
SoundFileOmega (std::string title, ARDOUR::Session* _s,
|
2011-07-26 13:22:10 -04:00
|
|
|
uint32_t selected_audio_tracks, uint32_t selected_midi_tracks,
|
|
|
|
bool persistent,
|
2007-10-11 18:07:47 -04:00
|
|
|
Editing::ImportMode mode_hint = Editing::ImportAsTrack);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-07-26 13:22:10 -04:00
|
|
|
void reset (uint32_t selected_audio_tracks, uint32_t selected_midi_tracks);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::ComboBoxText action_combo;
|
|
|
|
Gtk::ComboBoxText where_combo;
|
|
|
|
Gtk::ComboBoxText channel_combo;
|
|
|
|
Gtk::ComboBoxText src_combo;
|
|
|
|
|
|
|
|
Gtk::CheckButton copy_files_btn;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
void set_mode (Editing::ImportMode);
|
2007-10-11 18:07:47 -04:00
|
|
|
Editing::ImportMode get_mode() const;
|
|
|
|
Editing::ImportPosition get_position() const;
|
|
|
|
Editing::ImportDisposition get_channel_disposition() const;
|
|
|
|
ARDOUR::SrcQuality get_src_quality() const;
|
2005-10-12 17:59:45 -04:00
|
|
|
|
|
|
|
protected:
|
2007-10-11 18:07:47 -04:00
|
|
|
void on_hide();
|
|
|
|
|
|
|
|
private:
|
2011-07-26 13:22:10 -04:00
|
|
|
uint32_t selected_audio_track_cnt;
|
|
|
|
uint32_t selected_midi_track_cnt;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
typedef std::map<std::string,Editing::ImportDisposition> DispositionMap;
|
2007-10-11 18:07:47 -04:00
|
|
|
DispositionMap disposition_map;
|
|
|
|
|
|
|
|
Gtk::HBox options;
|
|
|
|
Gtk::VBox block_two;
|
|
|
|
Gtk::VBox block_three;
|
|
|
|
Gtk::VBox block_four;
|
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
bool check_info (const std::vector<std::string>& paths,
|
2007-10-11 18:07:47 -04:00
|
|
|
bool& same_size, bool& src_needed, bool& multichannel);
|
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
static bool check_link_status (const ARDOUR::Session*, const std::vector<std::string>& paths);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
void file_selection_changed ();
|
|
|
|
bool reset_options ();
|
|
|
|
void reset_options_noret ();
|
|
|
|
bool bad_file_message ();
|
2014-01-18 18:45:08 -05:00
|
|
|
void src_combo_changed ();
|
2012-12-23 13:25:26 -05:00
|
|
|
|
|
|
|
void do_something (int action);
|
2005-10-12 23:48:57 -04:00
|
|
|
};
|
2005-10-12 17:59:45 -04:00
|
|
|
|
2005-10-12 16:06:20 -04:00
|
|
|
#endif // __ardour_sfdb_ui_h__
|