initial fixes to get build to work without new JACK MIDI, and to get it running with an older session, at least somewhat
git-svn-id: svn://localhost/ardour2/branches/midi@1773 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -138,12 +138,12 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
|
||||
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;
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ class Port;
|
||||
class AudioEngine : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
typedef std::set<Port*> Ports;
|
||||
|
||||
AudioEngine (std::string client_name);
|
||||
virtual ~AudioEngine ();
|
||||
|
||||
@@ -66,6 +68,8 @@ class AudioEngine : public sigc::trackable
|
||||
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();
|
||||
@@ -211,7 +215,6 @@ class AudioEngine : public sigc::trackable
|
||||
bool reconnect_on_halt;
|
||||
int _usecs_per_cycle;
|
||||
|
||||
typedef std::set<Port*> Ports;
|
||||
SerializedRCUManager<Ports> ports;
|
||||
|
||||
int process_callback (nframes_t nframes);
|
||||
|
||||
@@ -304,26 +304,13 @@ AudioEngine::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) {
|
||||
|
||||
@@ -349,6 +336,28 @@ AudioEngine::process_callback (nframes_t nframes)
|
||||
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)
|
||||
{
|
||||
@@ -447,14 +456,14 @@ AudioEngine::set_session (Session *s)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
|
||||
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;
|
||||
|
||||
@@ -72,7 +72,7 @@ PeakMeter::setup (const ChanCount& in)
|
||||
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) {
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
|
||||
#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;
|
||||
|
||||
@@ -128,8 +128,7 @@ MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst,
|
||||
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;
|
||||
|
||||
@@ -1386,9 +1386,6 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes
|
||||
|
||||
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) {
|
||||
@@ -1396,7 +1393,8 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,9 +534,7 @@ Session::destroy ()
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <midi++/types.h>
|
||||
#include <midi++/jack.h>
|
||||
#include <midi++/port_request.h>
|
||||
#include <midi++/jackcompat.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace MIDI;
|
||||
|
||||
74
libs/midi++2/midi++/jackcompat.h
Normal file
74
libs/midi++2/midi++/jackcompat.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* 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 */
|
||||
Reference in New Issue
Block a user