13
0

clarify some confusion about how "raw" port buffer sizes are defined

git-svn-id: svn://localhost/ardour2/branches/3.0@9628 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-05-29 17:33:41 +00:00
parent 489d2ba1a7
commit 36ccf83049
6 changed files with 9 additions and 23 deletions

View File

@ -39,8 +39,6 @@ class AudioPort : public Port
void cycle_end (pframes_t);
void cycle_split ();
size_t raw_buffer_size (pframes_t nframes) const;
Buffer& get_buffer (pframes_t nframes) {
return get_audio_buffer (nframes);
}

View File

@ -43,8 +43,7 @@ class MidiPort : public Port {
void flush_buffers (pframes_t nframes, framepos_t time);
void transport_stopped ();
size_t raw_buffer_size (pframes_t nframes) const;
void reset ();
Buffer& get_buffer (pframes_t nframes) {
return get_midi_buffer (nframes);

View File

@ -111,9 +111,6 @@ public:
virtual void reset ();
/** @return the size of the raw buffer (bytes) for duration @a nframes (audio frames) */
virtual size_t raw_buffer_size (pframes_t nframes) const = 0;
virtual DataType type () const = 0;
virtual void cycle_start (pframes_t);
virtual void cycle_end (pframes_t) = 0;

View File

@ -79,9 +79,5 @@ AudioPort::get_audio_buffer (pframes_t nframes)
return *_buffer;
}
size_t
AudioPort::raw_buffer_size (pframes_t nframes) const
{
return nframes * sizeof (Sample);
}

View File

@ -815,12 +815,6 @@ AudioEngine::register_port (DataType dtype, const string& portname, bool input)
throw PortRegistrationFailure("unable to create port (unknown type)");
}
size_t& old_buffer_size = _raw_buffer_sizes[newport->type()];
size_t port_buffer_size = newport->raw_buffer_size(0);
if (port_buffer_size > old_buffer_size) {
old_buffer_size = port_buffer_size;
}
RCUWriter<Ports> writer (ports);
boost::shared_ptr<Ports> ps = writer.get_copy ();
ps->insert (ps->begin(), newport);

View File

@ -21,6 +21,7 @@
#include "ardour/midi_port.h"
#include "ardour/data_type.h"
#include "ardour/audioengine.h"
using namespace ARDOUR;
using namespace std;
@ -30,7 +31,7 @@ MidiPort::MidiPort (const std::string& name, Flags flags)
, _has_been_mixed_down (false)
, _resolve_in_process (false)
{
_buffer = new MidiBuffer (raw_buffer_size(0));
_buffer = new MidiBuffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI));
}
MidiPort::~MidiPort()
@ -162,9 +163,10 @@ MidiPort::transport_stopped ()
_resolve_in_process = true;
}
size_t
MidiPort::raw_buffer_size (pframes_t nframes) const
void
MidiPort::reset ()
{
return jack_midi_max_event_size (jack_port_get_buffer (_jack_port, nframes));
Port::reset ();
delete _buffer;
_buffer = new MidiBuffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI));
}