This commit is contained in:
VKamyshniy 2015-01-30 01:24:02 +02:00
parent 28efa3f82d
commit a019dc755c
4 changed files with 205 additions and 0 deletions

View file

@ -49,6 +49,7 @@
#include "ardour_ui.h"
#include "editor.h"
#include "sfdb_ui.h"
#include "waves_import_dialog.h"
#include "editing.h"
#include "audio_time_axis.h"
#include "midi_time_axis.h"
@ -73,6 +74,9 @@ using std::string;
void
Editor::add_external_audio_action (ImportMode mode_hint)
{
std::cout << "**********************************************" << std::endl;
std::cout << "Editor::add_external_audio_action" << std::endl;
std::cout << "**********************************************" << std::endl;
if (_session == 0) {
WavesMessageDialog msg ("", _("You can't import or embed an audiofile until you have a session loaded."));
msg.run ();
@ -91,6 +95,8 @@ Editor::add_external_audio_action (ImportMode mode_hint)
void
Editor::external_audio_dialog ()
{
WavesImportDialog import_dialog;
import_dialog.run ();
vector<string> paths;
uint32_t audio_track_cnt;
uint32_t midi_track_cnt;

View file

@ -0,0 +1,116 @@
/*
Copyright (C) 2005-2006 Paul Davis
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.
*/
#include "waves_import_dialog.h"
WavesImportDialog::WavesImportDialog ()
: WavesDialog ("waves_import_dialog.xml", true, false )
, _add_as_dropdown (get_waves_dropdown ("add_as_dropdown"))
, _insert_at_dropdown (get_waves_dropdown ("insert_at_dropdown"))
, _mapping_dropdown (get_waves_dropdown ("mapping_dropdown"))
, _quality_dropdown (get_waves_dropdown ("quality_dropdown"))
, _copy_to_session_button (get_waves_button ("copy_to_session_button"))
{
get_waves_button ("import_button").signal_clicked.connect (sigc::mem_fun (*this, &WavesImportDialog::_on_import_button));
get_waves_button ("cancel_button").signal_clicked.connect (sigc::mem_fun (*this, &WavesImportDialog::_on_cancel_button));
}
ARDOUR::SrcQuality
WavesImportDialog::_get_src_quality() const
{
ARDOUR::SrcQuality quality;
switch (_quality_dropdown.get_item_data_u (_quality_dropdown.get_current_item ())) {
case Good:
quality = ARDOUR::SrcGood;
break;
case Quick:
quality = ARDOUR::SrcQuick;
break;
case Fast:
quality = ARDOUR::SrcFast;
break;
case Fastest:
quality = ARDOUR::SrcFastest;
break;
case Best:
default:
quality = ARDOUR::SrcBest;
break;
}
return quality;
}
Editing::ImportMode
WavesImportDialog::_get_import_mode() const
{
Editing::ImportMode import_mode;
switch (_add_as_dropdown.get_item_data_u (_add_as_dropdown.get_current_item ())) {
case AsTrack:
import_mode = Editing::ImportAsTrack;
break;
case ToTrack:
import_mode = Editing::ImportToTrack;
case AsRegion:
import_mode = Editing::ImportAsRegion;
break;
case AsTapeTrack:
import_mode = Editing::ImportAsTapeTrack;
break;
default:
break;
}
return import_mode;
}
void
WavesImportDialog::_on_cancel_button (WavesButton*)
{
response (Gtk::RESPONSE_CANCEL);
}
void
WavesImportDialog::_on_import_button (WavesButton*)
{
_done = true;
_status = Gtk::RESPONSE_OK;
ARDOUR::Session* session = ARDOUR_UI::instance()->the_session();
framepos_t where;
switch (_insert_at_dropdown.get_item_data_u (_insert_at_dropdown.get_current_item ())) {
case EditPoint:
where = PublicEditor::instance().get_preferred_edit_position ();
break;
case Timestamp:
where = -1;
break;
case Playhead:
where = session->transport_frame();
break;
case Start:
default:
where = session->current_start_frame();
break;
}
ARDOUR::SrcQuality quality = _get_src_quality ();
response (Gtk::RESPONSE_OK);
}

View file

@ -0,0 +1,82 @@
/*
Copyright (C) 2005-2006 Paul Davis
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.
*/
#ifndef __waves_import_dialog_h__
#define __waves_import_dialog_h__
#include <string>
#include <vector>
#include <map>
#include <sigc++/signal.h>
#include "ardour/audiofilesource.h"
#include "ardour/session_handle.h"
#include "ardour/session.h"
#include "editing.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "waves_dialog.h"
class WavesImportDialog : public WavesDialog
{
public:
WavesImportDialog ();
private:
enum Impord {
AsTrack = 0,
ToTrack = 1,
AsRegion = 2,
AsTapeTrack = 3
};
enum InsertionPosition {
Timestamp = 0,
EditPoint = 1,
Playhead = 2,
Start = 3
};
enum ConversionQuality {
Best = 0,
Good = 1,
Quick = 2,
Fast = 3,
Fastest = 4
};
ARDOUR::SrcQuality _get_src_quality () const;
Editing::ImportMode _get_import_mode() const;
void _on_cancel_button (WavesButton*);
void _on_import_button (WavesButton*);
int _status;
bool _done;
WavesDropdown& _add_as_dropdown;
WavesDropdown& _insert_at_dropdown;
WavesDropdown& _mapping_dropdown;
WavesDropdown& _quality_dropdown;
WavesButton& _copy_to_session_button;
};
#endif // __waves_import_dialog_h__

View file

@ -28,6 +28,7 @@ path_prefix = 'gtk2_ardour/'
gtk2_ardour_sources = [
'mixer_bridge_view.cc',
'waves_import_dialog.cc',
'waves_export_dialog.cc',
'waves_export_channel_selector.cc',
'waves_track_color_dialog.cc',