13
0

Update references to ptfformat -> ptformat && fix api calls

This commit is contained in:
Damien Zammit 2019-06-21 22:09:04 +10:00
parent f5524ddf37
commit 675759c167
5 changed files with 37 additions and 26 deletions

View File

@ -61,7 +61,7 @@
#include "selection_memento.h" #include "selection_memento.h"
#include "tempo_curve.h" #include "tempo_curve.h"
#include "ptformat/ptfformat.h" #include "ptformat/ptformat.h"
namespace Gtkmm2ext { namespace Gtkmm2ext {
class Bindings; class Bindings;

View File

@ -44,7 +44,7 @@
#include "ardour/session.h" #include "ardour/session.h"
#include "pbd/memento_command.h" #include "pbd/memento_command.h"
#include "ptformat/ptfformat.h" #include "ptformat/ptformat.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "cursor_context.h" #include "cursor_context.h"

View File

@ -27,7 +27,7 @@
#include "pbd/i18n.h" #include "pbd/i18n.h"
#include "pbd/file_utils.h" #include "pbd/file_utils.h"
#include "ptformat/ptfformat.h" #include "ptformat/ptformat.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
@ -111,24 +111,35 @@ void
PTImportSelector::update_ptf() PTImportSelector::update_ptf()
{ {
if (ptimport_ptf_chooser.get_filename ().size () > 0) { if (ptimport_ptf_chooser.get_filename ().size () > 0) {
int err = 0;
std::string path = ptimport_ptf_chooser.get_filename (); std::string path = ptimport_ptf_chooser.get_filename ();
bool ok = Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_REGULAR | Glib::FILE_TEST_IS_SYMLINK) bool ok = Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_REGULAR | Glib::FILE_TEST_IS_SYMLINK)
&& !Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_DIR); && !Glib::file_test(path.c_str(), Glib::FILE_TEST_IS_DIR);
if (ok) { if (ok) {
if (_ptf->load (path, _session_rate) == -1) { err = _ptf->load (path, _session_rate);
if (err == -1) {
ptimport_info_text.get_buffer ()->set_text ("Cannot decrypt PT session\n");
ptimport_import_button.set_sensitive(false);
} else if (err == -2) {
ptimport_info_text.get_buffer ()->set_text ("Cannot detect PT session\n"); ptimport_info_text.get_buffer ()->set_text ("Cannot detect PT session\n");
ptimport_import_button.set_sensitive(false); ptimport_import_button.set_sensitive(false);
} else if (err == -3) {
ptimport_info_text.get_buffer ()->set_text ("Incompatible PT version\n");
ptimport_import_button.set_sensitive(false);
} else if (err == -4) {
ptimport_info_text.get_buffer ()->set_text ("Cannot parse PT session\n");
ptimport_import_button.set_sensitive(false);
} else { } else {
std::string ptinfo = string_compose (_("PT Session [ VALID ]\n\nSession Info:\n\n\nPT v%1 Session @ %2Hz\n\n%3 audio files\n%4 audio regions\n%5 active audio regions\n%6 midi regions\n%7 active midi regions\n\n"), std::string ptinfo = string_compose (_("PT Session [ VALID ]\n\nSession Info:\n\n\nPT v%1 Session @ %2Hz\n\n%3 audio files\n%4 audio regions\n%5 active audio regions\n%6 midi regions\n%7 active midi regions\n\n"),
(int)_ptf->version, (int)_ptf->version (),
_ptf->sessionrate, _ptf->sessionrate (),
_ptf->audiofiles.size (), _ptf->audiofiles ().size (),
_ptf->regions.size (), _ptf->regions ().size (),
_ptf->tracks.size (), _ptf->tracks ().size (),
_ptf->midiregions.size (), _ptf->midiregions ().size (),
_ptf->miditracks.size () _ptf->miditracks ().size ()
); );
if (_session_rate != _ptf->sessionrate) { if (_session_rate != _ptf->sessionrate ()) {
ptinfo = string_compose (_("%1WARNING:\n\nSample rate mismatch,\nwill be resampling\n"), ptinfo); ptinfo = string_compose (_("%1WARNING:\n\nSample rate mismatch,\nwill be resampling\n"), ptinfo);
} }
ptimport_info_text.get_buffer ()->set_text (ptinfo); ptimport_info_text.get_buffer ()->set_text (ptinfo);

View File

@ -27,7 +27,7 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include "ptformat/ptfformat.h" #include "ptformat/ptformat.h"
#include "ardour_dialog.h" #include "ardour_dialog.h"
#include "ardour/session.h" #include "ardour/session.h"

View File

@ -48,7 +48,7 @@
#include "ardour/session.h" #include "ardour/session.h"
#include "pbd/memento_command.h" #include "pbd/memento_command.h"
#include "ptformat/ptfformat.h" #include "ptformat/ptformat.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
@ -201,7 +201,7 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
vector<ptflookup_t> ptfwavpair; vector<ptflookup_t> ptfwavpair;
vector<ptflookup_t> ptfregpair; vector<ptflookup_t> ptfregpair;
vector<PTFFormat::wav_t>::iterator w; vector<PTFFormat::wav_t>::const_iterator w;
SourceList just_one_src; SourceList just_one_src;
SourceList imported; SourceList imported;
@ -213,18 +213,18 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK); Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK);
for (w = ptf.audiofiles.begin (); w != ptf.audiofiles.end () && !status.cancel; ++w) { for (w = ptf.audiofiles ().begin (); w != ptf.audiofiles ().end () && !status.cancel; ++w) {
ptflookup_t p; ptflookup_t p;
ok = false; ok = false;
/* Try audio file */ /* Try audio file */
fullpath = Glib::build_filename (Glib::path_get_dirname (ptf.path), "Audio Files"); fullpath = Glib::build_filename (Glib::path_get_dirname (ptf.path ()), "Audio Files");
fullpath = Glib::build_filename (fullpath, w->filename); fullpath = Glib::build_filename (fullpath, w->filename);
if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS)) {
just_one_src.clear(); just_one_src.clear();
ok = import_sndfile_as_region (fullpath, SrcBest, pos, just_one_src, status); ok = import_sndfile_as_region (fullpath, SrcBest, pos, just_one_src, status);
} else { } else {
/* Try fade file */ /* Try fade file */
fullpath = Glib::build_filename (Glib::path_get_dirname (ptf.path), "Fade Files"); fullpath = Glib::build_filename (Glib::path_get_dirname (ptf.path ()), "Fade Files");
fullpath = Glib::build_filename (fullpath, w->filename); fullpath = Glib::build_filename (fullpath, w->filename);
if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS)) {
just_one_src.clear(); just_one_src.clear();
@ -237,7 +237,7 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
* it won't be resampled, so we can only do this * it won't be resampled, so we can only do this
* when sample rates are matching * when sample rates are matching
*/ */
if (sample_rate () == ptf.sessionrate) { if (sample_rate () == ptf.sessionrate ()) {
/* Insert reference to missing source */ /* Insert reference to missing source */
samplecnt_t sourcelen = w->length; samplecnt_t sourcelen = w->length;
XMLNode srcxml (X_("Source")); XMLNode srcxml (X_("Source"));
@ -276,8 +276,8 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
lx.acquire(); lx.acquire();
save_state(""); save_state("");
for (vector<PTFFormat::region_t>::iterator a = ptf.regions.begin (); for (vector<PTFFormat::region_t>::const_iterator a = ptf.regions ().begin ();
a != ptf.regions.end (); ++a) { a != ptf.regions ().end (); ++a) {
for (vector<ptflookup_t>::iterator p = ptfwavpair.begin (); for (vector<ptflookup_t>::iterator p = ptfwavpair.begin ();
p != ptfwavpair.end (); ++p) { p != ptfwavpair.end (); ++p) {
if ((p->index1 == a->wave.index) && (strcmp (a->wave.filename.c_str (), "") != 0)) { if ((p->index1 == a->wave.index) && (strcmp (a->wave.filename.c_str (), "") != 0)) {
@ -310,7 +310,7 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
} }
} }
for (vector<PTFFormat::track_t>::iterator a = ptf.tracks.begin (); a != ptf.tracks.end (); ++a) { for (vector<PTFFormat::track_t>::const_iterator a = ptf.tracks ().begin (); a != ptf.tracks ().end (); ++a) {
for (vector<ptflookup_t>::iterator p = ptfregpair.begin (); for (vector<ptflookup_t>::iterator p = ptfregpair.begin ();
p != ptfregpair.end (); ++p) { p != ptfregpair.end (); ++p) {
@ -384,7 +384,7 @@ Session::import_pt (PTFFormat& ptf, ImportStatus& status)
trymidi: trymidi:
status.paths.clear(); status.paths.clear();
status.paths.push_back(ptf.path); status.paths.push_back(ptf.path ());
status.current = 1; status.current = 1;
status.total = 1; status.total = 1;
status.freeze = false; status.freeze = false;
@ -396,7 +396,7 @@ trymidi:
vector<midipair> uniquetr; vector<midipair> uniquetr;
for (vector<PTFFormat::track_t>::iterator a = ptf.miditracks.begin (); a != ptf.miditracks.end (); ++a) { for (vector<PTFFormat::track_t>::const_iterator a = ptf.miditracks ().begin (); a != ptf.miditracks ().end (); ++a) {
bool found = false; bool found = false;
for (vector<midipair>::iterator b = uniquetr.begin (); b != uniquetr.end (); ++b) { for (vector<midipair>::iterator b = uniquetr.begin (); b != uniquetr.end (); ++b) {
if (b->trname == a->name) { if (b->trname == a->name) {
@ -429,7 +429,7 @@ trymidi:
} }
/* MIDI - Add midi regions one-by-one to corresponding midi tracks */ /* MIDI - Add midi regions one-by-one to corresponding midi tracks */
for (vector<PTFFormat::track_t>::iterator a = ptf.miditracks.begin (); a != ptf.miditracks.end (); ++a) { for (vector<PTFFormat::track_t>::const_iterator a = ptf.miditracks ().begin (); a != ptf.miditracks ().end (); ++a) {
boost::shared_ptr<MidiTrack> midi_track = midi_tracks[a->index]; boost::shared_ptr<MidiTrack> midi_track = midi_tracks[a->index];
assert (midi_track); assert (midi_track);
@ -453,7 +453,7 @@ trymidi:
MidiModel::NoteDiffCommand *midicmd; MidiModel::NoteDiffCommand *midicmd;
midicmd = mm->new_note_diff_command ("Import ProTools MIDI"); midicmd = mm->new_note_diff_command ("Import ProTools MIDI");
for (vector<PTFFormat::midi_ev_t>::iterator j = a->reg.midi.begin (); j != a->reg.midi.end (); ++j) { for (vector<PTFFormat::midi_ev_t>::const_iterator j = a->reg.midi.begin (); j != a->reg.midi.end (); ++j) {
//printf(" : MIDI : pos=%f len=%f\n", (float)j->pos / 960000., (float)j->length / 960000.); //printf(" : MIDI : pos=%f len=%f\n", (float)j->pos / 960000., (float)j->length / 960000.);
Temporal::Beats start = (Temporal::Beats)(j->pos / 960000.); Temporal::Beats start = (Temporal::Beats)(j->pos / 960000.);
Temporal::Beats len = (Temporal::Beats)(j->length / 960000.); Temporal::Beats len = (Temporal::Beats)(j->length / 960000.);