summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-08-01 17:19:38 +0000
committerDavid Robillard <d@drobilla.net>2006-08-01 17:19:38 +0000
commit79fc27de2ef9db51a8c7c69764b663a9921c5a40 (patch)
tree09d5e86fa212f2b8dde0811b2c9e8cc7cfbc7136 /libs/ardour
parent9d5d82b4df5b3510177fd31557ac765f46778fe8 (diff)
Mostly Cosmetic/Design changes to bring trunk and midi branch closer
git-svn-id: svn://localhost/ardour2/branches/midi@733 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/SConscript1
-rw-r--r--libs/ardour/ardour/audio_diskstream.h21
-rw-r--r--libs/ardour/ardour/audio_track.h10
-rw-r--r--libs/ardour/ardour/audioengine.h6
-rw-r--r--libs/ardour/ardour/audioregion.h79
-rw-r--r--libs/ardour/ardour/buffer.h36
-rw-r--r--libs/ardour/ardour/diskstream.h49
-rw-r--r--libs/ardour/ardour/io.h12
-rw-r--r--libs/ardour/ardour/midi_diskstream.h4
-rw-r--r--libs/ardour/ardour/midi_region.h4
-rw-r--r--libs/ardour/ardour/midi_track.h2
-rw-r--r--libs/ardour/ardour/playlist.h1
-rw-r--r--libs/ardour/ardour/region.h96
-rw-r--r--libs/ardour/ardour/route.h4
-rw-r--r--libs/ardour/ardour/route_group.h3
-rw-r--r--libs/ardour/ardour/route_group_specialized.h6
-rw-r--r--libs/ardour/ardour/session.h25
-rw-r--r--libs/ardour/ardour/track.h25
-rw-r--r--libs/ardour/ardour/types.h6
-rw-r--r--libs/ardour/audio_diskstream.cc73
-rw-r--r--libs/ardour/audio_track.cc92
-rw-r--r--libs/ardour/audioengine.cc6
-rw-r--r--libs/ardour/audioregion.cc16
-rw-r--r--libs/ardour/auditioner.cc6
-rw-r--r--libs/ardour/diskstream.cc6
-rw-r--r--libs/ardour/io.cc20
-rw-r--r--libs/ardour/midi_diskstream.cc4
-rw-r--r--libs/ardour/midi_track.cc16
-rw-r--r--libs/ardour/region.cc12
-rw-r--r--libs/ardour/route.cc6
-rw-r--r--libs/ardour/session.cc37
-rw-r--r--libs/ardour/session_state.cc7
-rw-r--r--libs/ardour/smpte.cc405
-rw-r--r--libs/ardour/track.cc91
34 files changed, 350 insertions, 837 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 7b42ad8374..394df05f04 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -99,7 +99,6 @@ tempo.cc
utils.cc
version.cc
mix.cc
-smpte.cc
""")
arch_specific_objects = [ ]
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index ec15cf1caf..e2dfc5fd0c 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -60,6 +60,8 @@ class AudioDiskstream : public Diskstream
AudioDiskstream (Session &, const string& name, Diskstream::Flag f = Recordable);
AudioDiskstream (Session &, const XMLNode&);
+ const PBD::ID& id() const { return _id; }
+
// FIXME
AudioDiskstream& ref() { _refcnt++; return *this; }
@@ -78,7 +80,7 @@ class AudioDiskstream : public Diskstream
if (n < channels.size()) return channels[n].source; return 0;
}
- void set_record_enabled (bool yn, void *src);
+ void set_record_enabled (bool yn);
float peak_power(uint32_t n=0) {
float x = channels[n].peak_power;
@@ -121,7 +123,7 @@ class AudioDiskstream : public Diskstream
/* stateful */
XMLNode& get_state(void);
- int set_state(const XMLNode& node);
+ int set_state(const XMLNode& node);
void monitor_input (bool);
@@ -141,16 +143,7 @@ class AudioDiskstream : public Diskstream
}
}
- static sigc::signal<void,list<AudioFileSource*>*> DeleteSources;
-
- int set_loop (Location *loc);
- sigc::signal<void,Location *> LoopSet;
-
- std::list<Region*>& last_capture_regions () {
- return _last_capture_regions;
- }
-
- const PBD::ID& id() const { return _id; }
+ std::list<Region*>& last_capture_regions () { return _last_capture_regions; }
XMLNode* deprecated_io_node;
@@ -248,8 +241,8 @@ class AudioDiskstream : public Diskstream
void setup_destructive_playlist ();
void use_destructive_playlist ();
- void engage_record_enable (void* src);
- void disengage_record_enable (void* src);
+ void engage_record_enable ();
+ void disengage_record_enable ();
// Working buffers for do_refill (butler thread)
static void allocate_working_buffers();
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index 2616705918..15b99297c8 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -36,8 +36,6 @@ class AudioTrack : public Track
AudioTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
AudioTrack (Session&, const XMLNode&);
~AudioTrack ();
-
- int set_name (string str, void *src);
int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
@@ -48,16 +46,10 @@ class AudioTrack : public Track
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 set_record_enable (bool yn, void *src);
-
AudioDiskstream& audio_diskstream() const;
int use_diskstream (string name);
int use_diskstream (const PBD::ID& id);
-
- void set_mode (TrackMode m);
-
- void set_latency_delay (jack_nframes_t);
int export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t end_frame);
@@ -69,8 +61,6 @@ class AudioTrack : public Track
int set_state(const XMLNode& node);
- bool record_enabled() const;
-
protected:
XMLNode& state (bool full);
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index bac1e3720a..81370e379c 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -34,7 +34,7 @@
#include <ardour/ardour.h>
#include <jack/jack.h>
#include <jack/transport.h>
-#include <ardour/buffer.h>
+#include <ardour/types.h>
namespace ARDOUR {
@@ -105,8 +105,8 @@ class AudioEngine : public sigc::trackable
virtual const char *what() const throw() { return "could not connect to engine backend"; }
};
- Port *register_input_port (Buffer::Type type, const std::string& portname);
- Port *register_output_port (Buffer::Type type, const std::string& portname);
+ Port *register_input_port (DataType type, const std::string& portname);
+ Port *register_output_port (DataType type, const std::string& portname);
int unregister_port (Port *);
int connect (const std::string& source, const std::string& destination);
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index 54e2d73af0..683e946713 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -27,8 +27,9 @@
#include <pbd/undo.h>
#include <ardour/ardour.h>
-#include <ardour/gain.h>
#include <ardour/region.h>
+#include <ardour/gain.h>
+#include <ardour/logcurve.h>
#include <ardour/export.h>
class XMLNode;
@@ -43,14 +44,14 @@ class AudioSource;
struct AudioRegionState : public RegionState
{
- AudioRegionState (std::string why);
-
- Curve _fade_in;
- Curve _fade_out;
- Curve _envelope;
- gain_t _scale_amplitude;
- uint32_t _fade_in_disabled;
- uint32_t _fade_out_disabled;
+ AudioRegionState (std::string why);
+
+ Curve _fade_in;
+ Curve _fade_out;
+ Curve _envelope;
+ gain_t _scale_amplitude;
+ uint32_t _fade_in_disabled;
+ uint32_t _fade_out_disabled;
};
class AudioRegion : public Region
@@ -92,7 +93,7 @@ class AudioRegion : public Region
vector<string> master_source_names();
bool envelope_active () const { return _flags & Region::EnvelopeActive; }
- bool fade_in_active () const { return _flags & Region::FadeIn; }
+ 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))); }
@@ -100,20 +101,21 @@ class AudioRegion : public Region
Curve& fade_out() { return _fade_out; }
Curve& envelope() { return _envelope; }
- jack_nframes_t read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t offset, jack_nframes_t cnt, uint32_t chan_n=0, double samples_per_unit= 1.0) const;
-
- virtual jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_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;
+ jack_nframes_t read_peaks (PeakData *buf, jack_nframes_t npeaks,
+ jack_nframes_t offset, jack_nframes_t cnt,
+ uint32_t chan_n=0, double samples_per_unit= 1.0) const;
- jack_nframes_t master_read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_buffer, char * workbuf, jack_nframes_t position, jack_nframes_t cnt, uint32_t chan_n=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,
+ 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 position, jack_nframes_t cnt, uint32_t chan_n=0) const;
XMLNode& state (bool);
- XMLNode& get_state ();
int set_state (const XMLNode&);
static void set_default_fade (float steepness, jack_nframes_t len);
@@ -140,10 +142,6 @@ class AudioRegion : public Region
int separate_by_channel (ARDOUR::Session&, vector<AudioRegion*>&) const;
- uint32_t read_data_count() const { return _read_data_count; }
-
- ARDOUR::Playlist* playlist() const { return _playlist; }
-
UndoAction get_memento() const;
/* filter */
@@ -167,20 +165,6 @@ class AudioRegion : public Region
friend class Playlist;
private:
- SourceList sources;
- SourceList master_sources; /* used when timefx are applied, so
- we can always use the original
- source.
- */
- mutable Curve _fade_in;
- FadeShape _fade_in_shape;
- mutable Curve _fade_out;
- FadeShape _fade_out_shape;
- mutable Curve _envelope;
- gain_t _scale_amplitude;
- uint32_t _fade_in_disabled;
- uint32_t _fade_out_disabled;
-
void set_default_fades ();
void set_default_fade_in ();
void set_default_fade_out ();
@@ -192,10 +176,6 @@ class AudioRegion : public Region
void recompute_gain_at_end ();
void recompute_gain_at_start ();
- bool copied() const { return _flags & Copied; }
- void maybe_uncopy ();
- void rename_after_first_edit ();
-
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,
uint32_t chan_n = 0,
@@ -212,6 +192,21 @@ class AudioRegion : public Region
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;
+ FadeShape _fade_out_shape;
+ mutable Curve _envelope;
+ gain_t _scale_amplitude;
+ uint32_t _fade_in_disabled;
+ uint32_t _fade_out_disabled;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h
index f0ad3be67e..cd36a06e36 100644
--- a/libs/ardour/ardour/buffer.h
+++ b/libs/ardour/ardour/buffer.h
@@ -45,12 +45,7 @@ namespace ARDOUR {
class Buffer
{
public:
- /** Unfortunately using RTTI and dynamic_cast to find the type of the
- * buffer is just too slow, this is done in very performance critical
- * bits of the code. */
- enum Type { NIL = 0, AUDIO, MIDI };
-
- Buffer(Type type, size_t capacity)
+ Buffer(DataType type, size_t capacity)
: _type(type), _capacity(capacity), _size(0)
{}
@@ -65,7 +60,7 @@ public:
/** Type of this buffer.
* Based on this you can static cast a Buffer* to the desired type. */
- virtual Type type() const { return _type; }
+ virtual DataType type() const { return _type; }
/** Jack type (eg JACK_DEFAULT_AUDIO_TYPE) */
const char* jack_type() const { return type_to_jack_type(type()); }
@@ -74,8 +69,11 @@ public:
const char* type_string() const { return type_to_string(type()); }
/* The below static methods need to be separate from the above methods
- * because the conversion is needed in places where there's no Buffer */
- static const char* type_to_jack_type(Type t) {
+ * because the conversion is needed in places where there's no Buffer.
+ * These should probably live somewhere else...
+ */
+
+ static const char* type_to_jack_type(DataType t) {
switch (t) {
case AUDIO: return JACK_DEFAULT_AUDIO_TYPE;
case MIDI: return JACK_DEFAULT_MIDI_TYPE;
@@ -83,7 +81,7 @@ public:
}
}
- static const char* type_to_string(Type t) {
+ static const char* type_to_string(DataType t) {
switch (t) {
case AUDIO: return "audio";
case MIDI: return "midi";
@@ -92,7 +90,7 @@ public:
}
/** Used for loading from XML (route default types etc) */
- static Type type_from_string(const string& str) {
+ static DataType type_from_string(const string& str) {
if (str == "audio")
return AUDIO;
else if (str == "midi")
@@ -102,9 +100,9 @@ public:
}
protected:
- Type _type;
- size_t _capacity;
- size_t _size;
+ DataType _type;
+ size_t _capacity;
+ size_t _size;
};
@@ -119,8 +117,12 @@ public:
: Buffer(AUDIO, capacity)
, _data(NULL)
{
- _size = capacity; // For audio buffers, size = capacity always
+ _size = capacity; // For audio buffers, size = capacity (always)
+#ifdef NO_POSIX_MEMALIGN
+ b = (Sample *) malloc(sizeof(Sample) * capacity);
+#else
posix_memalign((void**)_data, 16, sizeof(Sample) * capacity);
+#endif
assert(_data);
memset(_data, 0, sizeof(Sample) * capacity);
}
@@ -146,7 +148,11 @@ public:
: Buffer(MIDI, capacity)
, _data(NULL)
{
+#ifdef NO_POSIX_MEMALIGN
+ b = (Sample *) malloc(sizeof(RawMidi) * capacity);
+#else
posix_memalign((void**)_data, 16, sizeof(RawMidi) * capacity);
+#endif
assert(_data);
assert(_size == 0);
memset(_data, 0, sizeof(Sample) * capacity);
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index ff25127ec9..ebce516d8b 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -54,9 +54,6 @@ class Session;
class Playlist;
class IO;
-/* FIXME: There are (obviously) far too many virtual functions in this ATM.
- * Just to get things off the ground, they'll be removed. */
-
class Diskstream : public Stateful, public sigc::trackable
{
public:
@@ -66,8 +63,8 @@ class Diskstream : public Stateful, public sigc::trackable
Destructive = 0x4
};
- string name () const { return _name; }
- virtual int set_name (string str, void* src);
+ string name () const { return _name; }
+ virtual int set_name (string str);
ARDOUR::IO* io() const { return _io; }
void set_io (ARDOUR::IO& io);
@@ -83,14 +80,14 @@ class Diskstream : public Stateful, public sigc::trackable
void unset_flag (Flag f) { _flags &= ~f; }
AlignStyle alignment_style() const { return _alignment_style; }
- void set_align_style (AlignStyle);
- void set_persistent_align_style (AlignStyle a) { _persistent_alignment_style = a; }
+ void set_align_style (AlignStyle);
+ void set_persistent_align_style (AlignStyle a) { _persistent_alignment_style = a; }
jack_nframes_t roll_delay() const { return _roll_delay; }
- void set_roll_delay (jack_nframes_t);
+ void set_roll_delay (jack_nframes_t);
- bool record_enabled() const { return g_atomic_int_get (&_record_enabled); }
- virtual void set_record_enabled (bool yn, void *src) = 0;
+ bool record_enabled() const { return g_atomic_int_get (&_record_enabled); }
+ virtual void set_record_enabled (bool yn) = 0;
bool destructive() const { return _flags & Destructive; }
virtual void set_destructive (bool yn);
@@ -120,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;
@@ -136,23 +133,23 @@ class Diskstream : public Stateful, public sigc::trackable
bool slaved() const { return _slaved; }
void set_slaved(bool yn) { _slaved = yn; }
- virtual int set_loop (Location *loc);
- sigc::signal<void,Location *> LoopSet;
+ int set_loop (Location *loc);
std::list<Region*>& last_capture_regions () { return _last_capture_regions; }
void handle_input_change (IOChange, void *src);
- sigc::signal<void,void*> RecordEnableChanged;
- sigc::signal<void> SpeedChanged;
- sigc::signal<void,void*> ReverseChanged;
- sigc::signal<void> PlaylistChanged;
- sigc::signal<void> AlignmentStyleChanged;
+ sigc::signal<void> RecordEnableChanged;
+ sigc::signal<void> SpeedChanged;
+ sigc::signal<void> ReverseChanged;
+ sigc::signal<void> PlaylistChanged;
+ sigc::signal<void> AlignmentStyleChanged;
+ sigc::signal<void,Location *> LoopSet;
static sigc::signal<void> DiskOverrun;
static sigc::signal<void> DiskUnderrun;
static sigc::signal<void,Diskstream*> DiskstreamCreated; // XXX use a ref with sigc2
- //static sigc::signal<void,list<Source*>*> DeleteSources;
+ static sigc::signal<void,list<Source*>*> DeleteSources;
protected:
friend class Session;
@@ -160,10 +157,9 @@ class Diskstream : public Stateful, public sigc::trackable
Diskstream (Session &, const string& name, Flag f = Recordable);
Diskstream (Session &, const XMLNode&);
- /* the Session is the only point of access for these
- because they require that the Session is "inactive"
- while they are called.
- */
+ /* the Session is the only point of access for these because they require
+ * that the Session is "inactive" while they are called.
+ */
virtual void set_pending_overwrite (bool) = 0;
virtual int overwrite_existing_buffers () = 0;
@@ -191,7 +187,7 @@ class Diskstream : public Stateful, public sigc::trackable
//private:
- /* use unref() to destroy a diskstream */
+ /** Use unref() to destroy a diskstream */
virtual ~Diskstream();
enum TransitionType {
@@ -201,8 +197,7 @@ class Diskstream : public Stateful, public sigc::trackable
struct CaptureTransition {
TransitionType type;
- // the start or end file frame pos
- jack_nframes_t capture_val;
+ jack_nframes_t capture_val; ///< The start or end file frame position
};
/* The two central butler operations */
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 94e1483ad6..35b20f655e 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -38,7 +38,7 @@
#include <ardour/utils.h>
#include <ardour/state_manager.h>
#include <ardour/curve.h>
-#include <ardour/buffer.h>
+#include <ardour/types.h>
using std::string;
using std::vector;
@@ -67,7 +67,7 @@ class IO : public Stateful, public ARDOUR::StateManager
IO (Session&, string name,
int input_min = -1, int input_max = -1,
int output_min = -1, int output_max = -1,
- Buffer::Type default_type = Buffer::AUDIO);
+ DataType default_type = AUDIO);
virtual ~IO();
@@ -81,7 +81,7 @@ class IO : public Stateful, public ARDOUR::StateManager
void set_output_minimum (int n);
void set_output_maximum (int n);
- Buffer::Type default_type() const { return _default_type; }
+ DataType default_type() const { return _default_type; }
const string& name() const { return _name; }
virtual int set_name (string str, void *src);
@@ -116,8 +116,8 @@ class IO : public Stateful, public ARDOUR::StateManager
Connection *input_connection() const { return _input_connection; }
Connection *output_connection() const { return _output_connection; }
- int add_input_port (string source, void *src, Buffer::Type type = Buffer::NIL);
- int add_output_port (string destination, void *src, Buffer::Type type = Buffer::NIL);
+ int add_input_port (string source, void *src, DataType type = NIL);
+ int add_output_port (string destination, void *src, DataType type = NIL);
int remove_input_port (Port *, void *src);
int remove_output_port (Port *, void *src);
@@ -284,7 +284,7 @@ public:
PBD::ID _id;
bool no_panner_reset;
XMLNode* deferred_state;
- Buffer::Type _default_type;
+ DataType _default_type;
virtual void set_deferred_state() {}
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index 5998363d69..7877bfaf1c 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -73,7 +73,7 @@ class MidiDiskstream : public Diskstream
//void set_align_style (AlignStyle);
//void set_persistent_align_style (AlignStyle);
- void set_record_enabled (bool yn, void *src);
+ void set_record_enabled (bool yn);
//void set_speed (double);
int use_playlist (Playlist *);
@@ -82,8 +82,6 @@ class MidiDiskstream : public Diskstream
Playlist *playlist () { return _playlist; }
- static sigc::signal<void,list<SMFSource*>*> DeleteSources;
-
/* stateful */
XMLNode& get_state(void);
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h
index 1371162b14..ec47a91b95 100644
--- a/libs/ardour/ardour/midi_region.h
+++ b/libs/ardour/ardour/midi_region.h
@@ -121,10 +121,6 @@ class MidiRegion : public Region
StateManager::State* state_factory (std::string why) const;
Change restore_state (StateManager::State&);
- bool copied() const { return _flags & Copied; }
- void maybe_uncopy ();
- void rename_after_first_edit ();
-
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,
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 9874cfa56d..185e840ec9 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -82,7 +82,7 @@ protected:
uint32_t n_process_buffers ();
private:
- int set_diskstream (MidiDiskstream&, void *);
+ int set_diskstream (MidiDiskstream&);
void set_state_part_two ();
void set_state_part_three ();
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index add253982f..9fb5b0eb2b 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -54,7 +54,6 @@ class Playlist : public Stateful, public StateManager {
Playlist (const Playlist&, string name, bool hidden = false);
Playlist (const Playlist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false);
- //virtual 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) = 0;
virtual void clear (bool with_delete = false, bool with_save = true);
virtual void dump () const;
virtual UndoAction get_memento() const = 0;
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index a138f66042..3773a3b893 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -24,7 +24,6 @@
#include <pbd/undo.h>
#include <ardour/ardour.h>
-#include <ardour/logcurve.h>
#include <ardour/state_manager.h>
class XMLNode;
@@ -36,22 +35,22 @@ class Source;
enum RegionEditState {
EditChangesNothing = 0,
- EditChangesName = 1,
- EditChangesID = 2
+ EditChangesName = 1,
+ EditChangesID = 2
};
-struct RegionState : public StateManager::State {
-
- RegionState (std::string why) : StateManager::State (why) {}
-
- jack_nframes_t _start;
- jack_nframes_t _length;
- jack_nframes_t _position;
- uint32_t _flags;
- jack_nframes_t _sync_position;
- layer_t _layer;
- string _name;
- mutable RegionEditState _first_edit;
+struct RegionState : public StateManager::State
+{
+ RegionState (std::string why) : StateManager::State (why) {}
+
+ jack_nframes_t _start;
+ jack_nframes_t _length;
+ jack_nframes_t _position;
+ uint32_t _flags;
+ jack_nframes_t _sync_position;
+ layer_t _layer;
+ string _name;
+ mutable RegionEditState _first_edit;
};
class Region : public Stateful, public StateManager
@@ -95,7 +94,7 @@ class Region : public Stateful, public StateManager
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();
+ virtual ~Region();
const PBD::ID& id() const { return _id; }
@@ -105,9 +104,10 @@ class Region : public Stateful, public StateManager
void set_name (string str);
jack_nframes_t position () const { return _position; }
- jack_nframes_t start () const { return _start; }
- jack_nframes_t length() const { return _length; }
- layer_t layer () const { return _layer; }
+ jack_nframes_t start () const { return _start; }
+ jack_nframes_t length() const { return _length; }
+ layer_t layer () const { return _layer; }
+
jack_nframes_t sync_offset(int& dir) const;
jack_nframes_t sync_position() const;
@@ -118,14 +118,13 @@ class Region : public Stateful, public StateManager
jack_nframes_t first_frame() const { return _position; }
jack_nframes_t last_frame() const { return _position + _length - 1; }
- bool hidden() const { return _flags & Hidden; }
- bool muted() const { return _flags & Muted; }
- bool opaque () const { return _flags & Opaque; }
- //bool envelope_active () const { return _flags & EnvelopeActive; }
- bool locked() const { return _flags & Locked; }
- bool automatic() const { return _flags & Automatic; }
+ 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; }
+ Flag flags() const { return _flags; }
virtual bool should_save_state () const { return !(_flags & DoNotSaveState); };
@@ -148,12 +147,6 @@ class Region : public Stateful, public StateManager
virtual bool speed_mismatch (float) const = 0;
- /*virtual jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer,
- float *gain_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 = 0;*/
-
/* EDITING OPERATIONS */
void set_length (jack_nframes_t, void *src);
@@ -181,7 +174,6 @@ class Region : public Stateful, public StateManager
void set_hidden (bool yn);
void set_muted (bool yn);
void set_opaque (bool yn);
- //void set_envelope_active (bool yn);
void set_locked (bool yn);
virtual uint32_t read_data_count() const { return _read_data_count; }
@@ -197,9 +189,9 @@ class Region : public Stateful, public StateManager
/* serialization */
+ XMLNode& get_state ();
virtual XMLNode& state (bool);
- XMLNode& get_state ();
- int set_state (const XMLNode&);
+ virtual int set_state (const XMLNode&);
sigc::signal<void,Region*> GoingAway;
@@ -219,23 +211,6 @@ class Region : public Stateful, public StateManager
void set_last_layer_op (uint64_t when);
protected:
-
- 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;
- ARDOUR::Playlist* _playlist;
- mutable uint32_t _read_data_count; // modified in read()
- Change pending_changed;
- uint64_t _last_layer_op; // timestamp
-
XMLNode& get_short_state (); /* used only by Session */
/* state management */
@@ -259,6 +234,23 @@ class Region : public Stateful, public StateManager
virtual bool verify_length (jack_nframes_t) = 0;
virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;
+
+
+ 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;
+ ARDOUR::Playlist* _playlist;
+ mutable uint32_t _read_data_count; // modified in read()
+ Change pending_changed;
+ uint64_t _last_layer_op; // timestamp
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index c85f34f1fa..ea4a2374d4 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -40,7 +40,7 @@
#include <ardour/io.h>
#include <ardour/session.h>
#include <ardour/redirect.h>
-#include <ardour/buffer.h>
+#include <ardour/types.h>
namespace ARDOUR {
@@ -70,7 +70,7 @@ class Route : public IO
Route (Session&, std::string name, int input_min, int input_max, int output_min, int output_max,
- Flag flags = Flag(0), Buffer::Type default_type = Buffer::AUDIO);
+ Flag flags = Flag(0), DataType default_type = AUDIO);
Route (Session&, const XMLNode&);
virtual ~Route();
diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h
index 11253eda5b..e9fad1aa2b 100644
--- a/libs/ardour/ardour/route_group.h
+++ b/libs/ardour/ardour/route_group.h
@@ -35,6 +35,7 @@ using std::list;
namespace ARDOUR {
class Route;
+class Track;
class AudioTrack;
class Session;
@@ -90,7 +91,7 @@ class RouteGroup : public Stateful, public sigc::trackable {
/* to use these, #include <ardour/route_group_specialized.h> */
- template<class T> void apply (void (AudioTrack::*func)(T, void *), T val, void *src);
+ template<class T> void apply (void (Track::*func)(T, void *), T val, void *src);
/* fills at_set with all members of the group that are AudioTracks */
diff --git a/libs/ardour/ardour/route_group_specialized.h b/libs/ardour/ardour/route_group_specialized.h
index 0424002dcd..250d3744df 100644
--- a/libs/ardour/ardour/route_group_specialized.h
+++ b/libs/ardour/ardour/route_group_specialized.h
@@ -7,11 +7,11 @@
namespace ARDOUR {
template<class T> void
-RouteGroup::apply (void (AudioTrack::*func)(T, void *), T val, void *src)
+RouteGroup::apply (void (Track::*func)(T, void *), T val, void *src)
{
for (list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
- AudioTrack *at;
- if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) {
+ Track *at;
+ if ((at = dynamic_cast<Track*>(*i)) != 0) {
(at->*func)(val, this);
}
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index dd8ec4806a..d39807be3f 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -168,18 +168,18 @@ class Session : public sigc::trackable, public Stateful
Replace,
Clear
};
-
- Type type;
- Action action;
- jack_nframes_t action_frame;
- jack_nframes_t target_frame;
- float speed;
+
+ Type type;
+ Action action;
+ jack_nframes_t action_frame;
+ jack_nframes_t target_frame;
+ float speed;
union {
- void* ptr;
- bool yes_or_no;
- Session::SlaveSource slave;
- Route* route;
+ void* ptr;
+ bool yes_or_no;
+ Session::SlaveSource slave;
+ Route* route;
};
list<AudioRange> audio_range;
@@ -555,9 +555,6 @@ class Session : public sigc::trackable, public Stateful
void remove_route (boost::shared_ptr<Route>);
void resort_routes ();
void resort_routes_using (boost::shared_ptr<RouteList>);
- void resort_routes_proxy (void* src) {
- resort_routes ();
- }
AudioEngine &engine() { return _engine; };
@@ -739,7 +736,7 @@ class Session : public sigc::trackable, public Stateful
boost::shared_ptr<Auditioner> the_auditioner() { return auditioner; }
void audition_playlist ();
- void audition_region (AudioRegion&);
+ void audition_region (Region&);
void cancel_audition ();
bool is_auditioning () const;
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 86bfeb0c9b..707ead1573 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -31,11 +31,11 @@ class RouteGroup;
class Track : public Route
{
public:
- Track (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, Buffer::Type default_type = Buffer::AUDIO);
+ Track (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal, DataType default_type = AUDIO);
- virtual ~Track () {}
+ virtual ~Track ();
- virtual int set_name (string str, void *src) = 0;
+ int set_name (string str, void *src);
virtual int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0;
@@ -49,18 +49,17 @@ class Track : public Route
void toggle_monitor_input ();
bool can_record() const { return true; }
- virtual void set_record_enable (bool yn, void *src) = 0;
Diskstream& diskstream() const { return *_diskstream; }
virtual int use_diskstream (string name) = 0;
virtual int use_diskstream (const PBD::ID& id) = 0;
- TrackMode mode() const { return _mode; }
- virtual void set_mode (TrackMode m) = 0;
+ TrackMode mode() const { return _mode; }
+ void set_mode (TrackMode m);
jack_nframes_t update_total_latency();
- virtual void set_latency_delay (jack_nframes_t) = 0;
+ void set_latency_delay (jack_nframes_t);
enum FreezeState {
NoFreeze,
@@ -82,15 +81,17 @@ class Track : public Route
PBD::Controllable& rec_enable_control() { return _rec_enable_control; }
- virtual bool record_enabled() const = 0;
+ bool record_enabled() const;
+ void set_record_enable (bool yn, void *src);
+
void set_meter_point (MeterPoint, void* src);
- sigc::signal<void> ModeChanged;
- sigc::signal<void,void*> DiskstreamChanged;
- sigc::signal<void> FreezeChange;
+ sigc::signal<void> ModeChanged;
+ sigc::signal<void> DiskstreamChanged;
+ sigc::signal<void> FreezeChange;
protected:
- Track (Session& sess, const XMLNode& node, Buffer::Type default_type = Buffer::AUDIO);
+ Track (Session& sess, const XMLNode& node, DataType default_type = AUDIO);
virtual XMLNode& state (bool full) = 0;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index c5b79a950c..eb86470ebc 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -245,6 +245,12 @@ namespace ARDOUR {
PeakDatum min;
PeakDatum max;
};
+
+ enum DataType {
+ NIL = 0,
+ AUDIO,
+ MIDI
+ };
}
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 5f6ce05016..7f0cb55821 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -54,8 +54,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,list<AudioFileSource*>*> AudioDiskstream::DeleteSources;
-
size_t AudioDiskstream::_working_buffers_size = 0;
Sample* AudioDiskstream::_mixdown_buffer = 0;
gain_t* AudioDiskstream::_gain_buffer = 0;
@@ -140,13 +138,8 @@ AudioDiskstream::init (Diskstream::Flag f)
set_block_size (_session.get_block_size());
allocate_temporary_buffers ();
- pending_overwrite = false;
- overwrite_frame = 0;
- overwrite_queued = false;
- input_change_pending = NoChange;
-
add_channel ();
- _n_channels = 1;
+ assert(_n_channels == 1);
}
void
@@ -420,6 +413,7 @@ AudioDiskstream::use_destructive_playlist ()
for (n = 0, chan = channels.begin(); chan != channels.end(); ++chan, ++n) {
(*chan).write_source = dynamic_cast<AudioFileSource*>(&region->source (n));
+ assert((*chan).write_source);
(*chan).write_source->set_allow_remove_if_empty (false);
}
@@ -589,7 +583,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes
returns a non-zero value, in which case, ::commit should not be called.
*/
- // If we can't take the state lock return.
+ // If we can't take the state lock return.
if (!state_lock.trylock()) {
return 1;
}
@@ -983,7 +977,7 @@ AudioDiskstream::seek (jack_nframes_t frame, bool complete_refill)
/* can't rec-enable in destructive mode if transport is before start */
if (destructive() && record_enabled() && frame < _session.current_start_frame()) {
- disengage_record_enable (this);
+ disengage_record_enable ();
}
playback_sample = frame;
@@ -1328,6 +1322,16 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer, char *
return ret;
}
+/** Flush pending data to disk.
+ *
+ * Important note: this function will write *AT MOST* disk_io_chunk_frames
+ * of data to disk. it will never write more than that. If it writes that
+ * much and there is more than that waiting to be written, it will return 1,
+ * otherwise 0 on success or -1 on failure.
+ *
+ * If there is less than disk_io_chunk_frames to be written, no data will be
+ * written at all unless @a force_flush is true.
+ */
int
AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
{
@@ -1338,16 +1342,6 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
RingBufferNPT<Sample>::rw_vector vector;
RingBufferNPT<CaptureTransition>::rw_vector transvec;
jack_nframes_t total;
-
- /* important note: this function will write *AT MOST*
- disk_io_chunk_frames of data to disk. it will never
- write more than that. if its writes that much and there
- is more than that waiting to be written, it will return 1,
- otherwise 0 on success or -1 on failure.
-
- if there is less than disk_io_chunk_frames to be written,
- no data will be written at all unless `force_flush' is true.
- */
_write_data_count = 0;
@@ -1362,7 +1356,6 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush)
goto out;
}
-
/* if there are 2+ chunks of disk i/o possible for
this track, let the caller know so that it can arrange
for us to be called again, ASAP.
@@ -1479,7 +1472,6 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
ChannelList::iterator chan;
vector<CaptureInfo*>::iterator ci;
uint32_t n = 0;
- list<AudioFileSource*>* deletion_list;
bool mark_write_completed = false;
finish_capture (true);
@@ -1512,7 +1504,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
ChannelList::iterator chan;
- deletion_list = new list<AudioFileSource*>;
+ list<Source*>* deletion_list = new list<Source*>;
for ( chan = channels.begin(); chan != channels.end(); ++chan) {
@@ -1699,7 +1691,7 @@ AudioDiskstream::finish_capture (bool rec_monitors_input)
}
void
-AudioDiskstream::set_record_enabled (bool yn, void* src)
+AudioDiskstream::set_record_enabled (bool yn)
{
if (!recordable() || !_session.record_enabling_legal()) {
return;
@@ -1726,17 +1718,17 @@ AudioDiskstream::set_record_enabled (bool yn, void* src)
if (record_enabled() != yn) {
if (yn) {
- engage_record_enable (src);
+ engage_record_enable ();
} else {
- disengage_record_enable (src);
+ disengage_record_enable ();
}
}
}
void
-AudioDiskstream::engage_record_enable (void* src)
+AudioDiskstream::engage_record_enable ()
{
- bool rolling = _session.transport_speed() != 0.0f;
+ bool rolling = _session.transport_speed() != 0.0f;
g_atomic_int_set (&_record_enabled, 1);
capturing_sources.clear ();
@@ -1753,11 +1745,11 @@ AudioDiskstream::engage_record_enable (void* src)
}
}
- RecordEnableChanged (src); /* EMIT SIGNAL */
+ RecordEnableChanged (); /* EMIT SIGNAL */
}
void
-AudioDiskstream::disengage_record_enable (void* src)
+AudioDiskstream::disengage_record_enable ()
{
g_atomic_int_set (&_record_enabled, 0);
if (Config->get_use_hardware_monitoring()) {
@@ -1768,7 +1760,7 @@ AudioDiskstream::disengage_record_enable (void* src)
}
}
capturing_sources.clear ();
- RecordEnableChanged (src); /* EMIT SIGNAL */
+ RecordEnableChanged (); /* EMIT SIGNAL */
}
@@ -1875,8 +1867,7 @@ AudioDiskstream::set_state (const XMLNode& node)
}
// create necessary extra channels
- // we are always constructed with one
- // and we always need one
+ // we are always constructed with one and we always need one
if (nchans > _n_channels) {
@@ -2182,22 +2173,6 @@ AudioDiskstream::capture_buffer_load () const
}
int
-AudioDiskstream::set_loop (Location *location)
-{
- if (location) {
- if (location->start() >= location->end()) {
- error << string_compose(_("Location \"%1\" not valid for track loop (start >= end)"), location->name()) << endl;
- return -1;
- }
- }
-
- loop_location = location;
-
- LoopSet (location); /* EMIT SIGNAL */
- return 0;
-}
-
-int
AudioDiskstream::use_pending_capture_data (XMLNode& node)
{
const XMLProperty* prop;
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index eae9076105..78af23e3df 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -57,28 +57,17 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
AudioDiskstream* ds = new AudioDiskstream (_session, name, dflags);
- _declickable = true;
- _freeze_record.state = NoFreeze;
- _saved_meter_point = _meter_point;
- _mode = mode;
-
set_diskstream (*ds, this);
}
AudioTrack::AudioTrack (Session& sess, const XMLNode& node)
: Track (sess, node)
{
- _freeze_record.state = NoFreeze;
set_state (node);
- _declickable = true;
- _saved_meter_point = _meter_point;
}
AudioTrack::~AudioTrack ()
{
- if (_diskstream) {
- _diskstream->unref();
- }
}
int
@@ -155,13 +144,13 @@ AudioTrack::set_diskstream (AudioDiskstream& ds, void *src)
}
}
- _diskstream->set_record_enabled (false, this);
+ _diskstream->set_record_enabled (false);
_diskstream->monitor_input (false);
ic_connection.disconnect();
ic_connection = input_changed.connect (mem_fun (*_diskstream, &Diskstream::handle_input_change));
- DiskstreamChanged (src); /* EMIT SIGNAL */
+ DiskstreamChanged (); /* EMIT SIGNAL */
return 0;
}
@@ -192,41 +181,6 @@ AudioTrack::use_diskstream (const PBD::ID& id)
return set_diskstream (*dstream, this);
}
-bool
-AudioTrack::record_enabled () const
-{
- return _diskstream->record_enabled ();
-}
-
-void
-AudioTrack::set_record_enable (bool yn, void *src)
-{
- if (_freeze_record.state == Frozen) {
- return;
- }
-
- if (_mix_group && src != _mix_group && _mix_group->is_active()) {
- _mix_group->apply (&AudioTrack::set_record_enable, yn, _mix_group);
- return;
- }
-
- /* keep track of the meter point as it was before we rec-enabled */
-
- if (!_diskstream->record_enabled()) {
- _saved_meter_point = _meter_point;
- }
-
- _diskstream->set_record_enabled (yn, src);
-
- if (_diskstream->record_enabled()) {
- set_meter_point (MeterInput, this);
- } else {
- set_meter_point (_saved_meter_point, this);
- }
-
- _rec_enable_control.Changed ();
-}
-
AudioDiskstream&
AudioTrack::audio_diskstream() const
{
@@ -673,28 +627,6 @@ AudioTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jac
}
int
-AudioTrack::set_name (string str, void *src)
-{
- int ret;
-
- if (record_enabled() && _session.actively_recording()) {
- /* this messes things up if done while recording */
- return -1;
- }
-
- if (audio_diskstream().set_name (str, src)) {
- return -1;
- }
-
- /* save state so that the statefile fully reflects any filename changes */
-
- if ((ret = IO::set_name (str, src)) == 0) {
- _session.save_state ("");
- }
- return ret;
-}
-
-int
AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbufs, jack_nframes_t start, jack_nframes_t nframes)
{
gain_t gain_automation[nframes];
@@ -796,13 +728,6 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbu
}
void
-AudioTrack::set_latency_delay (jack_nframes_t longest_session_latency)
-{
- Route::set_latency_delay (longest_session_latency);
- audio_diskstream().set_roll_delay (_roll_delay);
-}
-
-void
AudioTrack::bounce (InterThreadInfo& itt)
{
vector<AudioSource*> srcs;
@@ -902,7 +827,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
region->set_locked (true);
diskstream.use_playlist (dynamic_cast<AudioPlaylist*>(new_playlist));
- diskstream.set_record_enabled (false, this);
+ diskstream.set_record_enabled (false);
_freeze_record.state = Frozen;
FreezeChange(); /* EMIT SIGNAL */
@@ -940,14 +865,3 @@ AudioTrack::unfreeze ()
FreezeChange (); /* EMIT SIGNAL */
}
-void
-AudioTrack::set_mode (TrackMode m)
-{
- if (_diskstream) {
- if (_mode != m) {
- _mode = m;
- audio_diskstream().set_destructive (m == Destructive);
- ModeChanged();
- }
- }
-}
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 72708b46f8..5618c7ef5f 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -26,6 +26,7 @@
#include <pbd/pthread_utils.h>
#include <ardour/audioengine.h>
+#include <ardour/buffer.h>
#include <ardour/port.h>
#include <ardour/session.h>
#include <ardour/cycle_timer.h>
@@ -42,7 +43,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-// Why here? [DR]
jack_nframes_t Port::_short_over_length = 2;
jack_nframes_t Port::_long_over_length = 10;
@@ -389,7 +389,7 @@ AudioEngine::remove_session ()
}
Port *
-AudioEngine::register_input_port (Buffer::Type type, const string& portname)
+AudioEngine::register_input_port (DataType type, const string& portname)
{
if (!_running) {
if (!_has_run) {
@@ -421,7 +421,7 @@ AudioEngine::register_input_port (Buffer::Type type, const string& portname)
}
Port *
-AudioEngine::register_output_port (Buffer::Type type, const string& portname)
+AudioEngine::register_output_port (DataType type, const string& portname)
{
if (!_running) {
if (!_has_run) {
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index b137229c36..fff1c99598 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -48,13 +48,13 @@ using namespace ARDOUR;
/* a Session will reset these to its chosen defaults by calling AudioRegion::set_default_fade() */
-Change AudioRegion::FadeInChanged = ARDOUR::new_change();
-Change AudioRegion::FadeOutChanged = ARDOUR::new_change();
-Change AudioRegion::FadeInActiveChanged = ARDOUR::new_change();
-Change AudioRegion::FadeOutActiveChanged = ARDOUR::new_change();
+Change AudioRegion::FadeInChanged = ARDOUR::new_change();
+Change AudioRegion::FadeOutChanged = ARDOUR::new_change();
+Change AudioRegion::FadeInActiveChanged = ARDOUR::new_change();
+Change AudioRegion::FadeOutActiveChanged = ARDOUR::new_change();
Change AudioRegion::EnvelopeActiveChanged = ARDOUR::new_change();
Change AudioRegion::ScaleAmplitudeChanged = ARDOUR::new_change();
-Change AudioRegion::EnvelopeChanged = ARDOUR::new_change();
+Change AudioRegion::EnvelopeChanged = ARDOUR::new_change();
AudioRegionState::AudioRegionState (string why)
: RegionState (why),
@@ -634,12 +634,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
}
XMLNode&
-AudioRegion::get_state ()
-{
- return state (true);
-}
-
-XMLNode&
AudioRegion::state (bool full)
{
XMLNode& node (Region::state (full));
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index 38fb2e5859..81f64d2671 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -44,12 +44,12 @@ Auditioner::Auditioner (Session& s)
defer_pan_reset ();
if (left.length()) {
- add_output_port (left, this, Buffer::AUDIO);
+ add_output_port (left, this, AUDIO);
}
if (right.length()) {
audio_diskstream().add_channel();
- add_output_port (right, this, Buffer::AUDIO);
+ add_output_port (right, this, AUDIO);
}
allow_pan_reset ();
@@ -67,7 +67,7 @@ Auditioner::~Auditioner ()
AudioPlaylist&
Auditioner::prepare_playlist ()
{
- // FIXME
+ // FIXME auditioner is still audio-only
AudioPlaylist* const apl = dynamic_cast<AudioPlaylist*>(_diskstream->playlist());
assert(apl);
diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc
index 9fc2ded0ce..9312de5bf1 100644
--- a/libs/ardour/diskstream.cc
+++ b/libs/ardour/diskstream.cc
@@ -58,7 +58,7 @@ using namespace PBD;
jack_nframes_t Diskstream::disk_io_chunk_frames = 0;
sigc::signal<void,Diskstream*> Diskstream::DiskstreamCreated;
-//sigc::signal<void,list<AudioFileSource*>*> Diskstream::DeleteSources;
+sigc::signal<void,list<Source*>*> Diskstream::DeleteSources;
sigc::signal<void> Diskstream::DiskOverrun;
sigc::signal<void> Diskstream::DiskUnderrun;
@@ -124,7 +124,7 @@ Diskstream::init (Flag f)
Diskstream::~Diskstream ()
{
- // Taken by derived class destrctors.. assure lock?
+ // Taken by derived class destrctors.. should assure locked here somehow?
//Glib::Mutex::Lock lm (state_lock);
if (_playlist)
@@ -369,7 +369,7 @@ Diskstream::playlist_deleted (Playlist* pl)
}
int
-Diskstream::set_name (string str, void *src)
+Diskstream::set_name (string str)
{
if (str != _name) {
assert(playlist());
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 1c8de5008a..a70bf8abd3 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -102,7 +102,7 @@ static bool sort_ports_by_name (Port* a, Port* b)
*/
IO::IO (Session& s, string name,
int input_min, int input_max, int output_min, int output_max,
- Buffer::Type default_type)
+ DataType default_type)
: _session (s),
_name (name),
_default_type(default_type),
@@ -789,15 +789,15 @@ IO::remove_output_port (Port* port, void* src)
*
* @param destination Name of input port to connect new port to.
* @param src Source for emitted ConfigurationChanged signal.
- * @param type Data type of port. Default value (Buffer::NIL) will use this IO's default type.
+ * @param type Data type of port. Default value (NIL) will use this IO's default type.
*/
int
-IO::add_output_port (string destination, void* src, Buffer::Type type)
+IO::add_output_port (string destination, void* src, DataType type)
{
Port* our_port;
char name[64];
- if (type == Buffer::NIL)
+ if (type == NIL)
type = _default_type;
{
@@ -904,12 +904,12 @@ IO::remove_input_port (Port* port, void* src)
* @param src Source for emitted ConfigurationChanged signal.
*/
int
-IO::add_input_port (string source, void* src, Buffer::Type type)
+IO::add_input_port (string source, void* src, DataType type)
{
Port* our_port;
char name[64];
- if (type == Buffer::NIL)
+ if (type == NIL)
type = _default_type;
{
@@ -1026,10 +1026,8 @@ IO::ensure_inputs_locked (uint32_t n, bool clear, void* src)
char buf[64];
- /* Create a new input port */
+ /* Create a new input port (of the default type) */
- // FIXME: of what type?
-
if (_input_maximum == 1) {
snprintf (buf, sizeof (buf), _("%s/in"), _name.c_str());
}
@@ -1128,10 +1126,8 @@ IO::ensure_io (uint32_t nin, uint32_t nout, bool clear, void* src)
out_changed = true;
}
- /* create any necessary new ports */
+ /* create any necessary new ports (of the default type) */
- // FIXME: of what type?
-
while (_ninputs < nin) {
char buf[64];
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 4602fc8f67..a43e5e9024 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -55,8 +55,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-sigc::signal<void,list<SMFSource*>*> MidiDiskstream::DeleteSources;
-
MidiDiskstream::MidiDiskstream (Session &sess, const string &name, Diskstream::Flag flag)
: Diskstream(sess, name, flag)
, _playlist(NULL)
@@ -412,7 +410,7 @@ MidiDiskstream::finish_capture (bool rec_monitors_input)
}
void
-MidiDiskstream::set_record_enabled (bool yn, void* src)
+MidiDiskstream::set_record_enabled (bool yn)
{
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 1e00879d53..bdf242bed0 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -40,7 +40,7 @@ using namespace ARDOUR;
using namespace PBD;
MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mode)
- : Track (sess, name, flag, mode, Buffer::MIDI)
+ : Track (sess, name, flag, mode, MIDI)
{
MidiDiskstream::Flag dflags = MidiDiskstream::Flag (0);
@@ -61,7 +61,7 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
_saved_meter_point = _meter_point;
_mode = mode;
- set_diskstream (*ds, this);
+ set_diskstream (*ds);
}
MidiTrack::MidiTrack (Session& sess, const XMLNode& node)
@@ -82,7 +82,7 @@ MidiTrack::~MidiTrack ()
int
-MidiTrack::set_diskstream (MidiDiskstream& ds, void *src)
+MidiTrack::set_diskstream (MidiDiskstream& ds)
{
if (_diskstream) {
_diskstream->unref();
@@ -92,13 +92,13 @@ MidiTrack::set_diskstream (MidiDiskstream& ds, void *src)
_diskstream->set_io (*this);
_diskstream->set_destructive (_mode == Destructive);
- _diskstream->set_record_enabled (false, this);
+ _diskstream->set_record_enabled (false);
//_diskstream->monitor_input (false);
ic_connection.disconnect();
ic_connection = input_changed.connect (mem_fun (*_diskstream, &MidiDiskstream::handle_input_change));
- DiskstreamChanged (src); /* EMIT SIGNAL */
+ DiskstreamChanged (); /* EMIT SIGNAL */
return 0;
}
@@ -113,7 +113,7 @@ MidiTrack::use_diskstream (string name)
return -1;
}
- return set_diskstream (*dstream, this);
+ return set_diskstream (*dstream);
}
int
@@ -126,7 +126,7 @@ MidiTrack::use_diskstream (const PBD::ID& id)
return -1;
}
- return set_diskstream (*dstream, this);
+ return set_diskstream (*dstream);
}
bool
@@ -517,7 +517,7 @@ MidiTrack::set_name (string str, void *src)
return -1;
}
- if (_diskstream->set_name (str, src)) {
+ if (_diskstream->set_name (str)) {
return -1;
}
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 50d0033080..037c844324 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -39,13 +39,13 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-Change Region::FadeChanged = ARDOUR::new_change ();
+Change Region::FadeChanged = ARDOUR::new_change ();
Change Region::SyncOffsetChanged = ARDOUR::new_change ();
-Change Region::MuteChanged = ARDOUR::new_change ();
-Change Region::OpacityChanged = ARDOUR::new_change ();
-Change Region::LockChanged = ARDOUR::new_change ();
-Change Region::LayerChanged = ARDOUR::new_change ();
-Change Region::HiddenChanged = ARDOUR::new_change ();
+Change Region::MuteChanged = ARDOUR::new_change ();
+Change Region::OpacityChanged = ARDOUR::new_change ();
+Change Region::LockChanged = ARDOUR::new_change ();
+Change Region::LayerChanged = ARDOUR::new_change ();
+Change Region::HiddenChanged = ARDOUR::new_change ();
sigc::signal<void,Region *> Region::CheckNewRegion;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 95b5d0ddaf..713eed1b82 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -28,6 +28,7 @@
#include <ardour/timestamps.h>
#include <ardour/audioengine.h>
#include <ardour/route.h>
+#include <ardour/buffer.h>
#include <ardour/insert.h>
#include <ardour/send.h>
#include <ardour/session.h>
@@ -51,7 +52,7 @@ using namespace PBD;
uint32_t Route::order_key_cnt = 0;
-Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, Buffer::Type default_type)
+Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, DataType default_type)
: IO (sess, name, input_min, input_max, output_min, output_max, default_type),
_flags (flg),
_solo_control (*this, ToggleControllable::SoloControl),
@@ -1332,7 +1333,6 @@ Route::state(bool full_state)
node->add_property("flags", buf);
}
- // FIXME: assumes there's only audio and MIDI types
node->add_property("default-type", Buffer::type_to_string(_default_type));
node->add_property("active", _active?"yes":"no");
@@ -1511,7 +1511,7 @@ Route::set_state (const XMLNode& node)
if ((prop = node.property ("default-type")) != 0) {
_default_type = Buffer::type_from_string(prop->value());
- assert(_default_type != Buffer::NIL);
+ assert(_default_type != NIL);
}
if ((prop = node.property ("phase-invert")) != 0) {
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 011d1d6237..40457c33db 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -728,7 +728,7 @@ Session::when_engine_running ()
_master_out->defer_pan_reset ();
while ((int) _master_out->n_inputs() < _master_out->input_maximum()) {
- if (_master_out->add_input_port ("", this)) { // FIXME
+ if (_master_out->add_input_port ("", this, AUDIO)) {
error << _("cannot setup master inputs")
<< endmsg;
break;
@@ -736,7 +736,7 @@ Session::when_engine_running ()
}
n = 0;
while ((int) _master_out->n_outputs() < _master_out->output_maximum()) {
- if (_master_out->add_output_port (_engine.get_nth_physical_output (n), this)) { // FIXME
+ if (_master_out->add_output_port (_engine.get_nth_physical_output (n), this, AUDIO)) {
error << _("cannot setup master outputs")
<< endmsg;
break;
@@ -1763,7 +1763,7 @@ Session::new_midi_track (TrackMode mode)
track->set_control_outs (cports);
}
#endif
- track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes_proxy));
+ track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes));
add_route (track);
@@ -1808,7 +1808,7 @@ Session::new_midi_route ()
} while (n < (UINT_MAX-1));
try {
- shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::MIDI));
+ shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), MIDI));
if (bus->ensure_io (1, 1, false, this)) {
error << (_("cannot configure 1 in/1 out configuration for new midi track"))
@@ -1971,7 +1971,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
track->set_control_outs (cports);
}
- track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes_proxy));
+ track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes));
add_route (track);
@@ -2016,7 +2016,7 @@ Session::new_audio_route (int input_channels, int output_channels)
} while (n < (UINT_MAX-1));
try {
- shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::AUDIO));
+ shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), AUDIO));
if (bus->ensure_io (input_channels, output_channels, false, this)) {
error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"),
@@ -2487,7 +2487,6 @@ Session::diskstream_by_name (string name)
{
Glib::RWLock::ReaderLock lm (diskstream_lock);
- // FIXME: duh
for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->name() == name) {
return* i;
@@ -2502,7 +2501,6 @@ Session::diskstream_by_id (const PBD::ID& id)
{
Glib::RWLock::ReaderLock lm (diskstream_lock);
- // FIXME: duh
for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->id() == id) {
return *i;
@@ -3259,11 +3257,14 @@ Session::audition_playlist ()
}
void
-Session::audition_region (AudioRegion& r)
+Session::audition_region (Region& r)
{
- Event* ev = new Event (Event::Audition, Event::Add, Event::Immediate, 0, 0.0);
- ev->set_ptr (&r);
- queue_event (ev);
+ AudioRegion* ar = dynamic_cast<AudioRegion*>(&r);
+ if (ar) {
+ Event* ev = new Event (Event::Audition, Event::Add, Event::Immediate, 0, 0.0);
+ ev->set_ptr (ar);
+ queue_event (ev);
+ }
}
void
@@ -3360,18 +3361,6 @@ Session::n_diskstreams () const
}
return n;
}
-/*
-void
-Session::foreach_audio_diskstream (void (AudioDiskstream::*func)(void))
-{
- Glib::RWLock::ReaderLock lm (diskstream_lock);
- for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
- if (!(*i)->hidden()) {
- ((*i)->*func)();
- }
- }
-}
-*/
void
Session::graph_reordered ()
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0809aae6eb..f5bf0cc173 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -58,6 +58,7 @@
#include <ardour/audioengine.h>
#include <ardour/configuration.h>
#include <ardour/session.h>
+#include <ardour/buffer.h>
#include <ardour/audio_diskstream.h>
#include <ardour/midi_diskstream.h>
#include <ardour/utils.h>
@@ -1742,15 +1743,15 @@ Session::XMLRouteFactory (const XMLNode& node)
bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0);
- Buffer::Type type = Buffer::AUDIO;
+ DataType type = AUDIO;
const XMLProperty* prop = node.property("default-type");
if (prop)
type = Buffer::type_from_string(prop->value());
- assert(type != Buffer::NIL);
+ assert(type != NIL);
if (has_diskstream) {
- if (type == Buffer::AUDIO) {
+ if (type == AUDIO) {
boost::shared_ptr<Route> ret (new AudioTrack (*this, node));
return ret;
} else {
diff --git a/libs/ardour/smpte.cc b/libs/ardour/smpte.cc
deleted file mode 100644
index 9ee582b802..0000000000
--- a/libs/ardour/smpte.cc
+++ /dev/null
@@ -1,405 +0,0 @@
-/* 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.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#define SMPTE_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours)
-#define SMPTE_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes))
-
-#include <ardour/smpte.h>
-
-namespace SMPTE {
-
-FPS Time::default_rate = MTC_30_FPS;
-
-
-/** Increment @a smpte by exactly one frame (keep subframes value).
- * Realtime safe.
- * @return true if seconds wrap.
- */
-Wrap
-increment( Time& smpte )
-{
- Wrap wrap = NONE;
-
- if (smpte.negative) {
- if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
- // We have a zero transition involving only subframes
- smpte.subframes = 80 - smpte.subframes;
- smpte.negative = false;
- return SECONDS;
- }
-
- smpte.negative = false;
- wrap = decrement( smpte );
- if (!SMPTE_IS_ZERO( smpte )) {
- smpte.negative = true;
- }
- return wrap;
- }
-
- switch (smpte.rate) {
- case MTC_24_FPS:
- if (smpte.frames == 23) {
- smpte.frames = 0;
- wrap = SECONDS;
- }
- break;
- case MTC_25_FPS:
- if (smpte.frames == 24) {
- smpte.frames = 0;
- wrap = SECONDS;
- }
- break;
- case MTC_30_FPS_DROP:
- if (smpte.frames == 29) {
- if ( ((smpte.minutes + 1) % 10) && (smpte.seconds == 59) ) {
- smpte.frames = 2;
- }
- else {
- smpte.frames = 0;
- }
- wrap = SECONDS;
- }
- break;
- case MTC_30_FPS:
- if (smpte.frames == 29) {
- smpte.frames = 0;
- wrap = SECONDS;
- }
- break;
- }
-
- if (wrap == SECONDS) {
- if (smpte.seconds == 59) {
- smpte.seconds = 0;
- wrap = MINUTES;
- if (smpte.minutes == 59) {
- smpte.minutes = 0;
- wrap = HOURS;
- smpte.hours++;
- } else {
- smpte.minutes++;
- }
- } else {
- smpte.seconds++;
- }
- } else {
- smpte.frames++;
- }
-
- return wrap;
-}
-
-
-/** Decrement @a smpte by exactly one frame (keep subframes value)
- * Realtime safe.
- * @return true if seconds wrap. */
-Wrap
-decrement( Time& smpte )
-{
- Wrap wrap = NONE;
-
-
- if (smpte.negative || SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- wrap = increment( smpte );
- smpte.negative = true;
- return wrap;
- } else if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
- // We have a zero transition involving only subframes
- smpte.subframes = 80 - smpte.subframes;
- smpte.negative = true;
- return SECONDS;
- }
-
- switch (smpte.rate) {
- case MTC_24_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 23;
- wrap = SECONDS;
- }
- break;
- case MTC_25_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 24;
- wrap = SECONDS;
- }
- break;
- case MTC_30_FPS_DROP:
- if ((smpte.minutes % 10) && (smpte.seconds == 0)) {
- if (smpte.frames <= 2) {
- smpte.frames = 29;
- wrap = SECONDS;
- }
- } else if (smpte.frames == 0) {
- smpte.frames = 29;
- wrap = SECONDS;
- }
- break;
- case MTC_30_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 29;
- wrap = SECONDS;
- }
- break;
- }
-
- if (wrap == SECONDS) {
- if (smpte.seconds == 0) {
- smpte.seconds = 59;
- wrap = MINUTES;
- if (smpte.minutes == 0) {
- smpte.minutes = 59;
- wrap = HOURS;
- smpte.hours--;
- }
- else {
- smpte.minutes--;
- }
- } else {
- smpte.seconds--;
- }
- } else {
- smpte.frames--;
- }
-
- if (SMPTE_IS_ZERO( smpte )) {
- smpte.negative = false;
- }
-
- return wrap;
-}
-
-
-/** Go to lowest absolute subframe value in this frame (set to 0 :-) ) */
-void
-frames_floor( Time& smpte )
-{
- smpte.subframes = 0;
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
-}
-
-
-/** Increment @a smpte by one subframe */
-Wrap
-increment_subframes( Time& smpte )
-{
- Wrap wrap = NONE;
-
- if (smpte.negative) {
- smpte.negative = false;
- wrap = decrement_subframes( smpte );
- if (!SMPTE_IS_ZERO(smpte)) {
- smpte.negative = true;
- }
- return wrap;
- }
-
- smpte.subframes++;
- if (smpte.subframes >= 80) {
- smpte.subframes = 0;
- increment( smpte );
- return FRAMES;
- }
- return NONE;
-}
-
-
-/** Decrement @a smpte by one subframe */
-Wrap
-decrement_subframes( Time& smpte )
-{
- Wrap wrap = NONE;
-
- if (smpte.negative) {
- smpte.negative = false;
- wrap = increment_subframes( smpte );
- smpte.negative = true;
- return wrap;
- }
-
- if (smpte.subframes <= 0) {
- smpte.subframes = 0;
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = true;
- smpte.subframes = 1;
- return FRAMES;
- } else {
- decrement( smpte );
- smpte.subframes = 79;
- return FRAMES;
- }
- } else {
- smpte.subframes--;
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
- return NONE;
- }
-}
-
-
-/** Go to next whole second (frames == 0 or frames == 2) */
-Wrap
-increment_seconds( Time& smpte )
-{
- Wrap wrap = NONE;
-
- // Clear subframes
- frames_floor( smpte );
-
- if (smpte.negative) {
- // Wrap second if on second boundary
- wrap = increment(smpte);
- // Go to lowest absolute frame value
- seconds_floor( smpte );
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
- } else {
- // Go to highest possible frame in this second
- switch (smpte.rate) {
- case MTC_24_FPS:
- smpte.frames = 23;
- break;
- case MTC_25_FPS:
- smpte.frames = 24;
- break;
- case MTC_30_FPS_DROP:
- case MTC_30_FPS:
- smpte.frames = 29;
- break;
- }
-
- // Increment by one frame
- wrap = increment( smpte );
- }
-
- return wrap;
-}
-
-
-/** Go to lowest (absolute) frame value in this second
- * Doesn't care about positive/negative */
-void
-seconds_floor( Time& smpte )
-{
- // Clear subframes
- frames_floor( smpte );
-
- // Go to lowest possible frame in this second
- switch (smpte.rate) {
- case MTC_24_FPS:
- case MTC_25_FPS:
- case MTC_30_FPS:
- smpte.frames = 0;
- break;
- case MTC_30_FPS_DROP:
- if ((smpte.minutes % 10) && (smpte.seconds == 0)) {
- smpte.frames = 2;
- } else {
- smpte.frames = 0;
- }
- break;
- }
-
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
-}
-
-
-/** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
-Wrap
-increment_minutes( Time& smpte )
-{
- Wrap wrap = NONE;
-
- // Clear subframes
- frames_floor( smpte );
-
- if (smpte.negative) {
- // Wrap if on minute boundary
- wrap = increment_seconds( smpte );
- // Go to lowest possible value in this minute
- minutes_floor( smpte );
- } else {
- // Go to highest possible second
- smpte.seconds = 59;
- // Wrap minute by incrementing second
- wrap = increment_seconds( smpte );
- }
-
- return wrap;
-}
-
-
-/** Go to lowest absolute value in this minute */
-void
-minutes_floor( Time& smpte )
-{
- // Go to lowest possible second
- smpte.seconds = 0;
- // Go to lowest possible frame
- seconds_floor( smpte );
-
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
-}
-
-
-/** Go to next whole hour (minute = 0, second = 0, frame = 0) */
-Wrap
-increment_hours( Time& smpte )
-{
- Wrap wrap = NONE;
-
- // Clear subframes
- frames_floor(smpte);
-
- if (smpte.negative) {
- // Wrap if on hour boundary
- wrap = increment_minutes( smpte );
- // Go to lowest possible value in this hour
- hours_floor( smpte );
- } else {
- smpte.minutes = 59;
- wrap = increment_minutes( smpte );
- }
-
- return wrap;
-}
-
-
-/** Go to lowest absolute value in this hour */
-void
-hours_floor( Time& smpte )
-{
- smpte.minutes = 0;
- smpte.seconds = 0;
- smpte.frames = 0;
- smpte.subframes = 0;
-
- if (SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- }
-}
-
-
-} // namespace SMPTE
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index f3a177323c..3b3b705a87 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -20,8 +20,8 @@
#include <sigc++/retype_return.h>
#include <sigc++/bind.h>
-#include <ardour/audio_track.h>
-#include <ardour/audio_diskstream.h>
+#include <ardour/track.h>
+#include <ardour/diskstream.h>
#include <ardour/session.h>
#include <ardour/redirect.h>
#include <ardour/audioregion.h>
@@ -38,7 +38,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
-Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Buffer::Type default_type)
+Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, DataType default_type)
: Route (sess, name, 1, -1, -1, -1, flag, default_type)
, _diskstream (0)
, _rec_enable_control (*this)
@@ -49,7 +49,7 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Buff
_mode = mode;
}
-Track::Track (Session& sess, const XMLNode& node, Buffer::Type default_type)
+Track::Track (Session& sess, const XMLNode& node, DataType default_type)
: Route (sess, "to be renamed", 0, 0, -1, -1, Route::Flag(0), default_type)
, _diskstream (0)
, _rec_enable_control (*this)
@@ -59,6 +59,13 @@ Track::Track (Session& sess, const XMLNode& node, Buffer::Type default_type)
_saved_meter_point = _meter_point;
}
+Track::~Track ()
+{
+ if (_diskstream) {
+ _diskstream->unref();
+ }
+}
+
void
Track::set_meter_point (MeterPoint p, void *src)
{
@@ -134,3 +141,79 @@ Track::RecEnableControllable::get_value (void) const
return 0.0f;
}
+bool
+Track::record_enabled () const
+{
+ return _diskstream->record_enabled ();
+}
+
+void
+Track::set_record_enable (bool yn, void *src)
+{
+ if (_freeze_record.state == Frozen) {
+ return;
+ }
+
+ if (_mix_group && src != _mix_group && _mix_group->is_active()) {
+ _mix_group->apply (&Track::set_record_enable, yn, _mix_group);
+ return;
+ }
+
+ /* keep track of the meter point as it was before we rec-enabled */
+
+ if (!_diskstream->record_enabled()) {
+ _saved_meter_point = _meter_point;
+ }
+
+ _diskstream->set_record_enabled (yn);
+
+ if (_diskstream->record_enabled()) {
+ set_meter_point (MeterInput, this);
+ } else {
+ set_meter_point (_saved_meter_point, this);
+ }
+
+ _rec_enable_control.Changed ();
+}
+
+void
+Track::set_mode (TrackMode m)
+{
+ if (_diskstream) {
+ if (_mode != m) {
+ _mode = m;
+ _diskstream->set_destructive (m == Destructive);
+ ModeChanged();
+ }
+ }
+}
+
+int
+Track::set_name (string str, void *src)
+{
+ int ret;
+
+ if (record_enabled() && _session.actively_recording()) {
+ /* this messes things up if done while recording */
+ return -1;
+ }
+
+ if (_diskstream->set_name (str)) {
+ return -1;
+ }
+
+ /* save state so that the statefile fully reflects any filename changes */
+
+ if ((ret = IO::set_name (str, src)) == 0) {
+ _session.save_state ("");
+ }
+ return ret;
+}
+
+void
+Track::set_latency_delay (jack_nframes_t longest_session_latency)
+{
+ Route::set_latency_delay (longest_session_latency);
+ _diskstream->set_roll_delay (_roll_delay);
+}
+