/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2002-2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef __ardour_audio_port_h__
#define __ardour_audio_port_h__
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <ardour/port.h>
-#include <ardour/audio_buffer.h>
+#include "ardour/port.h"
+#include "ardour/audio_buffer.h"
namespace ARDOUR {
-class AudioEngine;
-
-class AudioPort : public virtual Port {
+class AudioPort : public Port
+{
public:
- virtual Buffer& get_buffer () {
- return _buffer;
- }
-
- virtual AudioBuffer& get_audio_buffer() {
- return _buffer;
+ ~AudioPort ();
+
+ DataType type () const {
+ return DataType::AUDIO;
}
- void reset_overs () {
- _short_overs = 0;
- _long_overs = 0;
- _overlen = 0;
+ void cycle_start (nframes_t);
+ void cycle_end (nframes_t);
+ void cycle_split ();
+
+ size_t raw_buffer_size(jack_nframes_t nframes) const;
+
+ Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) {
+ return get_audio_buffer (nframes, offset);
}
- void reset_peak_meter () {
- _peak = 0;
+ AudioBuffer& get_audio_buffer (nframes_t nframes, nframes_t offset = 0);
+
+ static nframes_t port_offset() { return _port_offset; }
+
+ static void set_port_offset (nframes_t off) {
+ _port_offset = off;
}
- void reset_meters () {
- reset_peak_meter ();
- reset_overs ();
+ static void increment_port_offset (nframes_t n) {
+ _port_offset += n;
}
-
- float peak_db() const { return _peak_db; }
- Sample peak() const { return _peak; }
-
- uint32_t short_overs () const { return _short_overs; }
- uint32_t long_overs () const { return _long_overs; }
- static void set_short_over_length (nframes_t);
- static void set_long_over_length (nframes_t);
-
protected:
friend class AudioEngine;
- AudioPort (Flags); // data buffer comes from elsewhere (e.g. JACK)
- AudioPort (Flags, nframes_t); // data buffer owned by ardour
- void reset ();
-
- /* engine isn't supposed to access below here */
+ AudioPort (std::string const &, Flags);
- AudioBuffer _buffer;
+ private:
+ AudioBuffer* _buffer;
- nframes_t _overlen;
- Sample _peak;
- float _peak_db;
- uint32_t _short_overs;
- uint32_t _long_overs;
-
- static nframes_t _long_over_length;
- static nframes_t _short_over_length;
+ static nframes_t _port_offset;
};
-
+
} // namespace ARDOUR
#endif /* __ardour_audio_port_h__ */