gcc4 fix for new import/embed code, plus inline reject_if_rate_differs() function
git-svn-id: svn://localhost/trunk/ardour2@417 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3aa346b253
commit
f9ee71f60e
@ -972,11 +972,10 @@ class Editor : public PublicEditor
|
|||||||
void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t& pos, bool prompt);
|
void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t& pos, bool prompt);
|
||||||
void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
|
void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
|
||||||
void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
|
void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
|
||||||
void import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, jack_nframes_t& pos);
|
int import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, jack_nframes_t& pos);
|
||||||
void embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
|
int embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
|
||||||
ARDOUR::AudioTrack* track, jack_nframes_t& pos, bool prompt);
|
ARDOUR::AudioTrack* track, jack_nframes_t& pos, bool prompt);
|
||||||
int finish_bringing_in_audio (ARDOUR::AudioRegion& region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, jack_nframes_t& pos, Editing::ImportMode mode);
|
int finish_bringing_in_audio (ARDOUR::AudioRegion& region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, jack_nframes_t& pos, Editing::ImportMode mode);
|
||||||
int reject_because_rate_differs (Glib::ustring path, ARDOUR::SoundFileInfo& finfo, const string & action, bool multiple_pending);
|
|
||||||
|
|
||||||
/* generic interthread progress window */
|
/* generic interthread progress window */
|
||||||
|
|
||||||
|
@ -121,15 +121,22 @@ Editor::do_embed (vector<Glib::ustring> paths, bool split, ImportMode mode, Audi
|
|||||||
{
|
{
|
||||||
bool multiple_files = paths.size() > 1;
|
bool multiple_files = paths.size() > 1;
|
||||||
bool check_sample_rate = true;
|
bool check_sample_rate = true;
|
||||||
|
vector<Glib::ustring>::iterator i;
|
||||||
|
|
||||||
for (vector<Glib::ustring>::iterator i = paths.begin(); i != paths.end(); ++i) {
|
for (i = paths.begin(); i != paths.end(); ++i) {
|
||||||
embed_sndfile (*i, split, multiple_files, check_sample_rate, mode, track, pos, prompt);
|
int ret = embed_sndfile (*i, split, multiple_files, check_sample_rate, mode, track, pos, prompt);
|
||||||
|
|
||||||
|
if (ret < -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session->save_state ("");
|
if (i == paths.end()) {
|
||||||
|
session->save_state ("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
Editor::import_sndfile (Glib::ustring path, ImportMode mode, AudioTrack* track, jack_nframes_t& pos)
|
Editor::import_sndfile (Glib::ustring path, ImportMode mode, AudioTrack* track, jack_nframes_t& pos)
|
||||||
{
|
{
|
||||||
interthread_progress_window->set_title (string_compose (_("ardour: importing %1"), path));
|
interthread_progress_window->set_title (string_compose (_("ardour: importing %1"), path));
|
||||||
@ -173,9 +180,10 @@ Editor::import_sndfile (Glib::ustring path, ImportMode mode, AudioTrack* track,
|
|||||||
}
|
}
|
||||||
|
|
||||||
track_canvas.get_window()->set_cursor (*current_canvas_cursor);
|
track_canvas.get_window()->set_cursor (*current_canvas_cursor);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, ImportMode mode,
|
Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, ImportMode mode,
|
||||||
AudioTrack* track, jack_nframes_t& pos, bool prompt)
|
AudioTrack* track, jack_nframes_t& pos, bool prompt)
|
||||||
{
|
{
|
||||||
@ -185,6 +193,8 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
|
|||||||
string linked_path;
|
string linked_path;
|
||||||
SoundFileInfo finfo;
|
SoundFileInfo finfo;
|
||||||
string region_name;
|
string region_name;
|
||||||
|
uint32_t input_chan;
|
||||||
|
uint32_t output_chan;
|
||||||
|
|
||||||
track_canvas.get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
|
track_canvas.get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
|
||||||
ARDOUR_UI::instance()->flush_pending ();
|
ARDOUR_UI::instance()->flush_pending ();
|
||||||
@ -211,22 +221,37 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
|
|||||||
|
|
||||||
if (!ExternalSource::get_soundfile_info (path, finfo, error_msg)) {
|
if (!ExternalSource::get_soundfile_info (path, finfo, error_msg)) {
|
||||||
error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), selection, error_msg ) << endmsg;
|
error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), selection, error_msg ) << endmsg;
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_sample_rate) {
|
if (check_sample_rate && (finfo.samplerate != (int) session->frame_rate())) {
|
||||||
switch (reject_because_rate_differs (path, finfo, "Embed", multiple_files)) {
|
vector<string> choices;
|
||||||
case 0:
|
|
||||||
|
choices.push_back (_("Embed it anyway"));
|
||||||
|
|
||||||
|
if (multiple_files) {
|
||||||
|
choices.push_back (_("Don't embed it"));
|
||||||
|
choices.push_back (_("Embed all without questions"));
|
||||||
|
choices.push_back (_("Cancel entire import"));
|
||||||
|
} else {
|
||||||
|
choices.push_back (_("Cancel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtkmm2ext::Choice rate_choice (
|
||||||
|
string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path),
|
||||||
|
choices, false);
|
||||||
|
|
||||||
|
switch (rate_choice.run()) {
|
||||||
|
case 0: /* do it */
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: /* don't import this one */
|
||||||
return;
|
return -1;
|
||||||
case -1:
|
case 2: /* do it, and the rest without asking */
|
||||||
check_sample_rate = false;
|
check_sample_rate = false;
|
||||||
break;
|
break;
|
||||||
|
case 3: /* stop a multi-file import */
|
||||||
case -2:
|
|
||||||
default:
|
default:
|
||||||
return;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,12 +270,12 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
|
|||||||
sources.push_back(source);
|
sources.push_back(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (failed_constructor& err) {
|
catch (failed_constructor& err) {
|
||||||
error << string_compose(_("could not open %1"), path) << endmsg;
|
error << string_compose(_("could not open %1"), path) << endmsg;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARDOUR_UI::instance()->flush_pending ();
|
ARDOUR_UI::instance()->flush_pending ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sources.empty()) {
|
if (sources.empty()) {
|
||||||
@ -263,8 +288,7 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
|
|||||||
AudioRegion* region = new AudioRegion (sources, 0, sources[0]->length(), region_name, 0,
|
AudioRegion* region = new AudioRegion (sources, 0, sources[0]->length(), region_name, 0,
|
||||||
Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External));
|
Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External));
|
||||||
|
|
||||||
uint32_t input_chan = finfo.channels;
|
input_chan = finfo.channels;
|
||||||
uint32_t output_chan;
|
|
||||||
|
|
||||||
if (session->get_output_auto_connect() & Session::AutoConnectMaster) {
|
if (session->get_output_auto_connect() & Session::AutoConnectMaster) {
|
||||||
output_chan = (session->master_out() ? session->master_out()->n_inputs() : input_chan);
|
output_chan = (session->master_out() ? session->master_out()->n_inputs() : input_chan);
|
||||||
@ -276,15 +300,16 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
track_canvas.get_window()->set_cursor (*current_canvas_cursor);
|
track_canvas.get_window()->set_cursor (*current_canvas_cursor);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, jack_nframes_t& pos, ImportMode mode)
|
Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, jack_nframes_t& pos, ImportMode mode)
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case ImportAsRegion:
|
case ImportAsRegion:
|
||||||
/* relax, its been done */
|
/* relax, its been done */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ImportToTrack:
|
case ImportToTrack:
|
||||||
if (track) {
|
if (track) {
|
||||||
@ -311,49 +336,6 @@ Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
Editor::reject_because_rate_differs (Glib::ustring path, SoundFileInfo& finfo, const string & action, bool multiple_pending)
|
|
||||||
{
|
|
||||||
if (!session) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (finfo.samplerate != (int) session->frame_rate()) {
|
|
||||||
vector<string> choices;
|
|
||||||
|
|
||||||
choices.push_back (string_compose (_("%1 it anyway"), action));
|
|
||||||
|
|
||||||
if (multiple_pending) {
|
|
||||||
/* XXX assumptions about sentence structure
|
|
||||||
here for translators. Sorry.
|
|
||||||
*/
|
|
||||||
choices.push_back (string_compose (_("Don't %1 it"), action));
|
|
||||||
choices.push_back (string_compose (_("%1 all without questions"), action));
|
|
||||||
choices.push_back (_("Cancel entire import"));
|
|
||||||
} else {
|
|
||||||
choices.push_back (_("Cancel"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Gtkmm2ext::Choice rate_choice (
|
|
||||||
string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path),
|
|
||||||
choices, false);
|
|
||||||
|
|
||||||
switch (rate_choice.run()) {
|
|
||||||
case 0: /* do it anyway */
|
|
||||||
return 0;
|
|
||||||
case 1: /* don't import this one */
|
|
||||||
return 1;
|
|
||||||
case 2: /* do the rest without asking */
|
|
||||||
return -1;
|
|
||||||
case 3: /* stop a multi-file import */
|
|
||||||
default:
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
Editor::_import_thread (void *arg)
|
Editor::_import_thread (void *arg)
|
||||||
{
|
{
|
||||||
|
@ -540,6 +540,9 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
|
|||||||
solo_audible = solo_gain > 0;
|
solo_audible = solo_gain > 0;
|
||||||
mute_audible = dmg > 0 || !_mute_affects_control_outs;
|
mute_audible = dmg > 0 || !_mute_affects_control_outs;
|
||||||
|
|
||||||
|
cerr << _name << " have control outs, solo audible = " << solo_audible << " mute audible = " << mute_audible
|
||||||
|
<< endl;
|
||||||
|
|
||||||
if ( // silent anyway
|
if ( // silent anyway
|
||||||
|
|
||||||
(_gain == 0 && !apply_gain_automation) ||
|
(_gain == 0 && !apply_gain_automation) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user