mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Clean/strengthen up constructor/type stuff in new port system.
git-svn-id: svn://localhost/ardour2/trunk@2572 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0cb6567836
commit
f53f2e8e33
11 changed files with 19 additions and 28 deletions
|
|
@ -33,8 +33,6 @@ class AudioEngine;
|
||||||
|
|
||||||
class AudioPort : public virtual Port {
|
class AudioPort : public virtual Port {
|
||||||
public:
|
public:
|
||||||
DataType type() const { return DataType::AUDIO; }
|
|
||||||
|
|
||||||
virtual Buffer& get_buffer () {
|
virtual Buffer& get_buffer () {
|
||||||
return _buffer;
|
return _buffer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ class MidiPort : public virtual Port {
|
||||||
public:
|
public:
|
||||||
virtual ~MidiPort();
|
virtual ~MidiPort();
|
||||||
|
|
||||||
DataType type() const { return DataType::MIDI; }
|
|
||||||
|
|
||||||
Buffer& get_buffer() {
|
Buffer& get_buffer() {
|
||||||
return _buffer;
|
return _buffer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,8 @@ class Port : public virtual sigc::trackable {
|
||||||
if (_metering) { _metering--; }
|
if (_metering) { _metering--; }
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual DataType type() const = 0;
|
DataType type() const { return _type; }
|
||||||
|
|
||||||
virtual void cycle_start(nframes_t nframes) {}
|
virtual void cycle_start(nframes_t nframes) {}
|
||||||
virtual void cycle_end() {}
|
virtual void cycle_end() {}
|
||||||
virtual Buffer& get_buffer() = 0;
|
virtual Buffer& get_buffer() = 0;
|
||||||
|
|
@ -97,7 +98,7 @@ class Port : public virtual sigc::trackable {
|
||||||
protected:
|
protected:
|
||||||
friend class AudioEngine;
|
friend class AudioEngine;
|
||||||
|
|
||||||
Port (Flags);
|
Port (DataType, Flags);
|
||||||
|
|
||||||
virtual int disconnect () = 0;
|
virtual int disconnect () = 0;
|
||||||
virtual void recompute_total_latency() const = 0;
|
virtual void recompute_total_latency() const = 0;
|
||||||
|
|
@ -106,7 +107,7 @@ class Port : public virtual sigc::trackable {
|
||||||
/* engine isn't supposed to access below here */
|
/* engine isn't supposed to access below here */
|
||||||
|
|
||||||
Flags _flags;
|
Flags _flags;
|
||||||
std::string _type;
|
const DataType _type;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
unsigned short _metering;
|
unsigned short _metering;
|
||||||
bool _last_monitor;
|
bool _last_monitor;
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,14 @@ nframes_t AudioPort::_short_over_length = 2;
|
||||||
nframes_t AudioPort::_long_over_length = 10;
|
nframes_t AudioPort::_long_over_length = 10;
|
||||||
|
|
||||||
AudioPort::AudioPort(Flags flags)
|
AudioPort::AudioPort(Flags flags)
|
||||||
: Port (flags), _buffer (0)
|
: Port (DataType::AUDIO, flags), _buffer (0)
|
||||||
{
|
{
|
||||||
_type = DataType::AUDIO;
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioPort::AudioPort(Flags flags, nframes_t nframes)
|
AudioPort::AudioPort(Flags flags, nframes_t nframes)
|
||||||
: Port (flags), _buffer (nframes)
|
: Port (DataType::AUDIO, flags), _buffer (nframes)
|
||||||
{
|
{
|
||||||
_type = DataType::AUDIO;
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ InternalAudioPort::default_mixdown (const list<InternalPort*>& ports, AudioBuffe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalAudioPort::InternalAudioPort(const string& name, Flags flgs)
|
InternalAudioPort::InternalAudioPort(const string& name, Flags flags)
|
||||||
: Port (flgs)
|
: Port (DataType::AUDIO, flags)
|
||||||
, AudioPort (flgs, engine->frames_per_cycle())
|
, AudioPort (flags, engine->frames_per_cycle())
|
||||||
, InternalPort (name, DataType::AUDIO, flgs)
|
, InternalPort (name, DataType::AUDIO, flags)
|
||||||
{
|
{
|
||||||
_mixdown = default_mixdown;
|
_mixdown = default_mixdown;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,9 @@ InternalPort::set_engine (AudioEngine* e)
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalPort::InternalPort (const string& str, DataType type, Flags flags)
|
InternalPort::InternalPort (const string& str, DataType type, Flags flags)
|
||||||
: Port (flags)
|
: Port (type, flags)
|
||||||
{
|
{
|
||||||
set_name (str);
|
set_name (str);
|
||||||
_type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalPort::~InternalPort ()
|
InternalPort::~InternalPort ()
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
JackAudioPort::JackAudioPort(const std::string& name, Flags flgs)
|
JackAudioPort::JackAudioPort(const std::string& name, Flags flgs)
|
||||||
: Port (flgs), AudioPort (flgs), JackPort (name, DataType::AUDIO, flgs)
|
: Port (DataType::AUDIO, flgs), AudioPort (flgs), JackPort (name, DataType::AUDIO, flgs)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
JackMidiPort::JackMidiPort (const std::string& name, Flags flgs)
|
JackMidiPort::JackMidiPort (const std::string& name, Flags flgs)
|
||||||
: Port (flgs)
|
: Port (DataType::MIDI, flgs)
|
||||||
, JackPort (name, DataType::MIDI, flgs)
|
, JackPort (name, DataType::MIDI, flgs)
|
||||||
, MidiPort (flgs, 4096) // FIXME FIXME FIXME Jack needs to tell us this
|
, MidiPort (flgs, 4096) // FIXME FIXME FIXME Jack needs to tell us this
|
||||||
, _nframes_this_cycle(0)
|
, _nframes_this_cycle(0)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ using namespace std;
|
||||||
AudioEngine* JackPort::engine = 0;
|
AudioEngine* JackPort::engine = 0;
|
||||||
|
|
||||||
JackPort::JackPort (const std::string& name, DataType type, Flags flgs)
|
JackPort::JackPort (const std::string& name, DataType type, Flags flgs)
|
||||||
: Port (flgs), _port (0)
|
: Port (type, flgs), _port (0)
|
||||||
{
|
{
|
||||||
_port = jack_port_register (engine->jack(), name.c_str(), type.to_jack_type(), flgs, 0);
|
_port = jack_port_register (engine->jack(), name.c_str(), type.to_jack_type(), flgs, 0);
|
||||||
|
|
||||||
|
|
@ -39,8 +39,6 @@ JackPort::JackPort (const std::string& name, DataType type, Flags flgs)
|
||||||
throw failed_constructor();
|
throw failed_constructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
_flags = flgs;
|
|
||||||
_type = type;
|
|
||||||
_name = jack_port_name (_port);
|
_name = jack_port_name (_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,10 @@ using namespace ARDOUR;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
MidiPort::MidiPort (Flags flags, nframes_t bufsize)
|
MidiPort::MidiPort (Flags flags, nframes_t bufsize)
|
||||||
: Port (flags), _buffer (bufsize)
|
: Port (DataType::MIDI, flags)
|
||||||
|
, _buffer (bufsize)
|
||||||
{
|
{
|
||||||
_type = DataType::MIDI;
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiPort::~MidiPort()
|
MidiPort::~MidiPort()
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
Port::Port (Flags flags)
|
Port::Port (DataType type, Flags flags)
|
||||||
: _flags (flags)
|
: _flags (flags)
|
||||||
|
, _type (type)
|
||||||
, _metering (0)
|
, _metering (0)
|
||||||
, _last_monitor (false)
|
, _last_monitor (false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue