void set_tags (std::string member, std::vector<std::string> tags);
std::vector<std::string> get_tags (std::string member);
- void search_members_and (std::vector<std::string>& results, const std::vector<std::string> tags);
+ void search_members_and (std::vector<std::string>& results, const std::vector<std::string>& tags);
void save_changes();
int set_state(const XMLNode& node);
bool save_preset (std::string name);
- bool load_preset (const std::string preset_label);
+ bool load_preset (const std::string& preset_label);
std::vector<std::string> get_presets ();
std::string current_preset() const;
bool supports_feedback;
XMLNode* state;
- ControlProtocolInfo() : descriptor (0), protocol (0), state (0) {}
- ~ControlProtocolInfo() { if (state) { delete state; } }
+ ControlProtocolInfo() : descriptor (0), protocol (0), requested(false),
+ mandatory(false), supports_feedback(false), state (0)
+ {}
+ ~ControlProtocolInfo() { delete state; }
};
class ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr
Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
Delivery (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
+ ~Delivery ();
bool set_name (const std::string& name);
std::string display_name() const;
class SFC {
public:
// This constructor so that this can be constructed like a Normalizer
- SFC (ExportGraphBuilder &) {}
+ SFC (ExportGraphBuilder &) : data_width(0) {}
FloatSinkPtr init (FileSpec const & new_config, nframes_t max_frames);
void add_child (FileSpec const & new_config);
bool operator== (FileSpec const & other_config) const;
struct CDMarkerStatus {
CDMarkerStatus (std::string out_file, TimespanPtr timespan, FormatPtr format, std::string filename) :
- out (out_file.c_str()), timespan (timespan), format (format), filename (filename),
+ out (out_file.c_str()), timespan (timespan), format (format), filename (filename), marker(0),
track_number (1), track_position (0), track_duration (0), track_start_frame (0),
index_number (1), index_position (0)
{}
XMLNode& get_state();
int set_state(const XMLNode& node, int version);
bool save_preset(std::string uri);
- bool load_preset(const std::string uri);
+ bool load_preset(const std::string& uri);
virtual std::vector<Plugin::PresetRecord> get_presets();
bool has_editor() const;
virtual bool parameter_is_output(uint32_t) const = 0;
virtual bool save_preset (std::string) = 0;
- virtual bool load_preset (const std::string uri);
+ virtual bool load_preset (const std::string& uri);
struct PresetRecord {
PresetRecord(const std::string& u, const std::string& l) : uri(u), label(l) {}
{
public:
RCConfiguration();
+ ~RCConfiguration();
void map_parameters (boost::function<void (std::string)>&);
int set_state (XMLNode const &, int version);
int remove (boost::shared_ptr<Route>);
void apply (void (Route::*func)(void *), void *src) {
- for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
+ for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
((*i).get()->*func)(src);
}
}
template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) {
- for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
+ for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
((*i).get()->*func)(val, src);
}
}
template<class T> void foreach_route (T *obj, void (T::*func)(Route&)) {
- for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
+ for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
(obj->*func)(**i);
}
}
PBD::Signal0<void> route_group_removed;
void foreach_route_group (boost::function<void(RouteGroup*)> f) {
- for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); i++) {
+ for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
f (*i);
}
}
};
class SessionEventManager {
- public:
- SessionEventManager () : pending_events (2048){}
- virtual ~SessionEventManager() {}
+public:
+ SessionEventManager () : pending_events (2048),
+ auto_loop_event(0), punch_out_event(0), punch_in_event(0) {}
+ virtual ~SessionEventManager() {}
- virtual void queue_event (SessionEvent *ev) = 0;
+ virtual void queue_event (SessionEvent *ev) = 0;
void clear_events (SessionEvent::Type type);
-
- protected:
- RingBuffer<SessionEvent*> pending_events;
+
+protected:
+ RingBuffer<SessionEvent*> pending_events;
typedef std::list<SessionEvent *> Events;
Events events;
Events immediate_events;
SessionEvent *auto_loop_event;
SessionEvent *punch_out_event;
- SessionEvent *punch_in_event;
-
+ SessionEvent *punch_in_event;
+
void dump_events () const;
void merge_event (SessionEvent*);
void replace_event (SessionEvent::Type, nframes64_t action_frame, nframes64_t target = 0);
void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0);
void remove_event (nframes64_t frame, SessionEvent::Type type);
- virtual void process_event(SessionEvent*) = 0;
- virtual void set_next_event () = 0;
+ virtual void process_event(SessionEvent*) = 0;
+ virtual void set_next_event () = 0;
};
} /* namespace */
MeterPointChange = 0x1
};
- RouteProcessorChange () {
- type = GeneralChange;
- }
+ RouteProcessorChange () : type (GeneralChange), meter_visibly_changed (true)
+ {}
- RouteProcessorChange (Type t) {
- type = t;
- meter_visibly_changed = true;
- }
+ RouteProcessorChange (Type t) : type (t), meter_visibly_changed (true)
+ {}
- RouteProcessorChange (Type t, bool m) {
- type = t;
- meter_visibly_changed = m;
- }
+ RouteProcessorChange (Type t, bool m) : type (t), meter_visibly_changed (m)
+ {}
/** type of change; "GeneralChange" means anything could have changed */
Type type;
bool parameter_is_input(uint32_t i) const { return true; }
bool parameter_is_output(uint32_t i) const { return false; }
- bool load_preset (const std::string preset_label );
+ bool load_preset (const std::string& preset_label);
bool save_preset (std::string name);
bool has_editor () const;
return;
}
- if (_data) {
- free (_data);
- }
+ free (_data);
_capacity = size;
_size = size;
}
channels.flush ();
+
+ delete deprecated_io_node;
}
void
bool reloop = false;
nframes_t loop_end = 0;
nframes_t loop_start = 0;
- nframes_t loop_length = 0;
nframes_t offset = 0;
Location *loc = 0;
if (!reversed) {
+ nframes_t loop_length = 0;
+
/* Make the use of a Location atomic for this read operation.
Note: Locations don't get deleted, so all we care about
int
AudioDiskstream::set_destructive (bool yn)
{
- bool bounce_ignored;
-
if (yn != destructive()) {
if (yn) {
+ bool bounce_ignored;
/* requestor should already have checked this and
bounced if necessary and desired
*/
}
void
-AudioLibrary::search_members_and (vector<string>& members, const vector<string> tags)
+AudioLibrary::search_members_and (vector<string>& members, const vector<string>& tags)
{
lrdf_statement **head;
lrdf_statement* pattern = 0;
}
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
-
- nframes_t xfade_length;
-
other = boost::dynamic_pointer_cast<AudioRegion> (*i);
if (other == region) {
touched_regions = 0;
try {
+ nframes_t xfade_length;
switch (c) {
case OverlapNone:
break;
string source_id = prop->value();
// Get source
- for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); it++) {
+ for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); ++it) {
prop = (*it)->property ("id");
if (prop && !source_id.compare (prop->value())) {
source_path = source_dir;
unit->Uninitialize ();
}
- if (buffers) {
- free (buffers);
- }
+ free (buffers);
}
}
bool
-AUPlugin::load_preset (const string preset_label)
+AUPlugin::load_preset (const string& preset_label)
{
#ifdef AU_STATE_SUPPORT
bool ret = false;
if (gchild->name() == X_("io")) {
- int in;
- int out;
const XMLProperty* iprop;
const XMLProperty* oprop;
if (((iprop = gchild->property (X_("in"))) != 0) &&
((oprop = gchild->property (X_("out"))) != 0)) {
- in = atoi (iprop->value());
- out = atoi (iprop->value());
+ const int in = atoi (iprop->value());
+ const int out = atoi (iprop->value());
cinfo.io_configs.push_back (pair<int,int> (in, out));
}
int
AudioEngine::start ()
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (!_running) {
int
AudioEngine::stop (bool forever)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (_priv_jack) {
if (forever) {
#ifdef HAVE_JACK_VIDEO_SUPPORT
- GET_PRIVATE_JACK_POINTER_RET (_jack, false);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, false);
jack_position_t pos;
void
AudioEngine::port_registration_failure (const std::string& portname)
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
string full_portname = jack_client_name;
full_portname += ':';
full_portname += portname;
int
AudioEngine::disconnect (Port& port)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
if (!_running) {
if (!_has_run) {
ARDOUR::nframes_t
AudioEngine::frame_rate () const
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,0);
if (_frame_rate == 0) {
return (_frame_rate = jack_get_sample_rate (_priv_jack));
} else {
ARDOUR::nframes_t
AudioEngine::frames_per_cycle () const
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,0);
if (_buffer_size == 0) {
return (_buffer_size = jack_get_buffer_size (_jack));
} else {
const char **
AudioEngine::get_ports (const string& port_name_pattern, const string& type_name_pattern, uint32_t flags)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,0);
if (!_running) {
if (!_has_run) {
fatal << _("get_ports called before engine was started") << endmsg;
bool
AudioEngine::can_request_hardware_monitoring ()
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,false);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,false);
const char ** ports;
if ((ports = jack_get_ports (_priv_jack, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortCanMonitor)) == 0) {
uint32_t
AudioEngine::n_physical_outputs (DataType type) const
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,0);
const char ** ports;
uint32_t i = 0;
uint32_t
AudioEngine::n_physical_inputs (DataType type) const
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,0);
const char ** ports;
uint32_t i = 0;
void
AudioEngine::get_physical_inputs (DataType type, vector<string>& ins)
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
const char ** ports;
- uint32_t i = 0;
-
if ((ports = jack_get_ports (_priv_jack, NULL, type.to_jack_type(), JackPortIsPhysical|JackPortIsOutput)) == 0) {
return;
}
if (ports) {
- for (i = 0; ports[i]; ++i) {
+ for (uint32_t i = 0; ports[i]; ++i) {
ins.push_back (ports[i]);
}
free (ports);
void
AudioEngine::get_physical_outputs (DataType type, vector<string>& outs)
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
const char ** ports;
uint32_t i = 0;
string
AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,"");
+ GET_PRIVATE_JACK_POINTER_RET (_jack,"");
const char ** ports;
uint32_t i;
string ret;
ret = ports[i];
}
- free ((char *) ports);
+ free ((const char **) ports);
return ret;
}
void
AudioEngine::transport_stop ()
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
jack_transport_stop (_priv_jack);
}
void
AudioEngine::transport_start ()
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
jack_transport_start (_priv_jack);
}
void
AudioEngine::transport_locate (nframes_t where)
{
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
// cerr << "tell JACK to locate to " << where << endl;
jack_transport_locate (_priv_jack, where);
}
AudioEngine::TransportState
AudioEngine::transport_state ()
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, ((TransportState) JackTransportStopped));
+ GET_PRIVATE_JACK_POINTER_RET (_jack, ((TransportState) JackTransportStopped));
jack_position_t pos;
return (TransportState) jack_transport_query (_priv_jack, &pos);
}
int
AudioEngine::reset_timebase ()
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (_session) {
if (_session->config.get_jack_time_master()) {
return jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
int
AudioEngine::freewheel (bool onoff)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (onoff != _freewheeling) {
return -1;
}
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (status & JackNameNotUnique) {
jack_client_name = jack_get_client_name (_priv_jack);
int
AudioEngine::disconnect_from_jack ()
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, 0);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, 0);
if (_running) {
stop_metering_thread ();
return -1;
}
- GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,-1);
if (_session) {
_session->reset_jack_connection (_priv_jack);
int
AudioEngine::request_buffer_size (nframes_t nframes)
{
- GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
+ GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (nframes == jack_get_buffer_size (_priv_jack)) {
return 0;
AudioEngine::update_total_latencies ()
{
#ifdef HAVE_JACK_RECOMPUTE_LATENCIES
- GET_PRIVATE_JACK_POINTER (_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
jack_recompute_total_latencies (_priv_jack);
#endif
}
bool
AudioEngine::is_realtime () const
{
- GET_PRIVATE_JACK_POINTER_RET (_jack,false);
+ GET_PRIVATE_JACK_POINTER_RET (_jack,false);
return jack_is_realtime (_priv_jack);
}
int
AudioSource::build_peaks_from_scratch ()
{
- framepos_t current_frame;
- framecnt_t cnt;
Sample* buf = 0;
- framecnt_t frames_read;
- framecnt_t frames_to_read;
+
const framecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
int ret = -1;
goto out;
}
- current_frame = 0;
- cnt = _length;
+ framepos_t current_frame = 0;
+ framecnt_t cnt = _length;
+
_peaks_built = false;
buf = new Sample[bufsize];
while (cnt) {
- frames_to_read = min (bufsize, cnt);
+ framecnt_t frames_to_read = min (bufsize, cnt);
+ framecnt_t frames_read;
if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) {
error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
void
Auditioner::output_changed (IOChange change, void* /*src*/)
{
- string phys;
-
if (change & ConnectionsChanged) {
+ string phys;
vector<string> connections;
if (_output->nth (0)->get_connections (connections)) {
phys = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
+Delivery::~Delivery()
+{
+ delete _output_buffers;
+}
+
std::string
Delivery::display_name () const
{
, graph_builder (new ExportGraphBuilder (session))
, export_status (session.get_export_status ())
, realtime (false)
-
+ , normalizing (false)
+ , cue_tracknum (0)
+ , cue_indexnum (0)
{
}
}
static std::string
-get_non_existent_filename (DataType type, const bool allow_replacing, const std::string destdir, const std::string& basename, uint channel, uint channels)
+get_non_existent_filename (DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint channel, uint channels)
{
char buf[PATH_MAX+1];
bool goodfile = false;
// see if it's a stereo connection e.g. "in 3+4"
if (last_non_digit_pos > 1 && desired_name[last_non_digit_pos] == '+') {
- int left_bundle_number = 0;
string::size_type left_last_non_digit_pos;
left_last_non_digit_pos = desired_name.find_last_not_of(digits, last_non_digit_pos-1);
if (left_last_non_digit_pos != string::npos) {
+ int left_bundle_number = 0;
stringstream s;
s << desired_name.substr(left_last_non_digit_pos, last_non_digit_pos-1);
s >> left_bundle_number;
int
Locations::set_state (const XMLNode& node, int /*version*/)
{
- XMLNodeList nlist;
- XMLNodeConstIterator niter;
-
if (node.name() != "Locations") {
error << _("incorrect XML mode passed to Locations::set_state") << endmsg;
return -1;
}
- nlist = node.children();
+ XMLNodeList nlist = node.children();
locations.clear ();
current_location = 0;
{
Glib::Mutex::Lock lm (lock);
+ XMLNodeConstIterator niter;
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
try {
Locations::get_location_by_id(PBD::ID id)
{
LocationList::iterator it;
- for (it = locations.begin(); it != locations.end(); it++)
+ for (it = locations.begin(); it != locations.end(); ++it)
if (id == (*it)->id())
return *it;
// Construct importable locations
XMLNodeList const & locations = location_node->children();
- for (XMLNodeList::const_iterator it = locations.begin(); it != locations.end(); it++) {
+ for (XMLNodeList::const_iterator it = locations.begin(); it != locations.end(); ++it) {
try {
elements.push_back (ElementPtr ( new LocationImporter (source, session, *this, **it)));
} catch (failed_constructor err) {
}
bool
-LV2Plugin::load_preset(const string uri)
+LV2Plugin::load_preset(const string& uri)
{
const string query = string(
"PREFIX lv2p: <http://lv2plug.in/ns/dev/presets#>\n"
bool reloop = false;
nframes_t loop_end = 0;
nframes_t loop_start = 0;
- nframes_t loop_length = 0;
Location *loc = 0;
if (!reversed) {
+
+ nframes_t loop_length = 0;
+
/* Make the use of a Location atomic for this read operation.
Note: Locations don't get deleted, so all we care about
void
MidiDiskstream::transport_stopped (struct tm& /*when*/, time_t /*twhen*/, bool abort_capture)
{
- uint32_t buffer_position;
bool more_work = true;
int err = 0;
boost::shared_ptr<MidiRegion> region;
- nframes_t total_capture;
MidiRegion::SourceList srcs;
MidiRegion::SourceList::iterator src;
vector<CaptureInfo*>::iterator ci;
assert(_write_source);
- for (total_capture = 0, ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
+ nframes_t total_capture = 0;
+ for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
total_capture += (*ci)->frames;
}
plist.add (Properties::start, 0);
plist.add (Properties::length, total_capture);
plist.add (Properties::layer, 0);
-
+
boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
region = boost::dynamic_pointer_cast<MidiRegion> (rx);
XMLNode &before = _playlist->get_state();
_playlist->freeze ();
+ uint32_t buffer_position = 0;
for (buffer_position = 0, ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
string region_name;
const XMLProperty* prop;
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
- uint32_t nchans = 1;
XMLNode* capture_pending_node = 0;
LocaleGuard lg (X_("POSIX"));
set_channel_mode(channel_mode, channel_mask);
- if ((prop = node.property ("channels")) != 0) {
- nchans = atoi (prop->value().c_str());
- }
-
if ((prop = node.property ("playlist")) == 0) {
return -1;
}
MidiPlaylist::MidiPlaylist (Session& session, string name, bool hidden)
: Playlist (session, name, DataType::MIDI, hidden)
+ , _note_mode(Sustained)
{
}
MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, string name, bool hidden)
: Playlist (other, name, hidden)
+ , _note_mode(other->_note_mode)
{
}
MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes_t start, nframes_t dur, string name, bool hidden)
- : Playlist (other, start, dur, name, hidden)
+ : Playlist (other, start, dur, name, hidden)
+ , _note_mode(other->_note_mode)
{
/* this constructor does NOT notify others (session) */
}
}
assert(val <= _list->parameter().max());
- size_t size = 3;
-
if ( ! automation_playback()) {
+ size_t size = 3;
uint8_t ev[3] = { _list->parameter().channel(), int(val), 0 };
switch(_list->parameter().type()) {
case MidiCCAutomation:
OnsetDetector::OnsetDetector (float sr)
: AudioAnalyser (sr, X_("libardourvampplugins:aubioonset"))
+ , current_results (0)
{
/* update the op_id */
BaseStereoPanner::BaseStereoPanner (Panner& p, Evoral::Parameter param)
: StreamPanner (p, param)
+ , left (0.5)
+ , right (0.5)
+ , left_interp (left)
+ , right_interp (right)
{
}
EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
- float pos;
LocaleGuard lg (X_("POSIX"));
if ((prop = node.property (X_("x")))) {
- pos = atof (prop->value().c_str());
+ const float pos = atof (prop->value().c_str());
set_position (pos, true);
}
in_set_state++;
- for (RegionList::const_iterator i = other->regions.begin(); i != other->regions.end(); i++) {
+ for (RegionList::const_iterator i = other->regions.begin(); i != other->regions.end(); ++i) {
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> new_region;
Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float times)
{
times = fabs (times);
- framecnt_t old_length;
{
RegionLock rl1 (this);
RegionLock rl2 (other.get());
- old_length = _get_maximum_extent();
+ framecnt_t old_length = _get_maximum_extent();
int itimes = (int) floor (times);
framepos_t pos = position;
RegionList covering;
set<framepos_t> to_check;
set<boost::shared_ptr<Region> > unique;
- RegionList here;
to_check.insert (start);
to_check.insert (end);
} else {
+ RegionList here;
for (set<framepos_t>::iterator t = to_check.begin(); t != to_check.end(); ++t) {
here.clear ();
RegionList::iterator i;
typedef pair<boost::shared_ptr<Region>,layer_t> LayerInfo;
list<LayerInfo> layerinfo;
- layer_t dest;
{
RegionLock rlock (const_cast<Playlist *> (this));
continue;
}
+ layer_t dest;
+
if (dir > 0) {
/* region is moving up, move all regions on intermediate layers
Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards)
{
RegionList::iterator i;
- framepos_t new_pos;
bool moved = false;
_nudging = true;
if ((*i)->position() >= start) {
+ framepos_t new_pos;
+
if (forwards) {
if ((*i)->last_frame() > max_frames - distance) {
Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
{
bool moved = false;
- framepos_t new_pos;
if (region->locked()) {
return;
break;
}
+ framepos_t new_pos;
+
if ((*next)->position() != region->last_frame() + 1) {
/* they didn't used to touch, so after shuffle,
just have them swap positions.
break;
}
+ framepos_t new_pos;
if (region->position() != (*prev)->last_frame() + 1) {
/* they didn't used to touch, so after shuffle,
just have them swap positions.
}
bool
-Plugin::load_preset(const string preset_uri)
+Plugin::load_preset(const string& preset_uri)
{
lrdf_defaults* defs = lrdf_get_setting_values(preset_uri.c_str());
BootMessage (_("Discovering Plugins"));
}
+
+PluginManager::~PluginManager()
+{
+ delete _lv2_world;
+}
+
+
void
PluginManager::refresh ()
{
PathScanner scanner;
vector<string *>* rdf_files;
vector<string *>::iterator x;
- string uri;
rdf_files = scanner (path, rdf_filter, 0, true, true);
if (rdf_files) {
for (x = rdf_files->begin(); x != rdf_files->end (); ++x) {
- uri = "file://" + **x;
+ const string uri(string("file://") + **x);
if (lrdf_read_file(uri.c_str())) {
warning << "Could not parse rdf file: " << uri << endmsg;
Processor::state (bool full_state)
{
XMLNode* node = new XMLNode (state_node_name);
- stringstream sstr;
char buf[64];
id().print (buf, sizeof (buf));
|| !automation.properties().empty()
|| !_visible_controls.empty()) {
+ stringstream sstr;
for (set<Evoral::Parameter>::iterator x = _visible_controls.begin();
x != _visible_controls.end(); ++x) {
if (x != _visible_controls.begin()) {
{
}
+
+RCConfiguration::~RCConfiguration ()
+{
+ delete _control_protocol_state;
+}
+
int
RCConfiguration::load_state ()
{
if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
"ardour_system.rc", system_rc_file) )
{
- XMLTree tree;
found = true;
string rcfile = system_rc_file.to_string();
if (statbuf.st_size != 0) {
info << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
+ XMLTree tree;
if (!tree.read (rcfile.c_str())) {
error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
return -1;
if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
"ardour.rc", user_rc_file))
{
- XMLTree tree;
found = true;
string rcfile = user_rc_file.to_string();
if (statbuf.st_size != 0) {
info << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
+ XMLTree tree;
if (!tree.read (rcfile)) {
error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
return -1;
int
RCConfiguration::save_state()
{
- XMLTree tree;
-
try
{
sys::create_directories (user_config_directory ());
// this test seems bogus?
if (rcfile.length()) {
+ XMLTree tree;
tree.set_root (&get_state());
if (!tree.write (rcfile.c_str())){
error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* err)
{
ProcessorList deleted;
- ProcessorList as_we_were;
if (!_session.engine().connected()) {
return 1;
ProcessorList::iterator i;
boost::shared_ptr<Processor> processor;
- as_we_were = _processors;
+ ProcessorList as_we_were = _processors;
for (i = _processors.begin(); i != _processors.end(); ) {
}
- for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); r++) {
+ for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) {
boost::shared_ptr<IOProcessor> iop;
{
gain_t g;
- for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) {
+ for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
g = (*i)->amp()->gain();
if ( (g+g*factor) >= 0.0f)
} else {
- /* XXX this logic is wrong for mixed port types */
-
- uint32_t shift = _master_out->n_outputs().n_audio();
- uint32_t mod = _engine.n_physical_outputs (DataType::AUDIO);
- limit = _control_out->n_outputs().n_audio();
-
- cerr << "Connecting " << limit << " control out ports, shift is " << shift << " mod is " << mod << endl;
-
- for (uint32_t n = 0; n < limit; ++n) {
-
- Port* p = _control_out->output()->nth (n);
- string connect_to = _engine.get_nth_physical_output (DataType (p->type()), (n+shift) % mod);
-
- if (!connect_to.empty()) {
- if (_control_out->output()->connect (p, connect_to, this)) {
- error << string_compose (_("cannot connect control output %1 to %2"), n, connect_to)
- << endmsg;
- break;
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ uint32_t shift = _master_out->n_outputs().get(*t);
+ uint32_t mod = _engine.n_physical_outputs (*t);
+ limit = _control_out->n_outputs().get(*t);
+
+ cerr << "Connecting " << limit << " control out ports, shift is " << shift
+ << " mod is " << mod << endl;
+
+ for (uint32_t n = 0; n < limit; ++n) {
+
+ Port* p = _control_out->output()->ports().port(*t, n);
+ string connect_to = _engine.get_nth_physical_output (*t, (n+shift) % mod);
+
+ if (!connect_to.empty()) {
+ if (_control_out->output()->connect (p, connect_to, this)) {
+ error << string_compose (
+ _("cannot connect control output %1 to %2"),
+ n, connect_to)
+ << endmsg;
+ break;
+ }
}
}
}
char track_name[32];
uint32_t track_id = 0;
uint32_t n = 0;
+ uint32_t channels_used = 0;
string port;
RouteList new_routes;
list<boost::shared_ptr<MidiTrack> > ret;
- //uint32_t control_id;
-
- // FIXME: need physical I/O and autoconnect stuff for MIDI
+ uint32_t control_id;
/* count existing midi tracks */
if (boost::dynamic_pointer_cast<MidiTrack>(*i) != 0) {
if (!(*i)->is_hidden()) {
n++;
- //channels_used += (*i)->n_inputs().n_midi();
+ channels_used += (*i)->n_inputs().n_midi();
}
}
}
_engine.get_physical_outputs (DataType::MIDI, physoutputs);
_engine.get_physical_inputs (DataType::MIDI, physinputs);
- // control_id = ntracks() + nbusses();
+ control_id = ntracks() + nbusses();
while (how_many) {
shared_ptr<MidiTrack> track;
try {
- track = boost::shared_ptr<MidiTrack>((new MidiTrack (*this, track_name, Route::Flag (0), mode)));
+ MidiTrack* mt = new MidiTrack (*this, track_name, Route::Flag (0), mode);
+ boost_debug_shared_ptr_mark_interesting (mt, "Track");
+ track = boost::shared_ptr<MidiTrack>(mt);
if (track->input()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) {
error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg;
goto failed;
}
+ if (!physinputs.empty()) {
+ uint32_t nphysical_in = physinputs.size();
+
+ for (uint32_t x = 0; x < track->n_inputs().n_midi() && x < nphysical_in; ++x) {
+
+ port = "";
+
+ if (Config->get_input_auto_connect() & AutoConnectPhysical) {
+ port = physinputs[(channels_used+x)%nphysical_in];
+ }
+
+ if (port.length() && track->input()->connect (track->input()->nth(x), port, this)) {
+ break;
+ }
+ }
+ }
+
+ if (!physoutputs.empty()) {
+ uint32_t nphysical_out = physoutputs.size();
+
+ for (uint32_t x = 0; x < track->n_outputs().n_midi(); ++x) {
+ port = "";
+
+ if (Config->get_output_auto_connect() & AutoConnectPhysical) {
+ port = physoutputs[(channels_used+x)%nphysical_out];
+ } else if (Config->get_output_auto_connect() & AutoConnectMaster) {
+ if (_master_out && _master_out->n_inputs().n_midi() > 0) {
+ port = _master_out->input()->nth (x % _master_out->input()->n_ports().n_midi())->name();
+ }
+ }
+
+ if (port.length() && track->output()->connect (track->output()->nth(x), port, this)) {
+ break;
+ }
+ }
+ }
+
+ channels_used += track->n_inputs ().n_audio();
+
+
+
/*
if (nphysical_in) {
for (uint32_t x = 0; x < track->n_inputs().n_midi() && x < nphysical_in; ++x) {
}
bool
-VSTPlugin::load_preset (string name)
+VSTPlugin::load_preset (const string& name)
{
if (_plugin->flags & 32 /* effFlagsProgramsChunks */) {
error << _("no support for presets using chunks at this time")