Merge branch 'windows' into windows+cc

This commit is contained in:
John Emmas 2013-10-11 18:23:53 +01:00
commit fa71d82dda
24 changed files with 1945 additions and 1633 deletions

View file

@ -365,9 +365,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
(void) theme_manager.get (true); (void) theme_manager.get (true);
starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup));
stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown));
_process_thread = new ProcessThread (); _process_thread = new ProcessThread ();
_process_thread->init (); _process_thread->init ();
@ -540,6 +537,10 @@ ARDOUR_UI::post_engine ()
ARDOUR_UI::~ARDOUR_UI () ARDOUR_UI::~ARDOUR_UI ()
{ {
if (ui_config->dirty()) {
ui_config->save_state();
}
delete keyboard; delete keyboard;
delete editor; delete editor;
delete mixer; delete mixer;
@ -716,8 +717,8 @@ ARDOUR_UI::check_announcements ()
#endif #endif
} }
void int
ARDOUR_UI::startup () ARDOUR_UI::starting ()
{ {
Application* app = Application::instance (); Application* app = Application::instance ();
char *nsm_url; char *nsm_url;
@ -789,7 +790,7 @@ ARDOUR_UI::startup ()
s.hide (); s.hide ();
switch (s.response ()) { switch (s.response ()) {
case Gtk::RESPONSE_REJECT: case Gtk::RESPONSE_REJECT:
exit (1); return -1;
default: default:
break; break;
} }
@ -803,8 +804,8 @@ ARDOUR_UI::startup ()
/* go get a session */ /* go get a session */
if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) { if (get_session_parameters (false, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) {
exit (1); return -1;
} }
} }
@ -820,6 +821,7 @@ ARDOUR_UI::startup ()
_status_bar_visibility.update (); _status_bar_visibility.update ();
BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME)); BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME));
return 0;
} }
void void
@ -2562,6 +2564,18 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
template_name = load_template; template_name = load_template;
} }
session_name = basename_nosuffix (ARDOUR_COMMAND_LINE::session_name);
session_path = ARDOUR_COMMAND_LINE::session_name;
if (!session_path.empty()) {
if (Glib::file_test (session_path.c_str(), Glib::FILE_TEST_EXISTS)) {
if (Glib::file_test (session_path.c_str(), Glib::FILE_TEST_IS_REGULAR)) {
/* session/snapshot file, change path to be dir */
session_path = Glib::path_get_dirname (session_path);
}
}
}
SessionDialog session_dialog (should_be_new, session_name, session_path, load_template, cancel_not_quit); SessionDialog session_dialog (should_be_new, session_name, session_path, load_template, cancel_not_quit);
while (ret != 0) { while (ret != 0) {
@ -2586,11 +2600,14 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} else { } else {
session_path = ""; session_path = "";
session_name = ""; session_name = "";
session_dialog.clear_given ();
} }
if (should_be_new || session_name.empty()) { if (should_be_new || session_name.empty()) {
/* need the dialog to get info from user */ /* need the dialog to get info from user */
cerr << "run dialog\n";
switch (session_dialog.run()) { switch (session_dialog.run()) {
case RESPONSE_ACCEPT: case RESPONSE_ACCEPT:
break; break;
@ -2610,7 +2627,8 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
should_be_new = false; should_be_new = false;
session_name = session_dialog.session_name (likely_new); session_name = session_dialog.session_name (likely_new);
session_path = session_dialog.session_folder ();
if (nsm) { if (nsm) {
likely_new = true; likely_new = true;
} }
@ -2662,6 +2680,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { if (Glib::file_test (session_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
if (likely_new && !nsm) { if (likely_new && !nsm) {
std::string existing = Glib::build_filename (session_path, session_name); std::string existing = Glib::build_filename (session_path, session_name);
@ -2685,10 +2704,11 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
} }
char illegal = Session::session_name_is_legal(session_name); char illegal = Session::session_name_is_legal(session_name);
if (illegal) { if (illegal) {
pop_back_splash (session_dialog); pop_back_splash (session_dialog);
MessageDialog msg (session_dialog, string_compose(_("To ensure compatibility with various systems\n" MessageDialog msg (session_dialog, string_compose(_("To ensure compatibility with various systems\n"
"session names may not contain a '%1' character"), illegal)); "session names may not contain a '%1' character"), illegal));
msg.run (); msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue; continue;
@ -2699,8 +2719,6 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
if (likely_new && template_name.empty()) { if (likely_new && template_name.empty()) {
cerr << "building a session from dialog\n";
ret = build_session_from_dialog (session_dialog, session_path, session_name); ret = build_session_from_dialog (session_dialog, session_path, session_name);
} else { } else {
@ -2716,6 +2734,12 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
_session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false); _session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
exit (1); exit (1);
} }
/* clear this to avoid endless attempts to load the
same session.
*/
ARDOUR_COMMAND_LINE::session_name = "";
} }
} }
@ -3772,6 +3796,7 @@ ARDOUR_UI::disconnect_from_engine ()
/* drop connection to AudioEngine::Halted so that we don't act /* drop connection to AudioEngine::Halted so that we don't act
* as if the engine unexpectedly shut down * as if the engine unexpectedly shut down
*/ */
halt_connection.disconnect (); halt_connection.disconnect ();
if (AudioEngine::instance()->stop ()) { if (AudioEngine::instance()->stop ()) {
@ -4107,8 +4132,6 @@ ARDOUR_UI::reset_route_peak_display (Route* route)
int int
ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate) ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate)
{ {
cerr << "Do AMS\n";
audio_midi_setup->set_desired_sample_rate (desired_sample_rate); audio_midi_setup->set_desired_sample_rate (desired_sample_rate);
switch (audio_midi_setup->run()) { switch (audio_midi_setup->run()) {
@ -4120,3 +4143,5 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate)
return -1; return -1;
} }
} }

View file

@ -333,8 +333,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
static ARDOUR_UI *theArdourUI; static ARDOUR_UI *theArdourUI;
void startup (); int starting ();
void shutdown ();
int ask_about_saving_session (const std::vector<std::string>& actions); int ask_about_saving_session (const std::vector<std::string>& actions);

View file

@ -50,14 +50,6 @@ namespace ARDOUR {
using namespace ARDOUR; using namespace ARDOUR;
void
ARDOUR_UI::shutdown ()
{
if (ui_config->dirty()) {
ui_config->save_state();
}
}
void void
ARDOUR_UI::we_have_dependents () ARDOUR_UI::we_have_dependents ()
{ {

View file

@ -235,7 +235,6 @@ EngineControl::EngineControl ()
ARDOUR::AudioEngine::instance()->Stopped.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context()); ARDOUR::AudioEngine::instance()->Stopped.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
ARDOUR::AudioEngine::instance()->Halted.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context()); ARDOUR::AudioEngine::instance()->Halted.connect (stopped_connection, MISSING_INVALIDATOR, boost::bind (&EngineControl::engine_stopped, this), gui_context());
cerr << "AMS about to change backend\n";
backend_changed (); backend_changed ();
if (audio_setup) { if (audio_setup) {

View file

@ -521,6 +521,7 @@ int main (int argc, char *argv[])
ui->run (text_receiver); ui->run (text_receiver);
Gtkmm2ext::Application::instance()->cleanup(); Gtkmm2ext::Application::instance()->cleanup();
delete ui;
ui = 0; ui = 0;
ARDOUR::cleanup (); ARDOUR::cleanup ();

File diff suppressed because it is too large Load diff

View file

@ -74,11 +74,6 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name,
, _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0) , _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
, _existing_session_chooser_used (false) , _existing_session_chooser_used (false)
{ {
if (!session_name.empty() && !require_new) {
response (RESPONSE_OK);
return;
}
set_keep_above (true); set_keep_above (true);
set_position (WIN_POS_CENTER); set_position (WIN_POS_CENTER);
get_vbox()->set_spacing (6); get_vbox()->set_spacing (6);
@ -143,12 +138,32 @@ SessionDialog::SessionDialog (bool require_new, const std::string& session_name,
recent_label.hide (); recent_label.hide ();
} }
} }
/* possibly get out of here immediately if everything is ready to go.
We still need to set up the whole dialog because of the way
ARDOUR_UI::get_session_parameters() might skip it on a first
pass then require it for a second pass (e.g. when there
is an error with session loading and we have to ask the user
what to do next).
*/
if (!session_name.empty() && !require_new) {
response (RESPONSE_OK);
return;
}
} }
SessionDialog::~SessionDialog() SessionDialog::~SessionDialog()
{ {
} }
void
SessionDialog::clear_given ()
{
_provided_session_path = "";
_provided_session_name = "";
}
bool bool
SessionDialog::use_session_template () SessionDialog::use_session_template ()
{ {
@ -185,6 +200,7 @@ std::string
SessionDialog::session_name (bool& should_be_new) SessionDialog::session_name (bool& should_be_new)
{ {
if (!_provided_session_name.empty() && !new_only) { if (!_provided_session_name.empty() && !new_only) {
should_be_new = false;
return _provided_session_name; return _provided_session_name;
} }
@ -221,12 +237,16 @@ SessionDialog::session_folder ()
TreeIter iter = recent_session_display.get_selection()->get_selected(); TreeIter iter = recent_session_display.get_selection()->get_selected();
if (iter) { if (iter) {
return (*iter)[recent_session_columns.fullpath]; string s = (*iter)[recent_session_columns.fullpath];
if (Glib::file_test (s, Glib::FILE_TEST_IS_REGULAR)) {
return Glib::path_get_dirname (s);
}
return s;
} }
if (_existing_session_chooser_used) { if (_existing_session_chooser_used) {
/* existing session chosen from file chooser */ /* existing session chosen from file chooser */
return existing_session_chooser.get_current_folder (); return Glib::path_get_dirname (existing_session_chooser.get_current_folder ());
} else { } else {
std::string legal_session_folder_name = legalize_for_path (new_name_entry.get_text()); std::string legal_session_folder_name = legalize_for_path (new_name_entry.get_text());
return Glib::build_filename (new_folder_chooser.get_current_folder(), legal_session_folder_name); return Glib::build_filename (new_folder_chooser.get_current_folder(), legal_session_folder_name);
@ -251,7 +271,9 @@ SessionDialog::setup_initial_choice_box ()
ic_new_session_button.signal_clicked().connect (sigc::mem_fun (*this, &SessionDialog::new_session_button_clicked)); ic_new_session_button.signal_clicked().connect (sigc::mem_fun (*this, &SessionDialog::new_session_button_clicked));
Gtk::HBox* hbox = manage (new HBox); Gtk::HBox* hbox = manage (new HBox);
Gtk::VBox* vbox = manage (new VBox);
hbox->set_spacing (12); hbox->set_spacing (12);
vbox->set_spacing (12);
string image_path; string image_path;
@ -261,9 +283,10 @@ SessionDialog::setup_initial_choice_box ()
hbox->pack_start (*image, false, false); hbox->pack_start (*image, false, false);
} }
} }
hbox->pack_start (ic_new_session_button, true, true); vbox->pack_start (ic_new_session_button, true, true, 20);
hbox->pack_start (*vbox, true, true, 20);
centering_vbox->pack_start (*hbox, false, false); centering_vbox->pack_start (*hbox, false, false);
/* Possible update message */ /* Possible update message */
@ -276,8 +299,6 @@ SessionDialog::setup_initial_choice_box ()
info_box->pack_start (info_scroller_label, false, false); info_box->pack_start (info_scroller_label, false, false);
cerr << "Frame should be visible\n";
info_scroller_count = 0; info_scroller_count = 0;
info_scroller_connection = Glib::signal_timeout().connect (mem_fun(*this, &SessionDialog::info_scroller_update), 50); info_scroller_connection = Glib::signal_timeout().connect (mem_fun(*this, &SessionDialog::info_scroller_update), 50);

View file

@ -51,9 +51,11 @@ class SessionDialog : public ArdourDialog {
const std::string& template_name, bool cancel_not_quit); const std::string& template_name, bool cancel_not_quit);
~SessionDialog (); ~SessionDialog ();
void clear_given ();
std::string session_name (bool& should_be_new); std::string session_name (bool& should_be_new);
std::string session_folder (); std::string session_folder ();
bool use_session_template(); bool use_session_template();
std::string session_template_name(); std::string session_template_name();

View file

@ -194,6 +194,7 @@ ProxyBase::ProxyBase (const string& name, const std::string& menu_name, const XM
ProxyBase::~ProxyBase () ProxyBase::~ProxyBase ()
{ {
delete vistracker; delete vistracker;
delete _window;
} }
void void

View file

@ -60,7 +60,7 @@ namespace ARDOUR {
*/ */
bool init (bool with_vst, bool try_optimization, const char* localedir); bool init (bool with_vst, bool try_optimization, const char* localedir);
void init_post_engine (); void init_post_engine ();
int cleanup (); void cleanup ();
bool no_auto_connect (); bool no_auto_connect ();
void make_property_quarks (); void make_property_quarks ();

View file

@ -229,6 +229,7 @@ public:
std::string _latency_output_name; std::string _latency_output_name;
framecnt_t _latency_signal_latency; framecnt_t _latency_signal_latency;
bool _started_for_latency; bool _started_for_latency;
bool _in_destructor;
void meter_thread (); void meter_thread ();
void start_metering_thread (); void start_metering_thread ();
@ -236,9 +237,6 @@ public:
static gint m_meter_exit; static gint m_meter_exit;
void parameter_changed (const std::string&);
PBD::ScopedConnection config_connection;
typedef std::map<std::string,AudioBackendInfo*> BackendMap; typedef std::map<std::string,AudioBackendInfo*> BackendMap;
BackendMap _backends; BackendMap _backends;
AudioBackendInfo* backend_discover (const std::string&); AudioBackendInfo* backend_discover (const std::string&);

View file

@ -881,15 +881,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
MIDI::MachineControl& mmc() { return *_mmc; } MIDI::MachineControl& mmc() { return *_mmc; }
/* Callbacks specifically related to JACK, and called directly
* from the JACK audio backend.
*/
#ifdef HAVE_JACK_SESSION
void jack_session_event (jack_session_event_t* event);
#endif
void jack_timebase_callback (jack_transport_state_t, pframes_t, jack_position_t*, int);
protected: protected:
friend class AudioEngine; friend class AudioEngine;
void set_block_size (pframes_t nframes); void set_block_size (pframes_t nframes);

View file

@ -79,6 +79,7 @@ AudioEngine::AudioEngine ()
, _latency_flush_frames (0) , _latency_flush_frames (0)
, _latency_signal_latency (0) , _latency_signal_latency (0)
, _started_for_latency (false) , _started_for_latency (false)
, _in_destructor (false)
{ {
g_atomic_int_set (&m_meter_exit, 0); g_atomic_int_set (&m_meter_exit, 0);
discover_backends (); discover_backends ();
@ -86,15 +87,9 @@ AudioEngine::AudioEngine ()
AudioEngine::~AudioEngine () AudioEngine::~AudioEngine ()
{ {
_in_destructor = true;
stop_metering_thread ();
drop_backend (); drop_backend ();
config_connection.disconnect ();
{
Glib::Threads::Mutex::Lock tm (_process_lock);
session_removed.signal ();
stop_metering_thread ();
}
} }
AudioEngine* AudioEngine*
@ -477,6 +472,7 @@ AudioEngine::discover_backends ()
Glib::PatternSpec so_extension_pattern("*backend.so"); Glib::PatternSpec so_extension_pattern("*backend.so");
Glib::PatternSpec dylib_extension_pattern("*backend.dylib"); Glib::PatternSpec dylib_extension_pattern("*backend.dylib");
Glib::PatternSpec dll_extension_pattern("*backend.dll");
find_matching_files_in_search_path (backend_search_path (), find_matching_files_in_search_path (backend_search_path (),
so_extension_pattern, backend_modules); so_extension_pattern, backend_modules);
@ -484,6 +480,9 @@ AudioEngine::discover_backends ()
find_matching_files_in_search_path (backend_search_path (), find_matching_files_in_search_path (backend_search_path (),
dylib_extension_pattern, backend_modules); dylib_extension_pattern, backend_modules);
find_matching_files_in_search_path (backend_search_path (),
dll_extension_pattern, backend_modules);
DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for backends in %1\n"), backend_search_path().to_string())); DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for backends in %1\n"), backend_search_path().to_string()));
for (vector<std::string>::iterator i = backend_modules.begin(); i != backend_modules.end(); ++i) { for (vector<std::string>::iterator i = backend_modules.begin(); i != backend_modules.end(); ++i) {
@ -998,6 +997,11 @@ AudioEngine::update_latencies ()
void void
AudioEngine::halted_callback (const char* why) AudioEngine::halted_callback (const char* why)
{ {
if (_in_destructor) {
/* everything is under control */
return;
}
stop_metering_thread (); stop_metering_thread ();
_running = false; _running = false;

View file

@ -366,9 +366,15 @@ ARDOUR::init_post_engine ()
ARDOUR::PluginManager::instance().refresh (); ARDOUR::PluginManager::instance().refresh ();
} }
int void
ARDOUR::cleanup () ARDOUR::cleanup ()
{ {
if (!libardour_initialized) {
return;
}
ARDOUR::AudioEngine::destroy ();
delete Library; delete Library;
#ifdef HAVE_LRDF #ifdef HAVE_LRDF
lrdf_cleanup (); lrdf_cleanup ();
@ -382,7 +388,8 @@ ARDOUR::cleanup ()
vstfx_exit(); vstfx_exit();
#endif #endif
PBD::cleanup (); PBD::cleanup ();
return 0;
return;
} }
void void

File diff suppressed because it is too large Load diff

View file

@ -182,7 +182,6 @@ libardour_sources = [
'session_events.cc', 'session_events.cc',
'session_export.cc', 'session_export.cc',
'session_handle.cc', 'session_handle.cc',
'session_jack.cc',
'session_ltc.cc', 'session_ltc.cc',
'session_metadata.cc', 'session_metadata.cc',
'session_midi.cc', 'session_midi.cc',
@ -246,8 +245,6 @@ def configure(conf):
path_prefix + 'version.cc', path_prefix + 'version.cc',
'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0) 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
autowaf.configure(conf) autowaf.configure(conf)
autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
atleast_version='0.118.2')
if Options.options.dist_target == 'auto': if Options.options.dist_target == 'auto':
if re.search ("linux", sys.platform) != None: if re.search ("linux", sys.platform) != None:
autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA') autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
@ -304,9 +301,6 @@ def configure(conf):
conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False) conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False)
conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False) conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False)
conf.check(header_name='jack/session.h', uselib = [ 'JACK' ],
define_name='HAVE_JACK_SESSION')
conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False) conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
if flac_supported(): if flac_supported():
@ -343,8 +337,8 @@ def build(bld):
obj.name = 'libardour' obj.name = 'libardour'
obj.target = 'ardour' obj.target = 'ardour'
obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID', obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
'JACK', 'ALSA', 'SNDFILE','SAMPLERATE','LRDF', 'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
'AUDIOUNITS', 'OSX','BOOST','CURL','DL'] 'OSX','BOOST','CURL','DL']
obj.use = ['libpbd','libmidipp','libevoral','libvamphost', obj.use = ['libpbd','libmidipp','libevoral','libvamphost',
'libvampplugin','libtaglib','librubberband', 'libvampplugin','libtaglib','librubberband',
'libaudiographer','libltc','libtimecode'] 'libaudiographer','libltc','libtimecode']
@ -410,7 +404,7 @@ def build(bld):
testcommon.includes = obj.includes + ['test', '../pbd', '..'] testcommon.includes = obj.includes + ['test', '../pbd', '..']
testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc', testcommon.source = ['test/test_globals.cc', 'test/testrunner.cc', 'test/test_needing_session.cc',
'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc'] 'test/test_common.cc', 'test/dummy_lxvst.cc', 'test/audio_region_test.cc', 'test/test_util.cc']
testcommon.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', testcommon.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
'SAMPLERATE','XML','LRDF','COREAUDIO'] 'SAMPLERATE','XML','LRDF','COREAUDIO']
testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost', testcommon.use = ['libpbd','libmidipp','libevoral','libvamphost',
'libvampplugin','libtaglib','librubberband', 'libvampplugin','libtaglib','librubberband',
@ -488,7 +482,7 @@ def build(bld):
session_load_tester.includes = obj.includes session_load_tester.includes = obj.includes
session_load_tester.includes.append ('test') session_load_tester.includes.append ('test')
session_load_tester.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', session_load_tester.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
'SAMPLERATE','XML','LRDF','COREAUDIO'] 'SAMPLERATE','XML','LRDF','COREAUDIO']
session_load_tester.use = ['libpbd','libmidipp','ardour'] session_load_tester.use = ['libpbd','libmidipp','ardour']
session_load_tester.name = 'libardour-session-load-tester' session_load_tester.name = 'libardour-session-load-tester'
@ -523,7 +517,7 @@ def build(bld):
profilingobj.includes = obj.includes profilingobj.includes = obj.includes
profilingobj.includes.append ('test') profilingobj.includes.append ('test')
profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', profilingobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
'SAMPLERATE','XML','LRDF','COREAUDIO'] 'SAMPLERATE','XML','LRDF','COREAUDIO']
profilingobj.use = ['libpbd','libmidipp','ardour'] profilingobj.use = ['libpbd','libmidipp','ardour']
profilingobj.name = 'libardour-profiling' profilingobj.name = 'libardour-profiling'
@ -550,7 +544,7 @@ def create_ardour_test_program(bld, includes, name, target, sources):
testobj = bld(features = 'cxx cxxprogram') testobj = bld(features = 'cxx cxxprogram')
testobj.includes = includes + ['test', '../pbd', '..'] testobj.includes = includes + ['test', '../pbd', '..']
testobj.source = sources testobj.source = sources
testobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', testobj.uselib = ['CPPUNIT','SIGCPP','GLIBMM','GTHREAD',
'SAMPLERATE','XML','LRDF','COREAUDIO'] 'SAMPLERATE','XML','LRDF','COREAUDIO']
testobj.use = ['libpbd','libmidipp','libevoral','libvamphost', testobj.use = ['libpbd','libmidipp','libevoral','libvamphost',
'libvampplugin','libtaglib','librubberband', 'libvampplugin','libtaglib','librubberband',

View file

@ -37,6 +37,7 @@
#include "jack_audiobackend.h" #include "jack_audiobackend.h"
#include "jack_connection.h" #include "jack_connection.h"
#include "jack_utils.h" #include "jack_utils.h"
#include "jack_session.h"
#include "i18n.h" #include "i18n.h"
@ -64,6 +65,7 @@ JACKAudioBackend::JACKAudioBackend (AudioEngine& e, boost::shared_ptr<JackConnec
, _target_systemic_output_latency (0) , _target_systemic_output_latency (0)
, _current_sample_rate (0) , _current_sample_rate (0)
, _current_buffer_size (0) , _current_buffer_size (0)
, _session (0)
{ {
_jack_connection->Connected.connect_same_thread (jack_connection_connection, boost::bind (&JACKAudioBackend::when_connected_to_jack, this)); _jack_connection->Connected.connect_same_thread (jack_connection_connection, boost::bind (&JACKAudioBackend::when_connected_to_jack, this));
_jack_connection->Disconnected.connect_same_thread (disconnect_connection, boost::bind (&JACKAudioBackend::disconnected, this, _1)); _jack_connection->Disconnected.connect_same_thread (disconnect_connection, boost::bind (&JACKAudioBackend::disconnected, this, _1));
@ -748,7 +750,8 @@ JACKAudioBackend::jack_timebase_callback (jack_transport_state_t state, pframes_
ARDOUR::Session* session = engine.session(); ARDOUR::Session* session = engine.session();
if (session) { if (session) {
session->jack_timebase_callback (state, nframes, pos, new_position); JACKSession jsession (session);
jsession.timebase_callback (state, nframes, pos, new_position);
} }
} }
@ -793,7 +796,6 @@ JACKAudioBackend::_xrun_callback (void *arg)
return 0; return 0;
} }
#ifdef HAVE_JACK_SESSION
void void
JACKAudioBackend::_session_callback (jack_session_event_t *event, void *arg) JACKAudioBackend::_session_callback (jack_session_event_t *event, void *arg)
{ {
@ -801,10 +803,10 @@ JACKAudioBackend::_session_callback (jack_session_event_t *event, void *arg)
ARDOUR::Session* session = jab->engine.session(); ARDOUR::Session* session = jab->engine.session();
if (session) { if (session) {
session->jack_session_event (event); JACKSession jsession (session);
jsession.session_event (event);
} }
} }
#endif
void void
JACKAudioBackend::_freewheel_callback (int onoff, void *arg) JACKAudioBackend::_freewheel_callback (int onoff, void *arg)

View file

@ -30,15 +30,14 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <jack/jack.h> #include <jack/jack.h>
#ifdef HAVE_JACK_SESSION
#include <jack/session.h> #include <jack/session.h>
#endif
#include "ardour/audio_backend.h" #include "ardour/audio_backend.h"
namespace ARDOUR { namespace ARDOUR {
class JackConnection; class JackConnection;
class JACKSession;
class JACKAudioBackend : public AudioBackend { class JACKAudioBackend : public AudioBackend {
public: public:
@ -196,9 +195,7 @@ class JACKAudioBackend : public AudioBackend {
static int _jack_sync_callback (jack_transport_state_t, jack_position_t*, void *arg); static int _jack_sync_callback (jack_transport_state_t, jack_position_t*, void *arg);
static void _freewheel_callback (int , void *arg); static void _freewheel_callback (int , void *arg);
static void _latency_callback (jack_latency_callback_mode_t, void*); static void _latency_callback (jack_latency_callback_mode_t, void*);
#ifdef HAVE_JACK_SESSION
static void _session_callback (jack_session_event_t *event, void *arg); static void _session_callback (jack_session_event_t *event, void *arg);
#endif
void jack_timebase_callback (jack_transport_state_t, pframes_t, jack_position_t*, int); void jack_timebase_callback (jack_transport_state_t, pframes_t, jack_position_t*, int);
int jack_sync_callback (jack_transport_state_t, jack_position_t*); int jack_sync_callback (jack_transport_state_t, jack_position_t*);
@ -261,6 +258,12 @@ class JACKAudioBackend : public AudioBackend {
void when_connected_to_jack (); void when_connected_to_jack ();
PBD::ScopedConnection jack_connection_connection; PBD::ScopedConnection jack_connection_connection;
/* Object to manage interactions with Session in a way that
keeps JACK out of libardour directly
*/
JACKSession* _session;
}; };
} // namespace } // namespace

View file

@ -1,5 +1,5 @@
/* /*
Copyright (C) 1999-2013 Paul Davis Copyright (C) 2013 Paul Davis
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -18,16 +18,11 @@
*/ */
#ifdef WAF_BUILD
#include "libardour-config.h"
#endif
#include <time.h> #include <time.h>
#include <glibmm/miscutils.h> #include <glibmm/miscutils.h>
#include "jack/jack.h" #include <jack/jack.h>
#include "jack/session.h"
#include "ardour/audioengine.h" #include "ardour/audioengine.h"
#include "ardour/filename_extensions.h" #include "ardour/filename_extensions.h"
@ -35,12 +30,22 @@
#include "ardour/session_directory.h" #include "ardour/session_directory.h"
#include "ardour/tempo.h" #include "ardour/tempo.h"
#include "jack_session.h"
using namespace ARDOUR; using namespace ARDOUR;
using std::string; using std::string;
#ifdef HAVE_JACK_SESSION JACKSession::JACKSession (Session* s)
: SessionHandlePtr (s)
{
}
JACKSession::~JACKSession ()
{
}
void void
Session::jack_session_event (jack_session_event_t* event) JACKSession::session_event (jack_session_event_t* event)
{ {
char timebuf[128], *tmp; char timebuf[128], *tmp;
time_t n; time_t n;
@ -54,7 +59,7 @@ Session::jack_session_event (jack_session_event_t* event)
if (event->type == JackSessionSaveTemplate) if (event->type == JackSessionSaveTemplate)
{ {
if (save_template( timebuf )) { if (_session->save_template( timebuf )) {
event->flags = JackSessionSaveError; event->flags = JackSessionSaveError;
} else { } else {
string cmd ("ardour3 -P -U "); string cmd ("ardour3 -P -U ");
@ -67,10 +72,10 @@ Session::jack_session_event (jack_session_event_t* event)
} }
else else
{ {
if (save_state (timebuf)) { if (_session->save_state (timebuf)) {
event->flags = JackSessionSaveError; event->flags = JackSessionSaveError;
} else { } else {
std::string xml_path (_session_dir->root_path()); std::string xml_path (_session->session_directory().root_path());
std::string legalized_filename = legalize_for_path (timebuf) + statefile_suffix; std::string legalized_filename = legalize_for_path (timebuf) + statefile_suffix;
xml_path = Glib::build_filename (xml_path, legalized_filename); xml_path = Glib::build_filename (xml_path, legalized_filename);
@ -95,66 +100,69 @@ Session::jack_session_event (jack_session_event_t* event)
} }
if (event->type == JackSessionSaveAndQuit) { if (event->type == JackSessionSaveAndQuit) {
Quit (); /* EMIT SIGNAL */ _session->Quit (); /* EMIT SIGNAL */
} }
jack_session_event_free( event ); jack_session_event_free (event);
} }
#endif
void void
Session::jack_timebase_callback (jack_transport_state_t /*state*/, JACKSession::timebase_callback (jack_transport_state_t /*state*/,
pframes_t /*nframes*/, pframes_t /*nframes*/,
jack_position_t* pos, jack_position_t* pos,
int /*new_position*/) int /*new_position*/)
{ {
Timecode::BBT_Time bbt; Timecode::BBT_Time bbt;
TempoMap& tempo_map (_session->tempo_map());
framepos_t tf = _session->transport_frame ();
/* BBT info */ /* BBT info */
if (_tempo_map) { TempoMetric metric (tempo_map.metric_at (tf));
TempoMetric metric (_tempo_map->metric_at (_transport_frame)); try {
tempo_map.bbt_time_rt (tf, bbt);
try {
_tempo_map->bbt_time_rt (_transport_frame, bbt); pos->bar = bbt.bars;
pos->beat = bbt.beats;
pos->bar = bbt.bars; pos->tick = bbt.ticks;
pos->beat = bbt.beats;
pos->tick = bbt.ticks; // XXX still need to set bar_start_tick
// XXX still need to set bar_start_tick pos->beats_per_bar = metric.meter().divisions_per_bar();
pos->beat_type = metric.meter().note_divisor();
pos->beats_per_bar = metric.meter().divisions_per_bar(); pos->ticks_per_beat = Timecode::BBT_Time::ticks_per_beat;
pos->beat_type = metric.meter().note_divisor(); pos->beats_per_minute = metric.tempo().beats_per_minute();
pos->ticks_per_beat = Timecode::BBT_Time::ticks_per_beat;
pos->beats_per_minute = metric.tempo().beats_per_minute(); pos->valid = jack_position_bits_t (pos->valid | JackPositionBBT);
pos->valid = jack_position_bits_t (pos->valid | JackPositionBBT); } catch (...) {
/* no message */
} catch (...) {
/* no message */
}
} }
#ifdef HAVE_JACK_VIDEO_SUPPORT #ifdef HAVE_JACK_VIDEO_SUPPORT
//poke audio video ratio so Ardour can track Video Sync //poke audio video ratio so Ardour can track Video Sync
pos->audio_frames_per_video_frame = frame_rate() / timecode_frames_per_second(); pos->audio_frames_per_video_frame = _session->frame_rate() / _session->timecode_frames_per_second();
pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio); pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio);
#endif #endif
#if 0 #ifdef HAVE_JACK_TIMCODE_SUPPORT
/* This is not yet defined in JACK */
/* Timecode info */ /* Timecode info */
pos->timecode_offset = config.get_timecode_offset(); pos->timecode_offset = _session->config.get_timecode_offset();
t.timecode_frame_rate = timecode_frames_per_second(); t.timecode_frame_rate = _session->timecode_frames_per_second();
pos->valid = jack_position_bits_t (pos->valid | JackPositionTimecode; pos->valid = jack_position_bits_t (pos->valid | JackPositionTimecode);
#endif
#ifdef HAVE_JACK_LOOPING_SUPPORT
/* This is not yet defined in JACK */
if (_transport_speed) { if (_transport_speed) {
if (play_loop) { if (play_loop) {
Location* location = _locations.auto_loop_location(); Location* location = _session->locations()->auto_loop_location();
if (location) { if (location) {

View file

@ -0,0 +1,47 @@
/*
Copyright (C) 2013 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 __ardour_jack_audiobackend_jack_session_h__
#define __ardour_jack_audiobackend_jack_session_h__
#include <jack/session.h>
#include <jack/transport.h>
#include "ardour/types.h"
#include "ardour/session_handle.h"
namespace ARDOUR {
class Session;
class JACKSession : public ARDOUR::SessionHandlePtr
{
public:
JACKSession (ARDOUR::Session* s);
~JACKSession ();
void session_event (jack_session_event_t* event);
void timebase_callback (jack_transport_state_t /*state*/,
ARDOUR::pframes_t /*nframes*/,
jack_position_t* pos,
int /*new_position*/);
};
} /* namespace */
#endif /* __ardour_jack_audiobackend_jack_session_h__ */

View file

@ -37,10 +37,10 @@ def build(bld):
'jack_connection.cc', 'jack_connection.cc',
'jack_audiobackend.cc', 'jack_audiobackend.cc',
'jack_portengine.cc', 'jack_portengine.cc',
'jack_utils.cc' 'jack_utils.cc',
'jack_session.cc',
] ]
obj.includes = ['.'] obj.includes = ['.']
obj.cxxflags = [ '-fPIC' ]
obj.name = 'jack_audiobackend' obj.name = 'jack_audiobackend'
obj.target = 'jack_audiobackend' obj.target = 'jack_audiobackend'
if Options.options.dist_target == 'mingw': if Options.options.dist_target == 'mingw':

View file

@ -120,9 +120,9 @@ UI::UI (string namestr, int *argc, char ***argv)
UI::~UI () UI::~UI ()
{ {
_receiver.hangup ();
} }
bool bool
UI::caller_is_ui_thread () UI::caller_is_ui_thread ()
{ {
@ -265,12 +265,14 @@ UI::run (Receiver &old_receiver)
Glib::signal_idle().connect (bind_return (mem_fun (old_receiver, &Receiver::hangup), false)); Glib::signal_idle().connect (bind_return (mem_fun (old_receiver, &Receiver::hangup), false));
starting (); if (starting ()) {
return;
}
_active = true; _active = true;
theMain->run (); theMain->run ();
_active = false; _active = false;
stopping ();
_receiver.hangup ();
return; return;
} }

View file

@ -156,8 +156,7 @@ class UI : public AbstractUI<UIRequest>
stopping just after we return from it (at the top level) stopping just after we return from it (at the top level)
*/ */
sigc::signal<void> starting; virtual int starting() = 0;
sigc::signal<void> stopping;
sigc::signal<void> theme_changed; sigc::signal<void> theme_changed;

10
wscript
View file

@ -606,7 +606,12 @@ def configure(conf):
if Options.options.boost_sp_debug: if Options.options.boost_sp_debug:
conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS') conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
autowaf.check_header(conf, 'cxx', 'jack/session.h', define="JACK_SESSION", mandatory = False) conf.check_cxx(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
execute = "1",
mandatory = True,
msg = 'Checking for boost library >= 1.39',
okmsg = 'ok',
errmsg = 'too old\nPlease install boost version 1.39 or higher.')
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2') autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2') autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
@ -678,8 +683,6 @@ def configure(conf):
else: else:
conf.define('LXVST_SUPPORT', 1) conf.define('LXVST_SUPPORT', 1)
conf.env['LXVST_SUPPORT'] = True conf.env['LXVST_SUPPORT'] = True
if bool(conf.env['JACK_SESSION']):
conf.define('HAVE_JACK_SESSION', 1)
conf.define('WINDOWS_KEY', opts.windows_key) conf.define('WINDOWS_KEY', opts.windows_key)
conf.env['PROGRAM_NAME'] = opts.program_name conf.env['PROGRAM_NAME'] = opts.program_name
if opts.rt_alloc_debug: if opts.rt_alloc_debug:
@ -741,7 +744,6 @@ const char* const ardour_config_info = "\\n\\
write_config_text('FLAC', conf.is_defined('HAVE_FLAC')) write_config_text('FLAC', conf.is_defined('HAVE_FLAC'))
write_config_text('FPU optimization', opts.fpu_optimization) write_config_text('FPU optimization', opts.fpu_optimization)
write_config_text('Freedesktop files', opts.freedesktop) write_config_text('Freedesktop files', opts.freedesktop)
write_config_text('JACK session support', conf.is_defined('JACK_SESSION'))
write_config_text('LV2 UI embedding', conf.is_defined('HAVE_SUIL')) write_config_text('LV2 UI embedding', conf.is_defined('HAVE_SUIL'))
write_config_text('LV2 support', conf.is_defined('LV2_SUPPORT')) write_config_text('LV2 support', conf.is_defined('LV2_SUPPORT'))
write_config_text('LXVST support', conf.is_defined('LXVST_SUPPORT')) write_config_text('LXVST support', conf.is_defined('LXVST_SUPPORT'))