#include <jack/weakjack.h>
#include "midi++/port.h"
+#include "midi++/jack_midi_port.h"
#include "midi++/mmc.h"
#include "midi++/manager.h"
-#include "ardour/amp.h"
#include "ardour/audio_port.h"
#include "ardour/audioengine.h"
#include "ardour/buffer.h"
-#include "ardour/buffer_set.h"
#include "ardour/cycle_timer.h"
-#include "ardour/event_type_map.h"
-#include "ardour/internal_return.h"
#include "ardour/internal_send.h"
-#include "ardour/io.h"
#include "ardour/meter.h"
#include "ardour/midi_port.h"
-#include "ardour/process_thread.h"
#include "ardour/port.h"
-#include "ardour/port_set.h"
+#include "ardour/process_thread.h"
#include "ardour/session.h"
-#include "ardour/timestamps.h"
-#include "ardour/utils.h"
#include "i18n.h"
_frame_rate = 0;
_buffer_size = 0;
_freewheeling = false;
+ _pre_freewheel_mmc_enabled = false;
_main_thread = 0;
port_remove_in_progress = false;
SessionEvent::create_per_thread_pool (X_("Audioengine"), 512);
- MIDI::Port::set_process_thread (pthread_self());
+ MIDI::JackMIDIPort::set_process_thread (pthread_self());
}
static void
} else {
jack_deactivate (_priv_jack);
Stopped(); /* EMIT SIGNAL */
- MIDI::Port::JackHalted (); /* EMIT SIGNAL */
+ MIDI::JackMIDIPort::JackHalted (); /* EMIT SIGNAL */
}
}
void
AudioEngine::_freewheel_callback (int onoff, void *arg)
{
- static_cast<AudioEngine*>(arg)->_freewheeling = onoff;
+ static_cast<AudioEngine*>(arg)->freewheel_callback (onoff);
+}
+
+void
+AudioEngine::freewheel_callback (int onoff)
+{
+ _freewheeling = onoff;
+
+ if (onoff) {
+ _pre_freewheel_mmc_enabled = MIDI::Manager::instance()->mmc()->send_enabled ();
+ MIDI::Manager::instance()->mmc()->enable_send (false);
+ } else {
+ MIDI::Manager::instance()->mmc()->enable_send (_pre_freewheel_mmc_enabled);
+ }
}
void
next_processed_frames = _processed_frames + nframes;
}
- if (!tm.locked() || _session == 0) {
+ if (!tm.locked()) {
/* return having done nothing */
_processed_frames = next_processed_frames;
return 0;
}
+ if (_session == 0) {
+ if (!_freewheeling) {
+ MIDI::Manager::instance()->cycle_start(nframes);
+ MIDI::Manager::instance()->cycle_end();
+ }
+ _processed_frames = next_processed_frames;
+ return 0;
+ }
+
if (session_remove_pending) {
/* perform the actual session removal */
_session = 0;
}
} else {
+ MIDI::Manager::instance()->cycle_start(nframes);
+
if (_session) {
_session->process (nframes);
}
+
+ MIDI::Manager::instance()->cycle_end();
}
if (_freewheeling) {
if (p) {
reason = string_compose (_("a port with the name \"%1\" already exists: check for duplicated track/bus names"), portname);
} else {
- reason = string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with ports if you need this many tracks."), PROGRAM_NAME);
+ reason = string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with more ports if you need this many tracks."), PROGRAM_NAME);
}
throw PortRegistrationFailure (string_compose (_("AudioEngine: cannot register port \"%1\": %2"), portname, reason).c_str());
if (was_running) {
ae->Halted(""); /* EMIT SIGNAL */
- MIDI::Port::JackHalted (); /* EMIT SIGNAL */
+ MIDI::JackMIDIPort::JackHalted (); /* EMIT SIGNAL */
}
}
if (_running) {
_running = false;
Stopped(); /* EMIT SIGNAL */
- MIDI::Port::JackHalted (); /* EMIT SIGNAL */
+ MIDI::JackMIDIPort::JackHalted (); /* EMIT SIGNAL */
}
return 0;