mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-30 17:03:06 +01:00
remove XML constructors for Route, Track, AudioTrack, MidiTrack; make Session::XMLRouteFactory() call a constructor and then set_state(); lots of debugging output (will remove next commit)
git-svn-id: svn://localhost/ardour2/branches/3.0@6789 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f11a5e1769
commit
b3a3e66f77
10 changed files with 80 additions and 66 deletions
|
|
@ -33,7 +33,6 @@ class AudioTrack : public Track
|
|||
{
|
||||
public:
|
||||
AudioTrack (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
|
||||
AudioTrack (Session&, const XMLNode&, int);
|
||||
~AudioTrack ();
|
||||
|
||||
int set_mode (TrackMode m);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ class MidiTrack : public Track
|
|||
{
|
||||
public:
|
||||
MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
|
||||
MidiTrack (Session&, const XMLNode&, int);
|
||||
~MidiTrack ();
|
||||
|
||||
int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
|
|||
};
|
||||
|
||||
Route (Session&, std::string name, Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
|
||||
Route (Session&, const XMLNode&, DataType default_type = DataType::AUDIO);
|
||||
virtual ~Route();
|
||||
|
||||
boost::shared_ptr<IO> input() const { return _input; }
|
||||
|
|
@ -391,6 +390,8 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
|
|||
bool _solo_safe;
|
||||
DataType _default_type;
|
||||
|
||||
virtual ChanCount input_streams () const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual XMLNode& state(bool);
|
||||
|
|
|
|||
|
|
@ -94,14 +94,14 @@ class Track : public Route
|
|||
PBD::Signal0<void> FreezeChange;
|
||||
|
||||
protected:
|
||||
Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
|
||||
|
||||
virtual XMLNode& state (bool full) = 0;
|
||||
|
||||
boost::shared_ptr<Diskstream> _diskstream;
|
||||
MeterPoint _saved_meter_point;
|
||||
TrackMode _mode;
|
||||
|
||||
ChanCount input_streams () const;
|
||||
|
||||
//private: (FIXME)
|
||||
struct FreezeRecordProcessorInfo {
|
||||
FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc)
|
||||
|
|
|
|||
|
|
@ -55,12 +55,6 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
|
|||
use_new_diskstream ();
|
||||
}
|
||||
|
||||
AudioTrack::AudioTrack (Session& sess, const XMLNode& node, int /*version*/)
|
||||
: Track (sess, node)
|
||||
{
|
||||
_set_state (node, Stateful::loading_state_version, false);
|
||||
}
|
||||
|
||||
AudioTrack::~AudioTrack ()
|
||||
{
|
||||
}
|
||||
|
|
@ -463,13 +457,12 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (n_outputs().n_total() == 0 && _processors.empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_active) {
|
||||
silence (nframes);
|
||||
silence (nframes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -523,9 +516,20 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
|
|||
BufferSet& bufs = _session.get_scratch_buffers ();
|
||||
const size_t blimit = bufs.count().n_audio();
|
||||
|
||||
if (limit == 0) {
|
||||
/* no inputs, try for diskstream channel count */
|
||||
limit = diskstream->n_channels().n_audio();
|
||||
}
|
||||
|
||||
uint32_t n;
|
||||
uint32_t i;
|
||||
|
||||
cerr << _name << " Input = " << _input->n_ports()
|
||||
<< " Output " << _output->n_ports ()
|
||||
<< " limit " << limit
|
||||
<< " blimit " << blimit
|
||||
<< endl;
|
||||
|
||||
if (limit > blimit) {
|
||||
|
||||
/* example case: auditioner configured for stereo output,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "ardour/session.h"
|
||||
#include "ardour/auditioner.h"
|
||||
#include "ardour/audioplaylist.h"
|
||||
#include "ardour/audio_port.h"
|
||||
#include "ardour/panner.h"
|
||||
#include "ardour/data_type.h"
|
||||
#include "ardour/region_factory.h"
|
||||
|
|
@ -46,11 +47,19 @@ Auditioner::Auditioner (Session& s)
|
|||
string right = _session.config.get_auditioner_output_right();
|
||||
|
||||
if (left == "default") {
|
||||
left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
|
||||
if (_session.monitor_out()) {
|
||||
left = _session.monitor_out()->input()->audio (0)->name();
|
||||
} else {
|
||||
left = _session.engine().get_nth_physical_output (DataType::AUDIO, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (right == "default") {
|
||||
right = _session.engine().get_nth_physical_output (DataType::AUDIO, 1);
|
||||
if (_session.monitor_out()) {
|
||||
right = _session.monitor_out()->input()->audio (1)->name();
|
||||
} else {
|
||||
right = _session.engine().get_nth_physical_output (DataType::AUDIO, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((left.length() == 0) && (right.length() == 0)) {
|
||||
|
|
@ -60,6 +69,8 @@ Auditioner::Auditioner (Session& s)
|
|||
|
||||
_main_outs->defer_pan_reset ();
|
||||
|
||||
cerr << "Aud connect " << left << " + " << right << endl;
|
||||
|
||||
if (left.length()) {
|
||||
_output->add_port (left, this, DataType::AUDIO);
|
||||
}
|
||||
|
|
@ -183,7 +194,10 @@ Auditioner::play_audition (nframes_t nframes)
|
|||
|
||||
_diskstream->prepare ();
|
||||
|
||||
cerr << "Auditioner rolls, gain = " << gain_control()->get_value() << endl;
|
||||
|
||||
if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, false, false)) != 0) {
|
||||
cerr << "\troll failed\n";
|
||||
silence (nframes);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,18 +65,6 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
|
|||
_mode = mode;
|
||||
}
|
||||
|
||||
MidiTrack::MidiTrack (Session& sess, const XMLNode& node, int /*version*/)
|
||||
: Track (sess, node, DataType::MIDI)
|
||||
, _immediate_events(1024) // FIXME: size?
|
||||
, _step_edit_ring_buffer(64) // FIXME: size?
|
||||
, _note_mode(Sustained)
|
||||
, _step_editing (false)
|
||||
, _default_channel (0)
|
||||
, _midi_thru (true)
|
||||
{
|
||||
_set_state (node, Stateful::loading_state_version, false);
|
||||
}
|
||||
|
||||
MidiTrack::~MidiTrack ()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,23 +121,6 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
|
|||
Metering::Meter.connect_same_thread (*this, (boost::bind (&Route::meter, this)));
|
||||
}
|
||||
|
||||
Route::Route (Session& sess, const XMLNode& node, DataType default_type)
|
||||
: SessionObject (sess, "toBeReset")
|
||||
, AutomatableControls (sess)
|
||||
, _solo_control (new SoloControllable (X_("solo"), *this))
|
||||
, _mute_control (new MuteControllable (X_("mute"), *this))
|
||||
, _mute_master (new MuteMaster (sess, "toBeReset"))
|
||||
, _default_type (default_type)
|
||||
{
|
||||
init ();
|
||||
|
||||
_set_state (node, Stateful::loading_state_version, false);
|
||||
|
||||
/* now that we have _meter, its safe to connect to this */
|
||||
|
||||
Metering::Meter.connect_same_thread (*this, (boost::bind (&Route::meter, this)));
|
||||
}
|
||||
|
||||
void
|
||||
Route::init ()
|
||||
{
|
||||
|
|
@ -472,6 +455,8 @@ Route::process_output_buffers (BufferSet& bufs,
|
|||
<< endl;
|
||||
}
|
||||
assert (bufs.count() == (*i)->input_streams());
|
||||
|
||||
cerr << _name << " run processor " << (*i)->name() << " with " << bufs.count() << endl;
|
||||
|
||||
(*i)->run (bufs, start_frame, end_frame, nframes, *i != _processors.back());
|
||||
bufs.set_count ((*i)->output_streams());
|
||||
|
|
@ -1515,6 +1500,13 @@ Route::configure_processors (ProcessorStreams* err)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ChanCount
|
||||
Route::input_streams () const
|
||||
{
|
||||
cerr << "!!!!!!!!!" << _name << " ::input_streams()\n";
|
||||
return _input->n_ports ();
|
||||
}
|
||||
|
||||
/** Configure the input/output configuration of each processor in the processors list.
|
||||
* Return 0 on success, otherwise configuration is impossible.
|
||||
*/
|
||||
|
|
@ -1528,7 +1520,10 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
|
|||
_in_configure_processors = true;
|
||||
|
||||
// Check each processor in order to see if we can configure as requested
|
||||
ChanCount in = _input->n_ports ();
|
||||
if (_name == "auditioner") {
|
||||
cerr << "AUD conf\n";
|
||||
}
|
||||
ChanCount in = input_streams ();
|
||||
ChanCount out;
|
||||
list< pair<ChanCount,ChanCount> > configuration;
|
||||
uint32_t index = 0;
|
||||
|
|
|
|||
|
|
@ -1419,35 +1419,43 @@ Session::load_routes (const XMLNode& node, int version)
|
|||
boost::shared_ptr<Route>
|
||||
Session::XMLRouteFactory (const XMLNode& node, int version)
|
||||
{
|
||||
boost::shared_ptr<Route> ret;
|
||||
|
||||
if (node.name() != "Route") {
|
||||
return boost::shared_ptr<Route> ((Route*) 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0);
|
||||
|
||||
DataType type = DataType::AUDIO;
|
||||
const XMLProperty* prop = node.property("default-type");
|
||||
boost::shared_ptr<Route> ret;
|
||||
|
||||
if (prop) {
|
||||
type = DataType(prop->value());
|
||||
type = DataType (prop->value());
|
||||
}
|
||||
|
||||
assert(type != DataType::NIL);
|
||||
assert (type != DataType::NIL);
|
||||
|
||||
if (has_diskstream) {
|
||||
if (type == DataType::AUDIO) {
|
||||
AudioTrack* at = new AudioTrack (*this, node, version);
|
||||
boost_debug_shared_ptr_mark_interesting (at, "Track");
|
||||
ret.reset (at);
|
||||
|
||||
AudioTrack* at = new AudioTrack (*this, X_("toBeResetFroXML"));
|
||||
if (at->set_state (node, version) == 0) {
|
||||
boost_debug_shared_ptr_mark_interesting (at, "Track");
|
||||
ret.reset (at);
|
||||
}
|
||||
|
||||
} else {
|
||||
ret.reset (new MidiTrack (*this, node, version));
|
||||
MidiTrack* mt = new MidiTrack (*this, X_("toBeResetFroXML"));
|
||||
if (mt->set_state (node, version) == 0) {
|
||||
ret.reset (mt);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Route* rt = new Route (*this, node);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
ret.reset (rt);
|
||||
Route* rt = new Route (*this, X_("toBeResetFroXML"));
|
||||
if (rt->set_state (node, version) == 0) {
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
ret.reset (rt);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -49,15 +49,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data
|
|||
_mode = mode;
|
||||
}
|
||||
|
||||
Track::Track (Session& sess, const XMLNode& node, DataType default_type)
|
||||
: Route (sess, node, default_type)
|
||||
, _rec_enable_control (new RecEnableControllable(*this))
|
||||
{
|
||||
_freeze_record.state = NoFreeze;
|
||||
_declickable = true;
|
||||
_saved_meter_point = _meter_point;
|
||||
}
|
||||
|
||||
Track::~Track ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Destruction, string_compose ("track %1 destructor\n", _name));
|
||||
|
|
@ -348,3 +339,18 @@ Track::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*en
|
|||
|
||||
return diskstream()->process (_session.transport_frame(), nframes, can_record, rec_monitors_input);
|
||||
}
|
||||
|
||||
ChanCount
|
||||
Track::input_streams () const
|
||||
{
|
||||
ChanCount cc = _input->n_ports ();
|
||||
|
||||
cerr << "**************" << _name << " IS = " << cc << endl;
|
||||
|
||||
if (cc.n_total() == 0 && _diskstream) {
|
||||
cerr << "*******" << _name << " use diskstream channel count\n";
|
||||
return cc = _diskstream->n_channels();
|
||||
}
|
||||
|
||||
return cc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue