/*
- 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 <jack/jack.h>
-#include <ardour/port.h>
-#include <ardour/buffer.h>
+#include "ardour/port.h"
+#include "ardour/audio_buffer.h"
namespace ARDOUR {
-class AudioEngine;
-
-class AudioPort : public Port {
+class AudioPort : public Port
+{
public:
- virtual ~AudioPort() {
- free (_port);
- }
-
- void cycle_start(jack_nframes_t nframes);
- void cycle_end();
+ ~AudioPort ();
- DataType type() const { return DataType(DataType::AUDIO); }
-
- Buffer& get_buffer () {
- return _buffer;
- }
-
- AudioBuffer& get_audio_buffer() {
- return _buffer;
+ DataType type () const {
+ return DataType::AUDIO;
}
- void reset_overs () {
- _short_overs = 0;
- _long_overs = 0;
- _overlen = 0;
- }
+ void cycle_start (pframes_t);
+ void cycle_end (pframes_t);
+ void cycle_split ();
- void reset_peak_meter () {
- _peak = 0;
- }
-
- void reset_meters () {
- reset_peak_meter ();
- reset_overs ();
+ Buffer& get_buffer (pframes_t nframes) {
+ return get_audio_buffer (nframes);
}
- float peak_db() const { return _peak_db; }
- jack_default_audio_sample_t 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 (jack_nframes_t);
- static void set_long_over_length (jack_nframes_t);
-
- /** Assumes that the port is an audio output port */
- void silence (jack_nframes_t nframes, jack_nframes_t offset) {
- if (!_silent) {
- _buffer.clear(offset);
- if (offset == 0 && nframes == _buffer.capacity()) {
- _silent = true;
- }
- }
- }
-
+ AudioBuffer& get_audio_buffer (pframes_t nframes);
+
protected:
friend class AudioEngine;
- AudioPort (jack_port_t *port);
- void reset ();
-
- /* engine isn't supposed to access below here */
-
- AudioBuffer _buffer;
-
- jack_nframes_t _overlen;
- jack_default_audio_sample_t _peak;
- float _peak_db;
- uint32_t _short_overs;
- uint32_t _long_overs;
-
- static jack_nframes_t _long_over_length;
- static jack_nframes_t _short_over_length;
+ AudioPort (std::string const &, Flags);
+
+ private:
+ AudioBuffer* _buffer;
};
-
+
} // namespace ARDOUR
#endif /* __ardour_audio_port_h__ */