ardoursh = env.SubstInFile ('ardour.sh','ardour.sh.in', SUBST_DICT = my_subst_dict);
env.AddPostAction (ardoursh, Chmod ('$TARGET', 0755))
-ardourdev = env.SubstInFile ('ardev','ardev.in', SUBST_DICT = my_subst_dict);
+ardourdev = env.SubstInFile ('ardev_common.sh','ardev_common.sh.in', SUBST_DICT = my_subst_dict);
env.AddPostAction (ardourdev, Chmod ('$TARGET', 0755))
Default(ardourdev)
#!/bin/sh
dir=`dirname "$0"`
. $dir/ardev_common.sh
-exec gdb gtk2_ardour/ardour.bin $*
+exec gdb $EXECUTABLE $*
#!/bin/sh
. `dirname "$0"`/ardev_common.sh
-exec gtk2_ardour/ardour-2.0beta10 $*
+exec $EXECUTABLE $*
+++ /dev/null
-#!/bin/sh
-. `dirname "$0"`/ardev_common.sh
-exec gtk2_ardour/ardour-%VERSION% $*
# For the internal clearlooks engine
export GTK_PATH=$PWD/libs/clearlooks:~/.ardour2
+EXECUTABLE=gtk2_ardour/ardour-2.0beta10
--- /dev/null
+cd `dirname "$0"`/..
+
+#export G_DEBUG=fatal_criticals
+
+export ARDOUR_PATH=gtk2_ardour/icons:gtk2_ardour/pixmaps:gtk2_ardour
+export GTK_PATH=libs/clearlooks
+
+
+export LD_LIBRARY_PATH=libs/surfaces/control_protocol:libs/ardour:libs/midi++2:libs/pbd:libs/soundtouch:libs/gtkmm2ext:libs/sigc++2:libs/glibmm2:libs/gtkmm2/atk:libs/gtkmm2/pango:libs/gtkmm2/gdk:libs/gtkmm2/gtk:libs/libgnomecanvasmm:libs/libsndfile:libs/appleutility:$LD_LIBRARY_PATH
+
+# DYLD_LIBRARY_PATH is for darwin.
+export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
+# For the internal clearlooks engine
+export GTK_PATH=$PWD/libs/clearlooks:~/.ardour2
+
+EXECUTABLE=gtk2_ardour/ardour-%VERSION%
gcc -shared -nostdlib -fPIC gprofhelper.c -o gprofhelper.so -lpthread -ldl || exit 1
fi
-export LD_LIBRARY_PATH=../libs/ardour/.libs
-LDPRELOAD=./gprofhelper.so ./ardour $*
+. ardev_common.sh
+LDPRELOAD=./gprofhelper.so $EXECUTABLE $*
#!/bin/sh
. ardev_common.sh
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
-exec valgrind --num-callers=50 --tool=memcheck gtk2_ardour/ardour.bin --novst $*
+exec valgrind --num-callers=50 --tool=memcheck $EXECUTABLE --novst $*
}
return;
-
}
void
{
vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows();
- for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter)
- redirects.push_back ((*(model->get_iter(*iter)))[columns.redirect]);
+ for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) {
+ redirects.push_back ((*(model->get_iter(*iter)))[columns.redirect]);
+ }
}
void
class Insert : public Redirect
{
public:
- Insert(Session& s, Placement p);
- Insert(Session& s, string name, Placement p);
-
- Insert(Session& s, Placement p, int imin, int imax, int omin, int omax);
+ Insert(Session& s, std::string name, Placement p);
+ Insert(Session& s, std::string name, Placement p, int imin, int imax, int omin, int omax);
virtual ~Insert() { }
int32_t can_support_input_configuration (int32_t) const;
int32_t configure_io (int32_t magic, int32_t in, int32_t out);
int32_t compute_output_streams (int32_t cnt) const;
+
+ uint32_t bit_slot() const { return bitslot; }
+
+ private:
+ uint32_t bitslot;
};
class PluginInsert : public Insert
void all_redirects_flip();
void all_redirects_active (bool state);
- uint32_t count_sends ();
-
virtual nframes_t update_total_latency();
nframes_t signal_latency() const { return _own_latency; }
virtual void set_latency_delay (nframes_t);
namespace ARDOUR {
-class Send : public Redirect {
+class Send : public Redirect
+{
public:
Send (Session&, Placement);
Send (Session&, const XMLNode&);
Send (const Send&);
~Send ();
+
+ uint32_t bit_slot() const { return bitslot; }
void run (vector<Sample *> &bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset);
void activate() {}
private:
bool _metering;
uint32_t expected_inputs;
+ uint32_t bitslot;
};
} // namespace ARDOUR
#include <stack>
#include <boost/weak_ptr.hpp>
+#include <boost/dynamic_bitset.hpp>
#include <stdint.h>
uint32_t n_plugin_inserts() const { return _plugin_inserts.size(); }
uint32_t n_sends() const { return _sends.size(); }
- string next_send_name();
- string next_insert_name();
-
+ uint32_t next_send_id();
+ uint32_t next_insert_id();
+ void mark_send_id (uint32_t);
+ void mark_insert_id (uint32_t);
+
/* s/w "RAID" management */
nframes_t available_capture_duration();
list<PortInsert *> _port_inserts;
list<PluginInsert *> _plugin_inserts;
list<Send *> _sends;
+ boost::dynamic_bitset<uint32_t> send_bitset;
+ boost::dynamic_bitset<uint32_t> insert_bitset;
uint32_t send_cnt;
uint32_t insert_cnt;
+
void add_redirect (Redirect *);
void remove_redirect (Redirect *);
using namespace ARDOUR;
using namespace PBD;
-Insert::Insert(Session& s, Placement p)
- : Redirect (s, s.next_insert_name(), p)
+Insert::Insert(Session& s, string name, Placement p)
+ : Redirect (s, name, p)
{
}
-Insert::Insert(Session& s, Placement p, int imin, int imax, int omin, int omax)
- : Redirect (s, s.next_insert_name(), p, imin, imax, omin, omax)
-{
-}
-
-Insert::Insert(Session& s, string name, Placement p)
- : Redirect (s, name, p)
+Insert::Insert(Session& s, string name, Placement p, int imin, int imax, int omin, int omax)
+ : Redirect (s, name, p, imin, imax, omin, omax)
{
}
***************************************************************/
PortInsert::PortInsert (Session& s, Placement p)
- : Insert (s, p, 1, -1, 1, -1)
+ : Insert (s, string_compose (_("insert %1"), (bitslot = s.next_insert_id()) + 1), p, 1, -1, 1, -1)
{
init ();
RedirectCreated (this); /* EMIT SIGNAL */
}
PortInsert::PortInsert (const PortInsert& other)
- : Insert (other._session, other.placement(), 1, -1, 1, -1)
+ : Insert (other._session, string_compose (_("insert %1"), (bitslot = other._session.next_insert_id()) + 1), other.placement(), 1, -1, 1, -1)
{
init ();
RedirectCreated (this); /* EMIT SIGNAL */
PortInsert::state (bool full)
{
XMLNode *node = new XMLNode("Insert");
-
+ char buf[32];
node->add_child_nocopy (Redirect::state(full));
- node->add_property("type", "port");
+ node->add_property ("type", "port");
+ snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
+ node->add_property ("bitslot", buf);
return *node;
}
return -1;
}
+ if ((prop = node.property ("bitslot")) == 0) {
+ bitslot = _session.next_insert_id();
+ } else {
+ sscanf (prop->value().c_str(), "%" PRIu32, &bitslot);
+ _session.mark_insert_id (bitslot);
+ }
+
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == Redirect::state_node_name) {
Redirect::set_state (**niter);
}
}
-uint32_t
-Route::count_sends ()
-{
- uint32_t cnt = 0;
- Glib::RWLock::ReaderLock lm (redirect_lock);
-
- for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
- if (boost::dynamic_pointer_cast<Send> (*i)) {
- ++cnt;
- }
- }
-
- return cnt;
-}
-
int
Route::add_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t* err_streams)
{
using namespace PBD;
Send::Send (Session& s, Placement p)
- : Redirect (s, s.next_send_name(), p)
+ : Redirect (s, string_compose (_("send %1"), (bitslot = s.next_send_id()) + 1), p)
{
_metering = false;
expected_inputs = 0;
}
Send::Send (const Send& other)
- : Redirect (other._session, other._session.next_send_name(), other.placement())
+ : Redirect (other._session, string_compose (_("send %1"), (bitslot = other._session.next_send_id()) + 1), other.placement())
{
_metering = false;
expected_inputs = 0;
Send::state(bool full)
{
XMLNode *node = new XMLNode("Send");
+ char buf[32];
node->add_child_nocopy (Redirect::state (full));
+ snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
+ node->add_property ("bitslot", buf);
return *node;
}
{
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
+ const XMLProperty* prop;
+
+ if ((prop = node.property ("bitslot")) == 0) {
+ bitslot = _session.next_send_id();
+ } else {
+ sscanf (prop->value().c_str(), "%" PRIu32, &bitslot);
+ _session.mark_send_id (bitslot);
+ }
/* Send has regular IO automation (gain, pan) */
Insert* insert;
PortInsert* port_insert;
PluginInsert* plugin_insert;
-
+
if ((insert = dynamic_cast<Insert *> (redirect)) != 0) {
if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
- _port_inserts.remove (port_insert);
+ list<PortInsert*>::iterator x = find (_port_inserts.begin(), _port_inserts.end(), port_insert);
+ if (x != _port_inserts.end()) {
+ insert_bitset[port_insert->bit_slot()] = false;
+ _port_inserts.erase (x);
+ }
} else if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) {
_plugin_inserts.remove (plugin_insert);
} else {
/*NOTREACHED*/
}
} else if ((send = dynamic_cast<Send *> (redirect)) != 0) {
- _sends.remove (send);
+ list<Send*>::iterator x = find (_sends.begin(), _sends.end(), send);
+ if (x != _sends.end()) {
+ send_bitset[send->bit_slot()] = false;
+ _sends.erase (x);
+ }
} else {
fatal << _("programming error: unknown type of Redirect deleted!") << endmsg;
/*NOTREACHED*/
allocate_pan_automation_buffers (current_block_size, howmany, false);
}
-string
-Session::next_send_name ()
+uint32_t
+Session::next_insert_id ()
{
- uint32_t cnt = 0;
-
- shared_ptr<RouteList> r = routes.reader ();
-
- for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
- cnt += (*i)->count_sends ();
+ /* this doesn't really loop forever. just think about it */
+
+ while (true) {
+ for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < insert_bitset.size(); ++n) {
+ if (!insert_bitset[n]) {
+ insert_bitset[n] = true;
+ cerr << "Returning " << n << " as insert ID\n";
+ return n;
+
+ }
+ }
+
+ /* none available, so resize and try again */
+
+ insert_bitset.resize (insert_bitset.size() + 16, false);
+ }
+}
+
+uint32_t
+Session::next_send_id ()
+{
+ /* this doesn't really loop forever. just think about it */
+
+ while (true) {
+ for (boost::dynamic_bitset<uint32_t>::size_type n = 0; n < send_bitset.size(); ++n) {
+ if (!send_bitset[n]) {
+ send_bitset[n] = true;
+ cerr << "Returning " << n << " as send ID\n";
+ return n;
+
+ }
+ }
+
+ /* none available, so resize and try again */
+
+ send_bitset.resize (send_bitset.size() + 16, false);
}
+}
- return string_compose (_("send %1"), ++cnt);
+void
+Session::mark_send_id (uint32_t id)
+{
+ if (id >= send_bitset.size()) {
+ send_bitset.resize (id+16, false);
+ }
+ if (send_bitset[id]) {
+ warning << string_compose (_("send ID %1 appears to be in use already"), id) << endmsg;
+ }
+ send_bitset[id] = true;
}
-string
-Session::next_insert_name ()
+void
+Session::mark_insert_id (uint32_t id)
{
- char buf[32];
- snprintf (buf, sizeof (buf), "insert %" PRIu32, ++insert_cnt);
- return buf;
+ if (id >= insert_bitset.size()) {
+ insert_bitset.resize (id+16, false);
+ }
+ if (insert_bitset[id]) {
+ warning << string_compose (_("insert ID %1 appears to be in use already"), id) << endmsg;
+ }
+ insert_bitset[id] = true;
}
/* Named Selection management */