X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Faudio_port.h;h=4f106c5593000328f8f34e2bb5c1e328da5972e5;hb=777fe3c68fef42d8fee79432830787bcebdfcb59;hp=0e85e0e01b101c29933db2a2d55f8227c63989ca;hpb=a8da89d745c6a7e7d4c20dfcfb16b2537d767428;p=ardour.git diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h index 0e85e0e01b..4f106c5593 100644 --- a/libs/ardour/ardour/audio_port.h +++ b/libs/ardour/ardour/audio_port.h @@ -1,5 +1,5 @@ /* - 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 @@ -21,83 +21,46 @@ #ifndef __ardour_audio_port_h__ #define __ardour_audio_port_h__ -#include -#include -#include -#include -#include -#include +#include "zita-resampler/vmresampler.h" -namespace ARDOUR { +#include "ardour/port.h" +#include "ardour/audio_buffer.h" -class AudioEngine; +namespace ARDOUR { -class AudioPort : public Port { - public: - virtual ~AudioPort() { - free (_port); - } +class LIBARDOUR_API AudioPort : public Port +{ +public: + ~AudioPort (); - void cycle_start(nframes_t nframes) { - _buffer.set_data ((Sample*) jack_port_get_buffer (_port, nframes), nframes); + DataType type () const { + return DataType::AUDIO; } - void cycle_end() {} + void cycle_start (pframes_t); + void cycle_end (pframes_t); + void cycle_split (); - DataType type() const { return DataType(DataType::AUDIO); } - - Buffer& get_buffer () { - return _buffer; - } - - AudioBuffer& get_audio_buffer() { - return _buffer; + Buffer& get_buffer (pframes_t nframes) { + return get_audio_buffer (nframes); } - void reset_overs () { - _short_overs = 0; - _long_overs = 0; - _overlen = 0; - } + AudioBuffer& get_audio_buffer (pframes_t nframes); - void reset_peak_meter () { - _peak = 0; - } - - void reset_meters () { - reset_peak_meter (); - reset_overs (); - } +protected: + friend class PortManager; + AudioPort (std::string const &, PortFlags); - 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 (nframes_t); - static void set_long_over_length (nframes_t); - - protected: - friend class AudioEngine; - - AudioPort (jack_port_t *port); - void reset (); - - /* engine isn't supposed to access below here */ - - AudioBuffer _buffer; - - nframes_t _overlen; - jack_default_audio_sample_t _peak; - float _peak_db; - uint32_t _short_overs; - uint32_t _long_overs; - - static nframes_t _long_over_length; - static nframes_t _short_over_length; + /* special access for PortManager only (hah, C++) */ + Sample* engine_get_whole_audio_buffer (); + +private: + AudioBuffer* _buffer; + ArdourZita::VMResampler _src; + Sample* _data; + bool _buf_valid; }; - + } // namespace ARDOUR #endif /* __ardour_audio_port_h__ */