fader_vbox->pack_start (*fader_centering_box, false, false, 0);
hbox.set_spacing (2);
- hbox.pack_start (*fader_vbox, true, true);
- if (_io->default_type() == ARDOUR::DataType::AUDIO)
- hbox.pack_start (*fader_vbox, false, false, 2);
+ if (_io->default_type() == ARDOUR::DataType::AUDIO) {
+ hbox.pack_start (*fader_vbox, true, true);
+ }
- set_width(Narrow);
+ set_width (Narrow);
Route* r;
class AudioEngine : public sigc::trackable
{
public:
+ typedef std::set<Port*> Ports;
+
AudioEngine (std::string client_name);
virtual ~AudioEngine ();
int start ();
bool running() const { return _running; }
+ int run_process_cycle (ARDOUR::Session*, jack_nframes_t nframes);
+
Glib::Mutex& process_lock() { return _process_lock; }
nframes_t frame_rate();
bool reconnect_on_halt;
int _usecs_per_cycle;
- typedef std::set<Port*> Ports;
SerializedRCUManager<Ports> ports;
int process_callback (nframes_t nframes);
return 0;
}
- boost::shared_ptr<Ports> p = ports.reader();
-
- // Prepare ports (ie read data if necessary)
- for (Ports::iterator i = p->begin(); i != p->end(); ++i)
- (*i)->cycle_start(nframes);
-
- session->process (nframes);
-
- if (!_running) {
+ if (run_process_cycle (session, nframes)) {
/* we were zombified, maybe because a ladspa plugin took
too long, or jackd exited, or something like that.
*/
-
_processed_frames = next_processed_frames;
return 0;
}
-
- // Finalize ports (ie write data if necessary)
- for (Ports::iterator i = p->begin(); i != p->end(); ++i)
- (*i)->cycle_end();
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
return 0;
}
+int
+AudioEngine::run_process_cycle (Session* s, jack_nframes_t nframes)
+{
+ boost::shared_ptr<Ports> p = ports.reader();
+
+ // Prepare ports (ie read data if necessary)
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i)
+ (*i)->cycle_start (nframes);
+
+ s->process (nframes);
+
+ if (!_running) {
+ return -1;
+ }
+
+ // Finalize ports (ie write data if necessary)
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i)
+ (*i)->cycle_end ();
+
+ return 0;
+}
+
int
AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg)
{
can before we really start running.
*/
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
- session->process (blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
+ run_process_cycle (session, blocksize);
}
}
nframes_t position, nframes_t cnt,
uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
{
- cerr << _name << "._read_at(" << position << ") - " << _position << endl;
+ // cerr << _name << "._read_at(" << position << ") - " << _position << endl;
nframes_t internal_offset;
nframes_t buf_offset;
while (_peak_power.size() > limit) {
_peak_power.pop_back();
_visible_peak_power.pop_back();
- _max_peak_power.push_back(minus_infinity());
+ _max_peak_power.pop_back();
}
while (_peak_power.size() < limit) {
*/
#include <cassert>
+#include <iostream>
+
#include <ardour/midi_port.h>
#include <ardour/data_type.h>
-#include <iostream>
+#include <midi++/jackcompat.h>
using namespace ARDOUR;
using namespace std;
jack_nframes_t position, jack_nframes_t dur,
uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
{
-
- cerr << _name << "._read_at(" << position << ") - " << _position << endl;
+ // cerr << _name << "._read_at(" << position << ") - " << _position << endl;
jack_nframes_t internal_offset = 0;
jack_nframes_t src_offset = 0;
return;
}
-
- // More than 1 output, we should have 1 panner for each input
- assert(size() == inbufs.count().get(DataType::AUDIO));
/* the terrible silence ... */
for (BufferSet::audio_iterator i = outbufs.audio_begin(); i != outbufs.audio_end(); ++i) {
}
BufferSet::audio_iterator i = inbufs.audio_begin();
- for (iterator pan = begin(); pan != end(); ++pan, ++i) {
+
+ for (iterator pan = begin(); pan != end() && i != inbufs.audio_end(); ++pan, ++i) {
(*pan)->distribute (*i, outbufs, gain_coeff, nframes);
}
}
tmp = i;
++tmp;
- cerr << "dropping refs on a region (" << i->second->name() << " @ " << i->second << ") with UC = " << i->second.use_count() << endl;
i->second->drop_references ();
- cerr << "AFTER: UC = " << i->second.use_count() << endl;
i = tmp;
}
#include <midi++/types.h>
#include <midi++/jack.h>
#include <midi++/port_request.h>
+#include <midi++/jackcompat.h>
using namespace std;
using namespace MIDI;
--- /dev/null
+/* JACK MIDI API compatibility hacks.
+ * Copyright (C) 2007 Nedko Arnaudov <nedko@arnaudov.name>
+ *
+ * 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; version 2 of the License
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef JACK_COMPAT_H
+#define JACK_COMPAT_H
+
+#define JACK_MIDI_NEEDS_NFRAMES
+
+#if defined(JACK_MIDI_NEEDS_NFRAMES)
+
+static jack_nframes_t
+jack_midi_get_event_count_compat(
+ void * port_buffer)
+{
+#if defined(HAVE_OLD_JACK_MIDI)
+ return jack_midi_port_get_info(port_buffer, 0)->event_count;
+#else
+ return jack_midi_get_event_count(port_buffer, 0);
+#endif
+}
+
+#define jack_midi_get_event_count jack_midi_get_event_count_compat
+
+static int
+jack_midi_event_get_compat(
+ jack_midi_event_t * event,
+ void * port_buffer,
+ jack_nframes_t event_index)
+{
+ return jack_midi_event_get(event, port_buffer, event_index, 0);
+}
+
+static int
+jack_midi_event_write_compat(void *port_buffer,
+ jack_nframes_t time,
+ const jack_midi_data_t *data,
+ size_t data_size)
+{
+ return jack_midi_event_write (port_buffer, time, data, data_size, 0);
+}
+
+static void
+jack_midi_clear_buffer_compat(void* buf)
+{
+ jack_midi_clear_buffer (buf, 0);
+}
+
+#define jack_midi_event_get jack_midi_event_get_compat
+#define jack_midi_event_write jack_midi_event_write_compat
+#define jack_midi_clear_buffer jack_midi_clear_buffer_compat
+
+#else
+
+#if defined(HAVE_OLD_JACK_MIDI)
+#error "Old (0.102.20) JACK MIDI API needs nframes (autotools probably gone mad)"
+#endif
+
+#endif /* #if defined(JACK_MIDI_NEEDS_NFRAMES) */
+
+#endif /* JACK_COMPAT_H */