diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 05203b4133..3d9fd057f8 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -191,7 +191,7 @@ int main (int argc, char *argv[]) #endif { - ARDOUR::AudioEngine *engine; + ARDOUR::AudioEngine *engine = NULL; vector null_file_list; Glib::thread_init(); @@ -251,7 +251,7 @@ int main (int argc, char *argv[]) PBD::ID::init (); - try { + try { ui = new ARDOUR_UI (&argc, &argv, which_ui_rcfile()); } catch (failed_constructor& err) { error << _("could not create ARDOUR GUI") << endmsg; @@ -270,7 +270,7 @@ int main (int argc, char *argv[]) } try { - ARDOUR::init (*engine, use_vst, try_hw_optimization); + ARDOUR::init (use_vst, try_hw_optimization); setup_gtk_ardour_enums (); Config->set_current_owner (ConfigVariableBase::Interface); ui->setup_profile (); @@ -282,6 +282,8 @@ int main (int argc, char *argv[]) error << string_compose (_("Could not connect to JACK server as \"%1\""), jack_client_name) << endmsg; return -1; } + + ARDOUR::setup_midi(*engine); ui->set_engine (*engine); diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 332b9af733..e1be7ad998 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -44,8 +44,10 @@ namespace ARDOUR { static const nframes_t max_frames = JACK_MAX_FRAMES; - int init (AudioEngine& engine, bool with_vst, bool try_optimization); + int init (bool with_vst, bool try_optimization); int cleanup (); + + int setup_midi(AudioEngine& engine); std::string get_ardour_revision (); diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index ce0b333bcb..fcebe92dce 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -108,8 +108,8 @@ setup_osc () } #endif -static int -setup_midi (AudioEngine& engine ) +int +ARDOUR::setup_midi (AudioEngine& engine) { std::map::iterator i; int nports; @@ -286,7 +286,7 @@ setup_hardware_optimization (bool try_optimization) } int -ARDOUR::init (ARDOUR::AudioEngine& engine, bool use_vst, bool try_optimization) +ARDOUR::init (bool use_vst, bool try_optimization) { extern void setup_enum_writer (); @@ -307,10 +307,6 @@ ARDOUR::init (ARDOUR::AudioEngine& engine, bool use_vst, bool try_optimization) Profile = new RuntimeProfile; - if (setup_midi (engine)) { - return -1; - } - #ifdef HAVE_LIBLO if (setup_osc ()) { return -1; diff --git a/libs/midi++2/jack_midiport.cc b/libs/midi++2/jack_midiport.cc index 98d29351b5..3db96a214c 100644 --- a/libs/midi++2/jack_midiport.cc +++ b/libs/midi++2/jack_midiport.cc @@ -100,7 +100,7 @@ JACK_MidiPort::create_ports(PortRequest & req) assert(!_jack_input_port); assert(!_jack_output_port); - //jack_nframes_t nframes = jack_get_buffer_size(_jack_client); + jack_nframes_t nframes = jack_get_buffer_size(_jack_client); bool ret = true; @@ -108,8 +108,8 @@ JACK_MidiPort::create_ports(PortRequest & req) _jack_output_port = jack_port_register(_jack_client, string(req.tagname).append("_out").c_str(), JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); - //jack_midi_clear_buffer( - // jack_port_get_buffer(_jack_output_port, nframes)); + jack_midi_clear_buffer( + jack_port_get_buffer(_jack_output_port, nframes)); ret = ret && (_jack_output_port != NULL); } @@ -117,8 +117,8 @@ JACK_MidiPort::create_ports(PortRequest & req) _jack_input_port = jack_port_register(_jack_client, string(req.tagname).append("_in").c_str(), JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); - //jack_midi_clear_buffer( - // jack_port_get_buffer(_jack_input_port, nframes)); + jack_midi_clear_buffer( + jack_port_get_buffer(_jack_input_port, nframes)); ret = ret && (_jack_input_port != NULL); } diff --git a/libs/midi++2/midi++/jackcompat.h b/libs/midi++2/midi++/jackcompat.h index f1b748ea66..bf179f7333 100644 --- a/libs/midi++2/midi++/jackcompat.h +++ b/libs/midi++2/midi++/jackcompat.h @@ -18,7 +18,7 @@ #ifndef JACK_COMPAT_H #define JACK_COMPAT_H -#define JACK_MIDI_NEEDS_NFRAMES +//#define JACK_MIDI_NEEDS_NFRAMES #if defined(JACK_MIDI_NEEDS_NFRAMES)