summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-08-11 03:24:57 +0000
committerDavid Robillard <d@drobilla.net>2006-08-11 03:24:57 +0000
commit30c08ba655330232767554c48bda1975bfb5628c (patch)
treec6bf6b62de69afdd6b2a42ef3a7d9f80e0f65f7c /libs/ardour/ardour
parentab6f1ed9bafa869648b6e94ee5186ff317b32c3e (diff)
- Changed IO's vector<Port*>'s to PortList
- Added new Port classes, code to drive them - Added PortList, which is a filthy mess ATM (nevermind that, it's the interface that's important at this stage) - Added ChanCount, though it isn't very thoroughly used yet. That's the next step.... - Fixed a few bugs relating to loading sessions saved with trunk - Fixed a few random other bugs Slowly working towards type agnosticism while keeping all the former code/logic intact is the name of the game here Warning: Removing ports is currently (intentionally) broken due solely to laziness. git-svn-id: svn://localhost/ardour2/branches/midi@786 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_diskstream.h9
-rw-r--r--libs/ardour/ardour/audio_port.h110
-rw-r--r--libs/ardour/ardour/audio_track.h2
-rw-r--r--libs/ardour/ardour/audio_unit.h2
-rw-r--r--libs/ardour/ardour/audioengine.h14
-rw-r--r--libs/ardour/ardour/audioplaylist.h2
-rw-r--r--libs/ardour/ardour/audioregion.h36
-rw-r--r--libs/ardour/ardour/audiosource.h24
-rw-r--r--libs/ardour/ardour/buffer.h103
-rw-r--r--libs/ardour/ardour/chan_count.h81
-rw-r--r--libs/ardour/ardour/coreaudiosource.h4
-rw-r--r--libs/ardour/ardour/crossfade.h2
-rw-r--r--libs/ardour/ardour/data_type.h80
-rw-r--r--libs/ardour/ardour/destructive_filesource.h4
-rw-r--r--libs/ardour/ardour/diskstream.h10
-rw-r--r--libs/ardour/ardour/insert.h5
-rw-r--r--libs/ardour/ardour/io.h62
-rw-r--r--libs/ardour/ardour/midi_diskstream.h69
-rw-r--r--libs/ardour/ardour/midi_playlist.h4
-rw-r--r--libs/ardour/ardour/midi_port.h72
-rw-r--r--libs/ardour/ardour/midi_region.h93
-rw-r--r--libs/ardour/ardour/midi_source.h30
-rw-r--r--libs/ardour/ardour/midi_track.h7
-rw-r--r--libs/ardour/ardour/plugin.h13
-rw-r--r--libs/ardour/ardour/port.h125
-rw-r--r--libs/ardour/ardour/port_set.h151
-rw-r--r--libs/ardour/ardour/region.h61
-rw-r--r--libs/ardour/ardour/route.h2
-rw-r--r--libs/ardour/ardour/session.h14
-rw-r--r--libs/ardour/ardour/smf_source.h9
-rw-r--r--libs/ardour/ardour/sndfilesource.h4
-rw-r--r--libs/ardour/ardour/source.h10
-rw-r--r--libs/ardour/ardour/types.h13
-rw-r--r--libs/ardour/ardour/vst_plugin.h2
34 files changed, 807 insertions, 422 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index e2dfc5fd0c..0cc2079d8e 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -211,11 +211,11 @@ class AudioDiskstream : public Diskstream
/* The two central butler operations */
int do_flush (Session::RunContext context, bool force = false);
- int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer, _conversion_buffer); }
+ int do_refill () { return _do_refill(_mixdown_buffer, _gain_buffer); }
int do_refill_with_alloc();
- int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, char * workbuf,
+ int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
jack_nframes_t& start, jack_nframes_t cnt,
ChannelInfo& channel_info, int channel, bool reversed);
@@ -251,10 +251,9 @@ class AudioDiskstream : public Diskstream
static size_t _working_buffers_size;
static Sample* _mixdown_buffer;
static gain_t* _gain_buffer;
- static char* _conversion_buffer;
- // Uh, /really/ private? (death to friend classes)
- int _do_refill (Sample *mixdown_buffer, float *gain_buffer, char *workbuf);
+ // Uh, /really/ private? (there should probably be less friends of Diskstream)
+ int _do_refill (Sample *mixdown_buffer, float *gain_buffer);
std::vector<AudioFileSource*> capturing_sources;
diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h
new file mode 100644
index 0000000000..1eab294028
--- /dev/null
+++ b/libs/ardour/ardour/audio_port.h
@@ -0,0 +1,110 @@
+/*
+ Copyright (C) 2002 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
+*/
+
+#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>
+
+namespace ARDOUR {
+
+class AudioEngine;
+
+class AudioPort : public Port {
+ public:
+ virtual ~AudioPort() {
+ free (_port);
+ }
+
+ void cycle_start(jack_nframes_t nframes);
+ void cycle_end();
+
+ DataType type() const { return DataType(DataType::AUDIO); }
+
+ Buffer& get_buffer () {
+ return _buffer;
+ }
+
+ AudioBuffer& get_audio_buffer() {
+ return _buffer;
+ }
+
+ void reset_overs () {
+ _short_overs = 0;
+ _long_overs = 0;
+ _overlen = 0;
+ }
+
+ void reset_peak_meter () {
+ _peak = 0;
+ }
+
+ void reset_meters () {
+ reset_peak_meter ();
+ reset_overs ();
+ }
+
+ 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;
+ }
+ }
+ }
+
+ 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;
+};
+
+} // namespace ARDOUR
+
+#endif /* __ardour_audio_port_h__ */
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index 15b99297c8..9892179085 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -51,7 +51,7 @@ class AudioTrack : public Track
int use_diskstream (string name);
int use_diskstream (const PBD::ID& id);
- int export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t end_frame);
+ int export_stuff (vector<Sample*>& buffers, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t end_frame);
void freeze (InterThreadInfo&);
void unfreeze ();
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 1c8d6cbc2d..348a8ff863 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -96,6 +96,8 @@ class AUPlugin : public ARDOUR::Plugin
std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
};
+typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
+
class AUPluginInfo : public PluginInfo {
public:
AUPluginInfo () { };
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index e7500fc7a2..72989abb59 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -119,21 +119,19 @@ class AudioEngine : public sigc::trackable
uint32_t n_physical_outputs () const;
uint32_t n_physical_inputs () const;
- std::string get_nth_physical_output (uint32_t n) {
- return get_nth_physical (n, JackPortIsInput);
+ std::string get_nth_physical_output (DataType type, uint32_t n) {
+ return get_nth_physical (type, n, JackPortIsInput);
}
- std::string get_nth_physical_input (uint32_t n) {
- return get_nth_physical (n, JackPortIsOutput);
+ std::string get_nth_physical_input (DataType type, uint32_t n) {
+ return get_nth_physical (type, n, JackPortIsOutput);
}
jack_nframes_t get_port_total_latency (const Port&);
void update_total_latencies ();
- /* the caller may not delete the object pointed to by
- the return value
+ /** Caller may not delete the object pointed to by the return value
*/
-
Port *get_port_by_name (const std::string& name, bool keep = true);
enum TransportState {
@@ -219,7 +217,7 @@ class AudioEngine : public sigc::trackable
PortConnections port_connections;
void remove_connections_for (Port*);
- std::string get_nth_physical (uint32_t which, int flags);
+ std::string get_nth_physical (DataType type, uint32_t n, int flags);
static int _xrun_callback (void *arg);
static int _graph_order_callback (void *arg);
diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h
index 5a77067f8f..bd76c30289 100644
--- a/libs/ardour/ardour/audioplaylist.h
+++ b/libs/ardour/ardour/audioplaylist.h
@@ -60,7 +60,7 @@ class AudioPlaylist : public ARDOUR::Playlist
void clear (bool with_delete = false, bool with_save = true);
- jack_nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, char * workbuf, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
+ jack_nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&);
UndoAction get_memento() const;
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index 683e946713..fd2cc8d2f1 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2001 Paul Davis
+ Copyright (C) 2000-2006 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
@@ -57,8 +57,6 @@ struct AudioRegionState : public RegionState
class AudioRegion : public Region
{
public:
- typedef vector<AudioSource *> SourceList;
-
static Change FadeInChanged;
static Change FadeOutChanged;
static Change FadeInActiveChanged;
@@ -76,26 +74,18 @@ class AudioRegion : public Region
AudioRegion (SourceList &, const XMLNode&);
~AudioRegion();
- bool source_equivalent (const Region&) const;
-
bool speed_mismatch (float) const;
- void lock_sources ();
- void unlock_sources ();
- AudioSource& source (uint32_t n=0) const { if (n < sources.size()) return *sources[n]; else return *sources[0]; }
+ AudioSource& audio_source (uint32_t n=0) const;
- void set_scale_amplitude (gain_t);
+ void set_scale_amplitude (gain_t);
gain_t scale_amplitude() const { return _scale_amplitude; }
void normalize_to (float target_in_dB = 0.0f);
- uint32_t n_channels() { return sources.size(); }
- vector<string> master_source_names();
-
bool envelope_active () const { return _flags & Region::EnvelopeActive; }
bool fade_in_active () const { return _flags & Region::FadeIn; }
bool fade_out_active () const { return _flags & Region::FadeOut; }
- bool captured() const { return !(_flags & (Region::Flag (Region::Import|Region::External))); }
Curve& fade_in() { return _fade_in; }
Curve& fade_out() { return _fade_out; }
@@ -106,13 +96,12 @@ class AudioRegion : public Region
uint32_t chan_n=0, double samples_per_unit= 1.0) const;
virtual jack_nframes_t read_at (Sample *buf, Sample *mixdown_buf,
- float *gain_buf, char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
+ float *gain_buf, jack_nframes_t position, jack_nframes_t cnt,
uint32_t chan_n = 0,
jack_nframes_t read_frames = 0,
jack_nframes_t skip_frames = 0) const;
- jack_nframes_t master_read_at (Sample *buf, Sample *mixdown_buf,
- float *gain_buf, char * workbuf,
+ jack_nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf,
jack_nframes_t position, jack_nframes_t cnt, uint32_t chan_n=0) const;
XMLNode& state (bool);
@@ -152,8 +141,6 @@ class AudioRegion : public Region
int exportme (ARDOUR::Session&, ARDOUR::AudioExportSpecification&);
- Region* get_parent();
-
/* xfade/fade interactions */
void suspend_fade_in ();
@@ -177,28 +164,17 @@ class AudioRegion : public Region
void recompute_gain_at_start ();
jack_nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
+ float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt,
uint32_t chan_n = 0,
jack_nframes_t read_frames = 0,
jack_nframes_t skip_frames = 0) const;
- bool verify_start (jack_nframes_t position);
- bool verify_length (jack_nframes_t position);
- bool verify_start_mutable (jack_nframes_t& start);
- bool verify_start_and_length (jack_nframes_t start, jack_nframes_t length);
void recompute_at_start ();
void recompute_at_end ();
void envelope_changed (Change);
- void source_deleted (Source*);
-
- SourceList sources;
-
- /** Used when timefx are applied, so we can always use the original source. */
- SourceList master_sources;
-
mutable Curve _fade_in;
FadeShape _fade_in_shape;
mutable Curve _fade_out;
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 35158a24e7..4af857c1d6 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -50,24 +50,11 @@ class AudioSource : public Source
AudioSource (string name);
AudioSource (const XMLNode&);
virtual ~AudioSource ();
-
- /* one could argue that this should belong to Source, but other data types
- generally do not come with a model of "offset along an audio timeline"
- so its here in AudioSource for now.
- */
-
- virtual jack_nframes_t natural_position() const { return 0; }
- /* returns the number of items in this `audio_source' */
-
- virtual jack_nframes_t length() const {
- return _length;
- }
-
virtual jack_nframes_t available_peaks (double zoom) const;
- virtual jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const;
- virtual jack_nframes_t write (Sample *src, jack_nframes_t cnt, char * workbuf);
+ virtual jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const;
+ virtual jack_nframes_t write (Sample *src, jack_nframes_t cnt);
virtual float sample_rate () const = 0;
@@ -111,7 +98,6 @@ class AudioSource : public Source
bool _peaks_built;
mutable Glib::Mutex _lock;
- jack_nframes_t _length;
bool next_peak_clear_should_notify;
string peakpath;
string _captured_for;
@@ -124,13 +110,11 @@ class AudioSource : public Source
int do_build_peak (jack_nframes_t, jack_nframes_t);
- virtual jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const = 0;
- virtual jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt, char * workbuf) = 0;
+ virtual jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const = 0;
+ virtual jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt) = 0;
virtual string peak_path(string audio_path) = 0;
virtual string old_peak_path(string audio_path) = 0;
- void update_length (jack_nframes_t pos, jack_nframes_t cnt);
-
static pthread_t peak_thread;
static bool have_peak_thread;
static void* peak_thread_work(void*);
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h
index 1321f6c107..981d941de7 100644
--- a/libs/ardour/ardour/buffer.h
+++ b/libs/ardour/ardour/buffer.h
@@ -19,19 +19,15 @@
#ifndef __ardour_buffer_h__
#define __ardour_buffer_h__
-#define _XOPEN_SOURCE 600
-#include <cstdlib> // for posix_memalign
+#include <cstdlib>
#include <cassert>
+#include <iostream>
#include <ardour/types.h>
#include <ardour/data_type.h>
namespace ARDOUR {
-/* Yes, this is a bit of a mess right now. I'll clean it up when everything
- * using it works out.. */
-
-
/** A buffer of recordable/playable data.
*
* This is a datatype-agnostic base class for all buffers (there are no
@@ -44,12 +40,11 @@ namespace ARDOUR {
class Buffer
{
public:
- Buffer(DataType type, size_t capacity)
- : _type(type), _capacity(capacity), _size(0)
- {}
-
virtual ~Buffer() {}
+ /** Factory function */
+ static Buffer* create(DataType type, size_t capacity);
+
/** Maximum capacity of buffer.
* Note in some cases the entire buffer may not contain valid data, use size. */
size_t capacity() const { return _capacity; }
@@ -61,10 +56,24 @@ public:
* Based on this you can static cast a Buffer* to the desired type. */
DataType type() const { return _type; }
+ /** Clear (eg zero, or empty) buffer starting at TIME @a offset */
+ virtual void clear(jack_nframes_t offset = 0) = 0;
+
+ virtual void write(const Buffer& src, jack_nframes_t offset, jack_nframes_t len) = 0;
+
protected:
+ Buffer(DataType type, size_t capacity)
+ : _type(type), _capacity(capacity), _size(0)
+ {}
+
DataType _type;
size_t _capacity;
size_t _size;
+
+private:
+ // Prevent copies (undefined)
+ Buffer(const Buffer& copy);
+ void operator=(const Buffer& other);
};
@@ -75,28 +84,51 @@ protected:
class AudioBuffer : public Buffer
{
public:
- AudioBuffer(size_t capacity)
- : Buffer(DataType::AUDIO, capacity)
- , _data(NULL)
+ AudioBuffer(size_t capacity);
+
+ ~AudioBuffer();
+
+ void clear(jack_nframes_t offset=0) { memset(_data + offset, 0, sizeof (Sample) * _capacity); }
+
+ /** Copy @a len frames starting at @a offset, from the start of @a src */
+ void write(const Buffer& src, jack_nframes_t offset, jack_nframes_t len)
+ {
+ assert(src.type() == _type == DataType::AUDIO);
+ assert(offset + len <= _capacity);
+ memcpy(_data + offset, ((AudioBuffer&)src).data(len, offset), sizeof(Sample) * len);
+ }
+
+ /** Copy @a len frames starting at @a offset, from the start of @a src */
+ void write(const Sample* src, jack_nframes_t offset, jack_nframes_t len)
+ {
+ assert(offset + len <= _capacity);
+ memcpy(_data + offset, src, sizeof(Sample) * len);
+ }
+
+ /** Set the data contained by this buffer manually (for setting directly to jack buffer).
+ *
+ * Constructor MUST have been passed capacity=0 or this will die (to prevent mem leaks).
+ */
+ void set_data(Sample* data, size_t size)
{
- _size = capacity; // For audio buffers, size = capacity (always)
-#ifdef NO_POSIX_MEMALIGN
- _data = (Sample *) malloc(sizeof(Sample) * capacity);
-#else
- posix_memalign((void**)_data, 16, sizeof(Sample) * capacity);
-#endif
- assert(_data);
- memset(_data, 0, sizeof(Sample) * capacity);
+ assert(!_owns_data); // prevent leaks
+ _capacity = size;
+ _size = size;
+ _data = data;
}
- const Sample* data() const { return _data; }
- Sample* data() { return _data; }
+ const Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0) const
+ { assert(offset + nframes <= _capacity); return _data + offset; }
+
+ Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0)
+ { assert(offset + nframes <= _capacity); return _data + offset; }
private:
// These are undefined (prevent copies)
AudioBuffer(const AudioBuffer& copy);
AudioBuffer& operator=(const AudioBuffer& copy);
+ bool _owns_data;
Sample* _data; ///< Actual buffer contents
};
@@ -106,19 +138,16 @@ private:
class MidiBuffer : public Buffer
{
public:
- MidiBuffer(size_t capacity)
- : Buffer(DataType::MIDI, capacity)
- , _data(NULL)
- {
- _size = capacity; // For audio buffers, size = capacity (always)
-#ifdef NO_POSIX_MEMALIGN
- _data = (RawMidi *) malloc(sizeof(RawMidi) * capacity);
-#else
- posix_memalign((void**)_data, 16, sizeof(RawMidi) * capacity);
-#endif
- assert(_data);
- memset(_data, 0, sizeof(RawMidi) * capacity);
- }
+ MidiBuffer(size_t capacity);
+
+ ~MidiBuffer();
+
+ // FIXME: clear events starting at offset
+ void clear(jack_nframes_t offset=0) { assert(offset == 0); _size = 0; }
+
+ void write(const Buffer& src, jack_nframes_t offset, jack_nframes_t nframes);
+
+ void set_size(size_t size) { _size = size; }
const RawMidi* data() const { return _data; }
RawMidi* data() { return _data; }
@@ -128,10 +157,10 @@ private:
MidiBuffer(const MidiBuffer& copy);
MidiBuffer& operator=(const MidiBuffer& copy);
+ bool _owns_data;
RawMidi* _data; ///< Actual buffer contents
};
-
} // namespace ARDOUR
#endif // __ardour_buffer_h__
diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h
new file mode 100644
index 0000000000..2ef49793d1
--- /dev/null
+++ b/libs/ardour/ardour/chan_count.h
@@ -0,0 +1,81 @@
+/*
+ Copyright (C) 2006 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id: insert.cc 712 2006-07-28 01:08:57Z drobilla $
+*/
+
+#ifndef __ardour_chan_count_h__
+#define __ardour_chan_count_h__
+
+#include <ardour/data_type.h>
+
+namespace ARDOUR {
+
+
+class ChanCount {
+public:
+ ChanCount() { reset(); }
+
+ // Convenience constructor for making single-typed streams (stereo, mono, etc)
+ ChanCount(DataType type, size_t channels)
+ {
+ reset();
+ set_count(type, channels);
+ }
+
+ void reset()
+ {
+ for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+ _counts[(*t).to_index()] = 0;
+ }
+ }
+
+ void set_count(DataType type, size_t count) { _counts[type.to_index()] = count; }
+ size_t get_count(DataType type) const { return _counts[type.to_index()]; }
+
+ size_t get_total_count() const
+ {
+ size_t ret = 0;
+ for (size_t i=0; i < DataType::num_types; ++i)
+ ret += _counts[i];
+
+ return ret;
+ }
+
+ bool operator==(const ChanCount& other) const
+ {
+ for (size_t i=0; i < DataType::num_types; ++i)
+ if (_counts[i] != other._counts[i])
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const ChanCount& other) const
+ {
+ return ! (*this == other);
+ }
+
+private:
+ size_t _counts[DataType::num_types];
+};
+
+
+} // namespace ARDOUR
+
+#endif // __ardour_chan_count_h__
+
diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h
index ba9f122fc9..cf25c466ee 100644
--- a/libs/ardour/ardour/coreaudiosource.h
+++ b/libs/ardour/ardour/coreaudiosource.h
@@ -38,9 +38,9 @@ class CoreAudioSource : public AudioFileSource {
void set_header_timeline_position () {};
protected:
- jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const;
+ jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const;
- jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt, char * workbuf)
+ jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt)
{ return 0; }
diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h
index ebafa0e8cc..aea7b31852 100644
--- a/libs/ardour/ardour/crossfade.h
+++ b/libs/ardour/ardour/crossfade.h
@@ -92,7 +92,7 @@ class Crossfade : public Stateful, public StateManager
ARDOUR::AudioRegion& out() const { return *_out; }
jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
+ float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt,
uint32_t chan_n,
jack_nframes_t read_frames = 0,
jack_nframes_t skip_frames = 0);
diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h
index d49ed108cd..cbb88afccf 100644
--- a/libs/ardour/ardour/data_type.h
+++ b/libs/ardour/ardour/data_type.h
@@ -19,54 +19,112 @@
#ifndef __ardour_data_type_h__
#define __ardour_data_type_h__
+#include <string>
+#include <ardour/data_type.h>
#include <jack/jack.h>
namespace ARDOUR {
+
+/** A type of Data Ardour is capable of processing.
+ *
+ * The majority of this class is dedicated to conversion to and from various
+ * other type representations, simple comparison between then, etc. This code
+ * is deliberately 'ugly' so other code doesn't have to be.
+ */
class DataType
{
public:
+ /// WARNING: make REALLY sure you don't mess up indexes if you change this
enum Symbol {
NIL = 0,
AUDIO,
MIDI
};
+
+ /** Number of types (not including NIL).
+ * WARNING: make sure this matches Symbol!
+ */
+ static const size_t num_types = 2;
+
+
+ /** Helper for collections that store typed things by index (BufferSet, PortList).
+ * Guaranteed to be a valid index from 0 to (the number of available types - 1),
+ * because NIL is not included. No, this isn't pretty - purely for speed.
+ * See DataType::to_index().
+ */
+ inline static size_t symbol_index(const Symbol symbol)
+ { return (size_t)symbol - 1; }
DataType(const Symbol& symbol)
: _symbol(symbol)
{}
- /** Construct from a string (Used for loading from XML) */
- DataType(const string& str) {
+ /** Construct from a string (Used for loading from XML and Ports)
+ * The string can be as in an XML file (eg "audio" or "midi"), or a
+ * Jack type string (from jack_port_type) */
+ DataType(const std::string& str) {
if (str == "audio")
_symbol = AUDIO;
- //else if (str == "midi")
- // _symbol = MIDI;
+ else if (str == JACK_DEFAULT_AUDIO_TYPE)
+ _symbol = AUDIO;
+ else if (str == "midi")
+ _symbol = MIDI;
+ else if (str == JACK_DEFAULT_MIDI_TYPE)
+ _symbol = MIDI;
else
_symbol = NIL;
}
- bool operator==(const Symbol symbol) { return _symbol == symbol; }
- bool operator!=(const Symbol symbol) { return _symbol != symbol; }
-
/** Get the Jack type this DataType corresponds to */
- const char* to_jack_type() {
+ const char* to_jack_type() const {
switch (_symbol) {
case AUDIO: return JACK_DEFAULT_AUDIO_TYPE;
- //case MIDI: return JACK_DEFAULT_MIDI_TYPE;
+ case MIDI: return JACK_DEFAULT_MIDI_TYPE;
default: return "";
}
}
/** Inverse of the from-string constructor */
- const char* to_string() {
+ const char* to_string() const {
switch (_symbol) {
case AUDIO: return "audio";
- //case MIDI: return "midi";
+ case MIDI: return "midi";
default: return "unknown"; // reeeally shouldn't ever happen
}
}
+ Symbol to_symbol() const { return _symbol; }
+ inline size_t to_index() const { return symbol_index(_symbol); }
+
+ /** DataType iterator, for writing generic loops that iterate over all
+ * available types.
+ */
+ class iterator {
+ public:
+
+ iterator(size_t index) : _index(index) {}
+
+ DataType operator*() { return DataType((Symbol)_index); }
+ iterator& operator++() { ++_index; return *this; } // yes, prefix only
+ bool operator==(const iterator& other) { return (_index == other._index); }
+ bool operator!=(const iterator& other) { return (_index != other._index); }
+
+ private:
+ friend class DataType;
+
+ size_t _index;
+ };
+
+ static iterator begin() { return iterator(1); }
+ static iterator end() { return iterator(num_types+1); }
+
+ bool operator==(const Symbol symbol) { return (_symbol == symbol); }
+ bool operator!=(const Symbol symbol) { return (_symbol != symbol); }
+
+ bool operator==(const DataType other) { return (_symbol == other._symbol); }
+ bool operator!=(const DataType other) { return (_symbol != other._symbol); }
+
private:
Symbol _symbol;
};
diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h
index 5b773898c3..fb2a3be47b 100644
--- a/libs/ardour/ardour/destructive_filesource.h
+++ b/libs/ardour/ardour/destructive_filesource.h
@@ -49,7 +49,7 @@ class DestructiveFileSource : public SndFileSource {
static void setup_standard_crossfades (jack_nframes_t sample_rate);
protected:
- jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt, char * workbuf);
+ jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt);
virtual void handle_header_position_change ();
@@ -65,7 +65,7 @@ class DestructiveFileSource : public SndFileSource {
Sample* xfade_buf;
void init ();
- jack_nframes_t crossfade (Sample* data, jack_nframes_t cnt, int dir, char * workbuf);
+ jack_nframes_t crossfade (Sample* data, jack_nframes_t cnt, int dir);
void set_timeline_position (jack_nframes_t);
};
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index ebce516d8b..08dea4fb27 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -69,9 +69,9 @@ class Diskstream : public Stateful, public sigc::trackable
ARDOUR::IO* io() const { return _io; }
void set_io (ARDOUR::IO& io);
- virtual Diskstream& ref() { _refcnt++; return *this; }
- void unref() { if (_refcnt) _refcnt--; if (_refcnt == 0) delete this; }
- uint32_t refcnt() const { return _refcnt; }
+ Diskstream& ref() { _refcnt++; return *this; }
+ void unref() { if (_refcnt) _refcnt--; if (_refcnt == 0) delete this; }
+ uint32_t refcnt() const { return _refcnt; }
virtual float playback_buffer_load() const = 0;
virtual float capture_buffer_load() const = 0;
@@ -117,8 +117,8 @@ class Diskstream : public Stateful, public sigc::trackable
uint32_t n_channels() { return _n_channels; }
- static jack_nframes_t disk_io_frames() { return disk_io_chunk_frames; }
- static void set_disk_io_chunk_frames (uint32_t n) { disk_io_chunk_frames = n; }
+ static jack_nframes_t disk_io_frames() { return disk_io_chunk_frames; }
+ static void set_disk_io_chunk_frames (uint32_t n) { disk_io_chunk_frames = n; }
/* Stateful */
virtual XMLNode& get_state(void) = 0;
diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h
index a4c4439942..c81d4e5761 100644
--- a/libs/ardour/ardour/insert.h
+++ b/libs/ardour/ardour/insert.h
@@ -29,6 +29,7 @@
#include <ardour/ardour.h>
#include <ardour/redirect.h>
#include <ardour/plugin_state.h>
+#include <ardour/types.h>
class XMLNode;
@@ -39,8 +40,8 @@ namespace MIDI {
namespace ARDOUR {
class Session;
-class Plugin;
class Route;
+class Plugin;
class Insert : public Redirect
{
@@ -149,6 +150,8 @@ class PluginInsert : public Insert
}
}
+ PluginType type ();
+
string describe_parameter (uint32_t);
jack_nframes_t latency();
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index b116a58b97..818916f185 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -40,6 +40,7 @@
#include <ardour/curve.h>
#include <ardour/types.h>
#include <ardour/data_type.h>
+#include <ardour/port_set.h>
using std::string;
using std::vector;
@@ -50,9 +51,11 @@ namespace ARDOUR {
class Session;
class AudioEngine;
-class Port;
class Connection;
class Panner;
+class Port;
+class AudioPort;
+class MidiPort;
/** A collection of input and output ports with connections.
*
@@ -139,23 +142,28 @@ class IO : public Stateful, public ARDOUR::StateManager
void set_port_latency (jack_nframes_t);
Port *output (uint32_t n) const {
- if (n < _noutputs) {
- return _outputs[n];
+ if (n < _outputs.num_ports()) {
+ return _outputs.port(n);
} else {
return 0;
}
}
Port *input (uint32_t n) const {
- if (n < _ninputs) {
- return _inputs[n];
+ if (n < _inputs.num_ports()) {
+ return _inputs.port(n);
} else {
return 0;
}
}
- uint32_t n_inputs () const { return _ninputs; }
- uint32_t n_outputs () const { return _noutputs; }
+ AudioPort* audio_input(uint32_t n) const;
+ AudioPort* audio_output(uint32_t n) const;
+ MidiPort* midi_input(uint32_t n) const;
+ MidiPort* midi_output(uint32_t n) const;
+
+ uint32_t n_inputs () const { return _inputs.num_ports(); }
+ uint32_t n_outputs () const { return _outputs.num_ports(); }
sigc::signal<void,IOChange,void*> input_changed;
sigc::signal<void,IOChange,void*> output_changed;
@@ -195,7 +203,7 @@ class IO : public Stateful, public ARDOUR::StateManager
/* Peak metering */
float peak_input_power (uint32_t n) {
- if (n < std::max (_ninputs, _noutputs)) {
+ if (n < std::max (n_inputs(), n_outputs())) {
return _visible_peak_power[n];
} else {
return minus_infinity();
@@ -269,30 +277,30 @@ public:
mutable Glib::Mutex io_lock;
protected:
- Session& _session;
- Panner* _panner;
- gain_t _gain;
- gain_t _effective_gain;
- gain_t _desired_gain;
- Glib::Mutex declick_lock;
- vector<Port*> _outputs;
- vector<Port*> _inputs;
- vector<float> _peak_power;
- vector<float> _visible_peak_power;
- string _name;
- Connection* _input_connection;
- Connection* _output_connection;
- PBD::ID _id;
- bool no_panner_reset;
- XMLNode* deferred_state;
- DataType _default_type;
+ Session& _session;
+ Panner* _panner;
+ gain_t _gain;
+ gain_t _effective_gain;
+ gain_t _desired_gain;
+ Glib::Mutex declick_lock;
+ PortSet _outputs;
+ PortSet _inputs;
+ vector<float> _peak_power;
+ vector<float> _visible_peak_power;
+ string _name;
+ Connection* _input_connection;
+ Connection* _output_connection;
+ PBD::ID _id;
+ bool no_panner_reset;
+ XMLNode* deferred_state;
+ DataType _default_type;
virtual void set_deferred_state() {}
void reset_peak_meters();
void reset_panner ();
- virtual uint32_t pans_required() const { return _ninputs; }
+ virtual uint32_t pans_required() const { return n_inputs(); }
static void apply_declick (vector<Sample*>&, uint32_t nbufs, jack_nframes_t nframes,
gain_t initial, gain_t target, bool invert_polarity);
@@ -339,8 +347,6 @@ public:
private:
- uint32_t _ninputs;
- uint32_t _noutputs;
/* are these the best variable names ever, or what? */
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index 7877bfaf1c..a048cf4021 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -24,6 +24,7 @@
#include <sigc++/signal.h>
#include <cmath>
+#include <cassert>
#include <string>
#include <queue>
#include <map>
@@ -61,27 +62,20 @@ class MidiDiskstream : public Diskstream
MidiDiskstream (Session &, const string& name, Diskstream::Flag f = Recordable);
MidiDiskstream (Session &, const XMLNode&);
- void set_io (ARDOUR::IO& io);
-
- MidiDiskstream& ref() { _refcnt++; return *this; }
- //void unref() { if (_refcnt) _refcnt--; if (_refcnt == 0) delete this; }
- //uint32_t refcnt() const { return _refcnt; }
-
float playback_buffer_load() const;
float capture_buffer_load() const;
-
- //void set_align_style (AlignStyle);
- //void set_persistent_align_style (AlignStyle);
+
+ RawMidi* playback_buffer () { return _current_playback_buffer; }
+ RawMidi* capture_buffer () { return _current_capture_buffer; }
void set_record_enabled (bool yn);
- //void set_speed (double);
+
+ MidiPlaylist* midi_playlist () { return dynamic_cast<MidiPlaylist*>(_playlist); }
int use_playlist (Playlist *);
int use_new_playlist ();
int use_copy_playlist ();
- Playlist *playlist () { return _playlist; }
-
/* stateful */
XMLNode& get_state(void);
@@ -89,8 +83,6 @@ class MidiDiskstream : public Diskstream
void monitor_input (bool);
- //void handle_input_change (IOChange, void *src);
-
protected:
friend class Session;
@@ -108,12 +100,8 @@ class MidiDiskstream : public Diskstream
void reset_write_sources (bool, bool force = false);
void non_realtime_input_change ();
- uint32_t read_data_count() const { return _read_data_count; }
- uint32_t write_data_count() const { return _write_data_count; }
-
protected:
- friend class Auditioner;
- int seek (jack_nframes_t which_sample, bool complete_refill = false);
+ int seek (jack_nframes_t which_sample, bool complete_refill = false);
protected:
friend class MidiTrack;
@@ -126,30 +114,17 @@ class MidiDiskstream : public Diskstream
/* use unref() to destroy a diskstream */
~MidiDiskstream();
- MidiPlaylist* _playlist;
-
- /*Tthe two central butler operations */
- int do_flush (Session::RunContext context, bool force = false) { return 0; }
- int do_refill () { return 0; }
+ /* The two central butler operations */
+ int do_flush (Session::RunContext context, bool force = false);
+ int do_refill ();
- int do_refill_with_alloc() { return 0; }
-
- int read (RawMidi* buf, RawMidi* mixdown_buffer, char * workbuf, jack_nframes_t& start, jack_nframes_t cnt, bool reversed);
-
- /* XXX fix this redundancy ... */
+ int do_refill_with_alloc();
- //void playlist_changed (Change);
- //void playlist_modified ();
- void playlist_deleted (Playlist*);
+ int read (RawMidi* buf, jack_nframes_t& start, jack_nframes_t cnt, bool reversed);
void finish_capture (bool rec_monitors_input);
void transport_stopped (struct tm&, time_t, bool abort);
- struct CaptureInfo {
- uint32_t start;
- uint32_t frames;
- };
-
void init (Diskstream::Flag);
int use_new_write_source (uint32_t n=0);
@@ -158,9 +133,6 @@ class MidiDiskstream : public Diskstream
void allocate_temporary_buffers ();
- //bool realtime_set_speed (double, bool global_change);
- void non_realtime_set_speed ();
-
int use_pending_capture_data (XMLNode& node);
void get_input_sources ();
@@ -169,8 +141,21 @@ class MidiDiskstream : public Diskstream
void setup_destructive_playlist ();
void use_destructive_playlist ();
- std::list<Region*> _last_capture_regions;
- std::vector<SMFSource*> _capturing_sources;
+ void engage_record_enable ();
+ void disengage_record_enable ();
+
+ // FIXME: This is basically a single ChannelInfo.. abstractify that concept?
+ RingBufferNPT<RawMidi>* _playback_buf;
+ RingBufferNPT<RawMidi>* _capture_buf;
+ RawMidi* _current_playback_buffer;
+ RawMidi* _current_capture_buffer;
+ RawMidi* _playback_wrap_buffer;
+ RawMidi* _capture_wrap_buffer;
+ MidiPort* _source_port;
+ SMFSource* _write_source; ///< aka capturing source
+ RingBufferNPT<CaptureTransition>* _capture_transition_buf;
+ RingBufferNPT<RawMidi>::rw_vector _playback_vector;
+ RingBufferNPT<RawMidi>::rw_vector _capture_vector;
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h
index da3a72a3fd..51cb00822e 100644
--- a/libs/ardour/ardour/midi_playlist.h
+++ b/libs/ardour/ardour/midi_playlist.h
@@ -55,8 +55,8 @@ public:
MidiPlaylist (const MidiPlaylist&, jack_nframes_t start, jack_nframes_t cnt,
string name, bool hidden = false);
- jack_nframes_t read (unsigned char *dst, unsigned char *mixdown,
- char * workbuf, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
+ jack_nframes_t read (RawMidi *dst, RawMidi *mixdown,
+ jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&);
UndoAction get_memento() const;
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
new file mode 100644
index 0000000000..9b1092f300
--- /dev/null
+++ b/libs/ardour/ardour/midi_port.h
@@ -0,0 +1,72 @@
+/*
+ Copyright (C) 2002 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
+*/
+
+#ifndef __ardour_midi_port_h__
+#define __ardour_midi_port_h__
+
+#include <sigc++/signal.h>
+#include <pbd/failed_constructor.h>
+#include <ardour/ardour.h>
+#include <jack/jack.h>
+#include <jack/midiport.h>
+#include <ardour/port.h>
+#include <ardour/buffer.h>
+
+namespace ARDOUR {
+
+class MidiEngine;
+
+class MidiPort : public Port {
+ public:
+ virtual ~MidiPort();
+
+ DataType type() const { return DataType(DataType::MIDI); }
+
+ MidiBuffer& get_buffer() {
+ assert(_nframes_this_cycle > 0);
+ return *_buffer;
+ }
+
+ void cycle_start(jack_nframes_t nframes);
+ void cycle_end();
+
+ size_t capacity() { return _buffer->capacity(); }
+ size_t size() { return _buffer->size(); }
+
+ /** Assumes that the port is an output port */
+ void silence (jack_nframes_t nframes, jack_nframes_t offset) {
+ // FIXME: silence starting at offset..
+ _buffer->clear();
+ }
+
+ protected:
+ friend class AudioEngine;
+
+ MidiPort (jack_port_t *port);
+
+ /* engine isn't supposed to access below here */
+
+ MidiBuffer* _buffer;
+ jack_nframes_t _nframes_this_cycle;
+};
+
+} // namespace ARDOUR
+
+#endif /* __ardour_midi_port_h__ */
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h
index ec47a91b95..f68c0ba3ca 100644
--- a/libs/ardour/ardour/midi_region.h
+++ b/libs/ardour/ardour/midi_region.h
@@ -1,6 +1,5 @@
/*
- Copyright (C) 2006 Paul Davis
- Written by Dave Robillard, 2006
+ Copyright (C) 2000-2006 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
@@ -15,6 +14,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id: midiregion.h 733 2006-08-01 17:19:38Z drobilla $
*/
#ifndef __ardour_midi_region_h__
@@ -27,6 +28,8 @@
#include <ardour/ardour.h>
#include <ardour/region.h>
+#include <ardour/gain.h>
+#include <ardour/logcurve.h>
#include <ardour/export.h>
class XMLNode;
@@ -39,17 +42,9 @@ class Session;
class MidiFilter;
class MidiSource;
-struct MidiRegionState : public RegionState
-{
- MidiRegionState (std::string why);
-
-};
-
class MidiRegion : public Region
{
public:
- typedef vector<MidiSource *> SourceList;
-
MidiRegion (MidiSource&, jack_nframes_t start, jack_nframes_t length, bool announce = true);
MidiRegion (MidiSource&, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true);
MidiRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true);
@@ -59,83 +54,43 @@ class MidiRegion : public Region
MidiRegion (SourceList &, const XMLNode&);
~MidiRegion();
- bool source_equivalent (const Region&) const;
-
- bool speed_mismatch (float) const;
-
- void lock_sources ();
- void unlock_sources ();
- MidiSource& source (uint32_t n=0) const { if (n < sources.size()) return *sources[n]; else return *sources[0]; }
-
- uint32_t n_channels() { return sources.size(); }
- vector<string> master_source_names();
-
- bool captured() const { return !(_flags & (Region::Flag (Region::Import|Region::External))); }
-
- virtual jack_nframes_t read_at (unsigned char *buf, unsigned char *mixdown_buffer,
- char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
- uint32_t chan_n = 0,
- jack_nframes_t read_frames = 0,
- jack_nframes_t skip_frames = 0) const;
+ MidiSource& midi_source (uint32_t n=0) const;
- jack_nframes_t master_read_at (unsigned char *buf, unsigned char *mixdown_buffer,
- char * workbuf, jack_nframes_t position, jack_nframes_t cnt, uint32_t chan_n=0) const;
+ jack_nframes_t read_at (RawMidi* out, RawMidi* mix,
+ jack_nframes_t position,
+ jack_nframes_t cnt,
+ uint32_t chan_n = 0,
+ jack_nframes_t read_frames = 0,
+ jack_nframes_t skip_frames = 0) const;
+ jack_nframes_t master_read_at (RawMidi* buf, RawMidi* mix,
+ jack_nframes_t position,
+ jack_nframes_t cnt,
+ uint32_t chan_n=0) const;
XMLNode& state (bool);
- XMLNode& get_state ();
int set_state (const XMLNode&);
- enum FadeShape {
- Linear,
- Fast,
- Slow,
- LogA,
- LogB,
-
- };
-
int separate_by_channel (ARDOUR::Session&, vector<MidiRegion*>&) const;
- uint32_t read_data_count() const { return _read_data_count; }
-
- ARDOUR::Playlist* playlist() const { return _playlist; }
-
UndoAction get_memento() const;
- /* export */
-
- //int exportme (ARDOUR::Session&, ARDOUR::AudioExportSpecification&);
-
- Region* get_parent();
-
private:
friend class Playlist;
private:
- SourceList sources;
- SourceList master_sources; /* used when timefx are applied, so
- we can always use the original
- source.
- */
StateManager::State* state_factory (std::string why) const;
Change restore_state (StateManager::State&);
- jack_nframes_t _read_at (const SourceList&, unsigned char *buf, unsigned char *mixdown_buffer,
- char * workbuf, jack_nframes_t position, jack_nframes_t cnt,
- uint32_t chan_n = 0,
- jack_nframes_t read_frames = 0,
- jack_nframes_t skip_frames = 0) const;
-
- bool verify_start (jack_nframes_t position);
- bool verify_length (jack_nframes_t position);
- bool verify_start_mutable (jack_nframes_t& start);
- bool verify_start_and_length (jack_nframes_t start, jack_nframes_t length);
-
- void recompute_at_start() {}
- void recompute_at_end() {}
+ jack_nframes_t _read_at (const SourceList&, RawMidi *buf,
+ jack_nframes_t position,
+ jack_nframes_t cnt,
+ uint32_t chan_n = 0,
+ jack_nframes_t read_frames = 0,
+ jack_nframes_t skip_frames = 0) const;
- void source_deleted (Source*);
+ void recompute_at_start ();
+ void recompute_at_end ();
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h
index 8e4da44082..1c00289003 100644
--- a/libs/ardour/ardour/midi_source.h
+++ b/libs/ardour/ardour/midi_source.h
@@ -45,23 +45,16 @@ class MidiSource : public Source
MidiSource (const XMLNode&);
virtual ~MidiSource ();
- /* returns the number of items in this `midi_source' */
-
- // Applicable to MIDI? With what unit? [DR]
- virtual jack_nframes_t length() const {
- return _length;
- }
-
- virtual jack_nframes_t read (unsigned char *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const;
- virtual jack_nframes_t write (unsigned char *src, jack_nframes_t cnt, char * workbuf);
+ virtual jack_nframes_t read (RawMidi *dst, jack_nframes_t start, jack_nframes_t cnt) const;
+ virtual jack_nframes_t write (RawMidi *src, jack_nframes_t cnt);
virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () {}
- void set_captured_for (string str) { _captured_for = str; }
string captured_for() const { return _captured_for; }
+ void set_captured_for (string str) { _captured_for = str; }
- uint32_t read_data_count() const { return _read_data_count; }
+ uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
static sigc::signal<void,MidiSource*> MidiSourceCreated;
@@ -73,16 +66,13 @@ class MidiSource : public Source
int set_state (const XMLNode&);
protected:
- jack_nframes_t _length;
- string _captured_for;
-
- mutable uint32_t _read_data_count; // modified in read()
- mutable uint32_t _write_data_count; // modified in write()
-
- virtual jack_nframes_t read_unlocked (unsigned char *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const = 0;
- virtual jack_nframes_t write_unlocked (unsigned char *dst, jack_nframes_t cnt, char * workbuf) = 0;
+ virtual jack_nframes_t read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cn) const = 0;
+ virtual jack_nframes_t write_unlocked (RawMidi* dst, jack_nframes_t cnt) = 0;
- void update_length (jack_nframes_t pos, jack_nframes_t cnt);
+ mutable Glib::Mutex _lock;
+ string _captured_for;
+ mutable uint32_t _read_data_count; ///< modified in read()
+ mutable uint32_t _write_data_count; ///< modified in write()
private:
bool file_changed (string path);
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 185e840ec9..4b942c7a21 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -48,6 +48,11 @@ public:
int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
jack_nframes_t offset, bool can_record, bool rec_monitors_input);
+ void process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
+ jack_nframes_t start_frame, jack_nframes_t end_frame,
+ jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
+ bool meter);
+
void set_record_enable (bool yn, void *src);
MidiDiskstream& midi_diskstream() const;
@@ -59,7 +64,7 @@ public:
void set_latency_delay (jack_nframes_t);
- int export_stuff (vector<unsigned char*>& buffers, char * workbuf, uint32_t nbufs,
+ int export_stuff (vector<unsigned char*>& buffers, uint32_t nbufs,
jack_nframes_t nframes, jack_nframes_t end_frame);
void freeze (InterThreadInfo&);
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index 6b11a975ca..e5a81f1ef9 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -47,27 +47,22 @@ class AudioEngine;
class Session;
class Plugin;
+
typedef boost::shared_ptr<Plugin> PluginPtr;
class PluginInfo {
public:
- enum Type {
- AudioUnit,
- LADSPA,
- VST
- };
-
PluginInfo () { }
PluginInfo (const PluginInfo &o)
: name(o.name), n_inputs(o.n_inputs), n_outputs(o.n_outputs),
unique_id(o.unique_id), path (o.path), index(o.index) {}
virtual ~PluginInfo () { }
-
+
string name;
string category;
uint32_t n_inputs;
uint32_t n_outputs;
- Type type;
+ ARDOUR::PluginType type;
long unique_id;
@@ -187,7 +182,7 @@ class Plugin : public Stateful, public sigc::trackable
vector<PortControllable*> controls;
};
-PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, PluginInfo::Type);
+PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, ARDOUR::PluginType);
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 86c99cb7e3..cf36f95b87 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -24,34 +24,32 @@
#include <sigc++/signal.h>
#include <pbd/failed_constructor.h>
#include <ardour/ardour.h>
+#include <ardour/data_type.h>
#include <jack/jack.h>
namespace ARDOUR {
class AudioEngine;
+class Buffer;
+/** Abstract base for all outside ports (eg Jack ports)
+ */
class Port : public sigc::trackable {
public:
virtual ~Port() {
free (_port);
}
- Sample *get_buffer (jack_nframes_t nframes) {
- if (_flags & JackPortIsOutput) {
- return _buffer;
- } else {
- return (Sample *) jack_port_get_buffer (_port, nframes);
- }
- }
+ virtual DataType type() const = 0;
+
+ virtual void cycle_start(jack_nframes_t nframes) {}
+ virtual void cycle_end() {}
+
+ virtual Buffer& get_buffer() = 0;
+
+ /** Silence/Empty the port, output ports only */
+ virtual void silence (jack_nframes_t nframes, jack_nframes_t offset) = 0;
- void reset_buffer () {
- if (_flags & JackPortIsOutput) {
- _buffer = (Sample *) jack_port_get_buffer (_port, 0);
- } else {
- _buffer = 0; /* catch illegal attempts to use it */
- }
- _silent = false;
- }
std::string name() {
return _name;
@@ -71,10 +69,6 @@ class Port : public sigc::trackable {
return jack_port_is_mine (client, _port);
}
- const char* type() const {
- return _type.c_str();
- }
-
int connected () const {
return jack_port_connected (_port);
}
@@ -87,38 +81,6 @@ class Port : public sigc::trackable {
return jack_port_get_connections (_port);
}
- void reset_overs () {
- _short_overs = 0;
- _long_overs = 0;
- _overlen = 0;
- }
-
- void reset_peak_meter () {
- _peak = 0;
- }
-
- void reset_meters () {
- reset_peak_meter ();
- reset_overs ();
- }
-
- void enable_metering() {
- _metering++;
- }
-
- void disable_metering () {
- if (_metering) { _metering--; }
- }
-
- 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);
-
bool receives_input() const {
return _flags & JackPortIsInput;
}
@@ -134,6 +96,14 @@ class Port : public sigc::trackable {
bool can_monitor () const {
return _flags & JackPortCanMonitor;
}
+
+ void enable_metering() {
+ _metering++;
+ }
+
+ void disable_metering () {
+ if (_metering) { _metering--; }
+ }
void ensure_monitor_input (bool yn) {
jack_port_request_monitor (_port, yn);
@@ -151,60 +121,35 @@ class Port : public sigc::trackable {
jack_port_set_latency (_port, nframes);
}
- sigc::signal<void,bool> MonitorInputChanged;
- sigc::signal<void,bool> ClockSyncChanged;
-
bool is_silent() const { return _silent; }
- /** Assumes that the port is an audio output port */
- void silence (jack_nframes_t nframes, jack_nframes_t offset) {
- if (!_silent) {
- memset (_buffer + offset, 0, sizeof (Sample) * nframes);
- if (offset == 0) {
- /* XXX this isn't really true, but i am not sure
- how to set this correctly. we really just
- want to set it true when the entire port
- buffer has been overrwritten.
- */
- _silent = true;
- }
- }
- }
-
void mark_silence (bool yn) {
_silent = yn;
}
+
+ sigc::signal<void,bool> MonitorInputChanged;
+ sigc::signal<void,bool> ClockSyncChanged;
- private:
+ protected:
friend class AudioEngine;
Port (jack_port_t *port);
- void reset ();
- /* engine isn't supposed to below here */
-
- Sample *_buffer;
-
- /* cache these 3 from JACK so that we can
- access them for reconnecting.
- */
+ virtual void reset ();
+
+ /* engine isn't supposed to access below here */
+ /* cache these 3 from JACK so we can access them for reconnecting */
JackPortFlags _flags;
std::string _type;
std::string _name;
- bool _last_monitor : 1;
- bool _silent : 1;
- jack_port_t *_port;
- jack_nframes_t _overlen;
- jack_default_audio_sample_t _peak;
- float _peak_db;
- uint32_t _short_overs;
- uint32_t _long_overs;
- unsigned short _metering;
-
- static jack_nframes_t _long_over_length;
- static jack_nframes_t _short_over_length;
+ jack_port_t* _port;
+
+ unsigned short _metering;
+
+ bool _last_monitor : 1;
+ bool _silent : 1;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/port_set.h b/libs/ardour/ardour/port_set.h
new file mode 100644
index 0000000000..f8975325a0
--- /dev/null
+++ b/libs/ardour/ardour/port_set.h
@@ -0,0 +1,151 @@
+/*
+ Copyright (C) 2006 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 the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __ardour_port_set_h__
+#define __ardour_port_set_h__
+
+#include <vector>
+#include <ardour/port.h>
+#include <ardour/audio_port.h>
+#include <ardour/midi_port.h>
+#include <ardour/chan_count.h>
+
+namespace ARDOUR {
+
+
+/** An ordered list of Ports, possibly of various types.
+ *
+ * This allows access to all the ports as a list, ignoring type, or accessing
+ * the nth port of a given type. Note that port(n) and nth_audio_port(n) may
+ * NOT return the same port.
+ */
+class PortSet {
+public:
+ PortSet();
+
+ size_t num_ports() const;
+ size_t num_ports(DataType type) const { return _ports[type.to_index()].size(); }
+
+ void add_port(Port* port);
+
+ Port* port(size_t index) const;
+
+ Port* nth_port_of_type(DataType type, size_t n) const;
+
+ AudioPort* nth_audio_port(size_t n) const;
+
+ MidiPort* nth_midi_port(size_t n) const;
+
+ bool contains(const Port* port) const;
+
+ /** Remove all ports from the PortSet. Ports are not deregistered with
+ * the engine, it's the caller's responsibility to not leak here!
+ */
+ void clear() { _ports.clear(); }
+
+ const ChanCount& chan_count() const { return _chan_count; }
+
+ bool empty() const { return (_chan_count.get_total_count() == 0); }
+
+ // ITERATORS
+
+ // obviously these iterators will need to get more clever
+ // experimental phase, it's the interface that counts right now
+
+ class iterator {
+ public:
+
+ Port* operator*() { return _list.port(_index); }
+ iterator& operator++() { ++_index; return *this; } // yes, prefix only
+ bool operator==(const iterator& other) { return (_index == other._index); }
+ bool operator!=(const iterator& other) { return (_index != other._index); }
+
+ private:
+ friend class PortSet;
+
+ iterator(PortSet& list, size_t index) : _list(list), _index(index) {}
+
+ PortSet& _list;
+ size_t _index;
+ };
+
+ iterator begin() { return iterator(*this, 0); }
+ iterator end() { return iterator(*this, _chan_count.get_total_count()); }
+
+ class const_iterator {
+ public:
+
+ const Port* operator*() { return _list.port(_index); }
+ const_iterator& operator++() { ++_index; return *this; } // yes, prefix only
+ bool operator==(const const_iterator& other) { return (_index == other._index); }
+ bool operator!=(const const_iterator& other) { return (_index != other._index); }
+
+ private:
+ friend class PortSet;
+
+ const_iterator(const PortSet& list, size_t index) : _list(list), _index(index) {}
+
+ const PortSet& _list;
+ size_t _index;
+ };
+
+ const_iterator begin() const { return const_iterator(*this, 0); }
+ const_iterator end() const { return const_iterator(*this, _chan_count.get_total_count()); }
+
+
+
+ class audio_iterator {
+ public:
+
+ AudioPort* operator*() { return _list.nth_audio_port(_index); }
+ audio_iterator& operator++() { ++_index; return *this; } // yes, prefix only
+ bool operator==(const audio_iterator& other) { return (_index == other._index); }
+ bool operator!=(const audio_iterator& other) { return (_index != other._index); }
+
+ private:
+ friend class PortSet;
+
+ audio_iterator(PortSet& list, size_t index) : _list(list), _index(index) {}
+
+ PortSet& _list;
+ size_t _index;
+ };
+
+ audio_iterator audio_begin() { return audio_iterator(*this, 0); }
+ audio_iterator audio_end() { return audio_iterator(*this, _chan_count.get_count(DataType::AUDIO)); }
+
+
+
+
+private:
+ // Prevent copies (undefined)
+ PortSet(const PortSet& copy);
+ void operator=(const PortSet& other);
+
+ typedef std::vector<Port*> PortVec;
+
+ // Vector of vectors, indexed by DataType::to_index()
+ std::vector<PortVec> _ports;
+
+ ChanCount _chan_count;
+};
+
+
+} // namespace ARDOUR
+
+#endif // __ardour_port_set_h__
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 3773a3b893..c0ff8be607 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -21,6 +21,8 @@
#ifndef __ardour_region_h__
#define __ardour_region_h__
+#include <vector>
+
#include <pbd/undo.h>
#include <ardour/ardour.h>
@@ -56,6 +58,8 @@ struct RegionState : public StateManager::State
class Region : public Stateful, public StateManager
{
public:
+ typedef std::vector<Source *> SourceList;
+
enum Flag {
Muted = 0x1,
Opaque = 0x2,
@@ -89,11 +93,15 @@ class Region : public Stateful, public StateManager
static Change LayerChanged;
static Change HiddenChanged;
- Region (jack_nframes_t start, jack_nframes_t length,
+ Region (Source& src, jack_nframes_t start, jack_nframes_t length,
+ const string& name, layer_t = 0, Flag flags = DefaultFlags);
+ Region (SourceList& srcs, jack_nframes_t start, jack_nframes_t length,
+ const string& name, layer_t = 0, Flag flags = DefaultFlags);
+ Region (const Region&, jack_nframes_t start, jack_nframes_t length,
const string& name, layer_t = 0, Flag flags = DefaultFlags);
- Region (const Region&, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags);
Region (const Region&);
- Region (const XMLNode&);
+ Region (SourceList& srcs, const XMLNode&);
+ Region (Source& src, const XMLNode&);
virtual ~Region();
const PBD::ID& id() const { return _id; }
@@ -118,13 +126,14 @@ class Region : public Stateful, public StateManager
jack_nframes_t first_frame() const { return _position; }
jack_nframes_t last_frame() const { return _position + _length - 1; }
+ Flag flags() const { return _flags; }
bool hidden() const { return _flags & Hidden; }
bool muted() const { return _flags & Muted; }
bool opaque () const { return _flags & Opaque; }
bool locked() const { return _flags & Locked; }
bool automatic() const { return _flags & Automatic; }
bool whole_file() const { return _flags & WholeFile ; }
- Flag flags() const { return _flags; }
+ bool captured() const { return !(_flags & (Region::Flag (Region::Import|Region::External))); }
virtual bool should_save_state () const { return !(_flags & DoNotSaveState); };
@@ -143,10 +152,8 @@ class Region : public Stateful, public StateManager
bool size_equivalent (const Region&) const;
bool overlap_equivalent (const Region&) const;
bool region_list_equivalent (const Region&) const;
- virtual bool source_equivalent (const Region&) const = 0;
+ bool source_equivalent (const Region&) const;
- virtual bool speed_mismatch (float) const = 0;
-
/* EDITING OPERATIONS */
void set_length (jack_nframes_t, void *src);
@@ -184,8 +191,15 @@ class Region : public Stateful, public StateManager
void set_playlist (ARDOUR::Playlist*);
- virtual void lock_sources () {}
- virtual void unlock_sources () {}
+ void lock_sources ();
+ void unlock_sources ();
+ void source_deleted (Source*);
+
+ Source& source (uint32_t n=0) const { return *_sources[ (n < _sources.size()) ? n : 0 ]; }
+ uint32_t n_channels() const { return _sources.size(); }
+
+ std::vector<string> master_source_names();
+
/* serialization */
@@ -205,7 +219,7 @@ class Region : public Stateful, public StateManager
static sigc::signal<void,Region*> CheckNewRegion;
- virtual Region* get_parent() = 0;
+ Region* get_parent();
uint64_t last_layer_op() const { return _last_layer_op; }
void set_last_layer_op (uint64_t when);
@@ -228,29 +242,32 @@ class Region : public Stateful, public StateManager
void maybe_uncopy ();
void first_edit ();
- virtual bool verify_start (jack_nframes_t) = 0;
- virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t) = 0;
- virtual bool verify_start_mutable (jack_nframes_t&_start) = 0;
- virtual bool verify_length (jack_nframes_t) = 0;
+ bool verify_start (jack_nframes_t);
+ bool verify_start_and_length (jack_nframes_t, jack_nframes_t);
+ bool verify_start_mutable (jack_nframes_t&_start);
+ bool verify_length (jack_nframes_t);
virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;
-
+
+ PBD::ID _id;
+ string _name;
+ Flag _flags;
jack_nframes_t _start;
jack_nframes_t _length;
jack_nframes_t _position;
- Flag _flags;
jack_nframes_t _sync_position;
layer_t _layer;
- string _name;
mutable RegionEditState _first_edit;
int _frozen;
- Glib::Mutex lock;
- PBD::ID _id;
+ mutable uint32_t _read_data_count; ///< modified in read()
+ Change _pending_changed;
+ uint64_t _last_layer_op; ///< timestamp
+ Glib::Mutex _lock;
ARDOUR::Playlist* _playlist;
- mutable uint32_t _read_data_count; // modified in read()
- Change pending_changed;
- uint64_t _last_layer_op; // timestamp
+ SourceList _sources;
+ /** Used when timefx are applied, so we can always use the original source */
+ SourceList _master_sources;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index d1db818e40..493a5e7bc0 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -304,7 +304,7 @@ class Route : public IO
void passthru (jack_nframes_t start_frame, jack_nframes_t end_frame,
jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_inputs);
- void process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
+ virtual void process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
jack_nframes_t start_frame, jack_nframes_t end_frame,
jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
bool meter);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 6eb025f076..7331cbb5db 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -76,7 +76,9 @@ class AudioSource;
class Diskstream;
class AudioDiskstream;
+class MidiDiskstream;
class AudioFileSource;
+class MidiSource;
class Auditioner;
class Insert;
class Send;
@@ -274,6 +276,7 @@ class Session : public sigc::trackable, public Stateful
static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive);
static string peak_path_from_audio_path (string);
string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive);
+ string midi_path_from_name (string);
void process (jack_nframes_t nframes);
@@ -635,7 +638,7 @@ class Session : public sigc::trackable, public Stateful
string new_region_name (string);
string path_from_region_name (string name, string identifier);
- AudioRegion* find_whole_file_parent (AudioRegion&);
+ Region* find_whole_file_parent (Region& child);
void find_equivalent_playlist_regions (Region&, std::vector<Region*>& result);
AudioRegion *XMLRegionFactory (const XMLNode&, bool full);
@@ -704,6 +707,8 @@ class Session : public sigc::trackable, public Stateful
AudioFileSource *create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive);
+ MidiSource *create_midi_source_for_session (ARDOUR::MidiDiskstream&);
+
Source *source_by_id (const PBD::ID&);
/* playlist management */
@@ -745,8 +750,7 @@ class Session : public sigc::trackable, public Stateful
/* flattening stuff */
- int write_one_audio_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt, bool overwrite, vector<AudioSource*>&,
- InterThreadInfo& wot);
+ int write_one_audio_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt, bool overwrite, vector<Source*>&, InterThreadInfo& wot);
int freeze (InterThreadInfo&);
/* session-wide solo/mute/rec-enable */
@@ -853,6 +857,7 @@ class Session : public sigc::trackable, public Stateful
}
// these commands are implemented in libs/ardour/session_command.cc
+ Command *memento_command_factory(XMLNode *n);
class GlobalSoloStateCommand : public Command
{
GlobalRouteBooleanState before, after;
@@ -987,8 +992,6 @@ class Session : public sigc::trackable, public Stateful
ExportContext
};
- char * conversion_buffer(RunContext context) { return _conversion_buffers[context]; }
-
/* VST support */
static long vst_callback (AEffect* effect,
@@ -1072,7 +1075,6 @@ class Session : public sigc::trackable, public Stateful
vector<Sample *> _passthru_buffers;
vector<Sample *> _silent_buffers;
vector<Sample *> _send_buffers;
- map<RunContext,char*> _conversion_buffers;
jack_nframes_t current_block_size;
jack_nframes_t _worst_output_latency;
jack_nframes_t _worst_input_latency;
diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h
index 00f8cb26de..83bc47d7d3 100644
--- a/libs/ardour/ardour/smf_source.h
+++ b/libs/ardour/ardour/smf_source.h
@@ -41,7 +41,7 @@ class SMFSource : public MidiSource {
};
/** Constructor for existing external-to-session files */
- SMFSource (std::string path, Flag flags);
+ SMFSource (std::string path, Flag flags = Flag(0));
/* Constructor for existing in-session files */
SMFSource (const XMLNode&);
@@ -55,8 +55,8 @@ class SMFSource : public MidiSource {
void set_allow_remove_if_empty (bool yn);
void mark_for_remove();
- virtual int update_header (jack_nframes_t when, struct tm&, time_t) = 0;
- virtual int flush_header () = 0;
+ int update_header (jack_nframes_t when, struct tm&, time_t);
+ int flush_header ();
int move_to_trash (const string trash_dir_name);
@@ -76,6 +76,9 @@ class SMFSource : public MidiSource {
int init (string idstr, bool must_exist);
+ jack_nframes_t read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cn) const;
+ jack_nframes_t write_unlocked (RawMidi* dst, jack_nframes_t cnt);
+
bool find (std::string path, bool must_exist, bool& is_new);
bool removable() const;
bool writable() const { return _flags & Writable; }
diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h
index 4764339451..ab3e61eb29 100644
--- a/libs/ardour/ardour/sndfilesource.h
+++ b/libs/ardour/ardour/sndfilesource.h
@@ -56,8 +56,8 @@ class SndFileSource : public AudioFileSource {
protected:
void set_header_timeline_position ();
- jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const;
- jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt, char * workbuf);
+ jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const;
+ jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt);
jack_nframes_t write_float (Sample* data, jack_nframes_t pos, jack_nframes_t cnt);
diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h
index f57ea79854..dc1e93f8f2 100644
--- a/libs/ardour/ardour/source.h
+++ b/libs/ardour/ardour/source.h
@@ -46,9 +46,16 @@ class Source : public Stateful, public sigc::trackable
uint32_t use_cnt() const { return _use_cnt; }
void use ();
void release ();
+
+ virtual void mark_for_remove() = 0;
time_t timestamp() const { return _timestamp; }
void stamp (time_t when) { _timestamp = when; }
+
+ /** @return the number of items in this source */
+ jack_nframes_t length() const { return _length; }
+
+ virtual jack_nframes_t natural_position() const { return 0; }
XMLNode& get_state ();
int set_state (const XMLNode&);
@@ -56,9 +63,12 @@ class Source : public Stateful, public sigc::trackable
sigc::signal<void,Source *> GoingAway;
protected:
+ void update_length (jack_nframes_t pos, jack_nframes_t cnt);
+
string _name;
uint32_t _use_cnt;
time_t _timestamp;
+ jack_nframes_t _length;
private:
PBD::ID _id;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index c30c103d3f..00833f6547 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -29,6 +29,7 @@
#include <inttypes.h>
#include <jack/types.h>
+#include <jack/midiport.h>
#include <control_protocol/smpte.h>
#include <pbd/id.h>
@@ -49,7 +50,7 @@ namespace ARDOUR {
typedef uint32_t layer_t;
typedef uint64_t microseconds_t;
- typedef unsigned char RawMidi;
+ typedef jack_midi_event_t RawMidi;
enum IOChange {
NoChange = 0,
@@ -245,7 +246,14 @@ namespace ARDOUR {
PeakDatum min;
PeakDatum max;
};
-}
+
+ enum PluginType {
+ AudioUnit,
+ LADSPA,
+ VST
+ };
+
+} // namespace ARDOUR
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf);
@@ -256,7 +264,6 @@ session_frame_to_track_frame (jack_nframes_t session_frame, double speed)
return (jack_nframes_t)( (double)session_frame * speed );
}
-
static inline jack_nframes_t
track_frame_to_session_frame (jack_nframes_t track_frame, double speed)
{
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index 5253da7b0a..4fb5b0babb 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -113,6 +113,8 @@ class VSTPluginInfo : public PluginInfo
PluginPtr load (Session& session);
};
+typedef boost::shared_ptr<VSTPluginInfo> VSTPluginInfoPtr;
+
} // namespace ARDOUR
#endif /* __ardour_vst_plugin_h__ */