summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-30 03:25:38 +0000
committerDavid Robillard <d@drobilla.net>2006-07-30 03:25:38 +0000
commit9d5d82b4df5b3510177fd31557ac765f46778fe8 (patch)
treeb0b786f4f8fcee4e76c7c3ab1a66f603c08de070 /libs/ardour/ardour
parent8277d134b9733aee344782891c99f07114384d9e (diff)
Abstraction cleanups/polish, towards merging with trunk
git-svn-id: svn://localhost/ardour2/branches/midi@720 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_diskstream.h93
-rw-r--r--libs/ardour/ardour/diskstream.h62
-rw-r--r--libs/ardour/ardour/midi_diskstream.h22
-rw-r--r--libs/ardour/ardour/playlist.h17
-rw-r--r--libs/ardour/ardour/region.h2
-rw-r--r--libs/ardour/ardour/session.h2
6 files changed, 64 insertions, 134 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index c4a942a5d7..ec15cf1caf 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000 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
@@ -14,8 +14,6 @@
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: diskstream.h 579 2006-06-12 19:56:37Z essej $
*/
#ifndef __ardour_audio_diskstream_h__
@@ -62,18 +60,12 @@ class AudioDiskstream : public Diskstream
AudioDiskstream (Session &, const string& name, Diskstream::Flag f = Recordable);
AudioDiskstream (Session &, const XMLNode&);
- void set_io (ARDOUR::IO& io);
-
+ // FIXME
AudioDiskstream& 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);
-
string input_source (uint32_t n=0) const {
if (n < channels.size()) {
return channels[n].source ? channels[n].source->name() : "";
@@ -87,7 +79,6 @@ class AudioDiskstream : public Diskstream
}
void set_record_enabled (bool yn, void *src);
- //void set_speed (double);
float peak_power(uint32_t n=0) {
float x = channels[n].peak_power;
@@ -98,16 +89,13 @@ class AudioDiskstream : public Diskstream
return minus_infinity();
}
}
+
+ AudioPlaylist* audio_playlist () { return dynamic_cast<AudioPlaylist*>(_playlist); }
int use_playlist (Playlist *);
int use_new_playlist ();
int use_copy_playlist ();
- void start_scrub (jack_nframes_t where) {} // FIXME?
- void end_scrub () {} // FIXME?
-
- Playlist *playlist () { return _playlist; }
-
Sample *playback_buffer (uint32_t n=0) {
if (n < channels.size())
return channels[n].current_playback_buffer;
@@ -137,7 +125,6 @@ class AudioDiskstream : public Diskstream
void monitor_input (bool);
- // FIXME: these don't belong here
static void swap_by_ptr (Sample *first, Sample *last) {
while (first < last) {
Sample tmp = *first;
@@ -154,11 +141,6 @@ class AudioDiskstream : public Diskstream
}
}
- //void handle_input_change (IOChange, void *src);
-
- //static sigc::signal<void> DiskOverrun;
- //static sigc::signal<void> DiskUnderrun;
- //static sigc::signal<void,AudioDiskstream*> AudioDiskstreamCreated; // XXX use a ref with sigc2
static sigc::signal<void,list<AudioFileSource*>*> DeleteSources;
int set_loop (Location *loc);
@@ -168,8 +150,6 @@ class AudioDiskstream : public Diskstream
return _last_capture_regions;
}
- void handle_input_change (IOChange, void *src);
-
const PBD::ID& id() const { return _id; }
XMLNode* deprecated_io_node;
@@ -184,7 +164,6 @@ class AudioDiskstream : public Diskstream
void set_pending_overwrite(bool);
int overwrite_existing_buffers ();
- void reverse_scrub_buffer (bool to_forward) {} // FIXME?
void set_block_size (jack_nframes_t);
int internal_playback_seek (jack_nframes_t distance);
int can_internal_playback_seek (jack_nframes_t distance);
@@ -237,60 +216,30 @@ class AudioDiskstream : public Diskstream
jack_nframes_t curr_capture_cnt;
};
- typedef vector<ChannelInfo> ChannelList;
-
- /* the two central butler operations */
-
- int do_flush (char * workbuf, bool force = false);
- int do_refill (Sample *mixdown_buffer, float *gain_buffer, char *workbuf);
+ /* 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); }
- virtual int non_realtime_do_refill() { return do_refill(0, 0, 0); }
+ int do_refill_with_alloc();
- int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, char * workbuf, jack_nframes_t& start, jack_nframes_t cnt,
- ChannelInfo& channel_info, int channel, bool reversed);
-
- /* XXX fix this redundancy ... */
-
- //void playlist_changed (Change);
- //void playlist_modified ();
- void playlist_deleted (Playlist*);
- void session_controls_changed (Session::ControlType) {} // FIXME?
+ int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, char * workbuf,
+ jack_nframes_t& start, jack_nframes_t cnt,
+ ChannelInfo& channel_info, int channel, bool reversed);
void finish_capture (bool rec_monitors_input);
- void clean_up_capture (struct tm&, time_t, bool abort) {} // FIXME?
void transport_stopped (struct tm&, time_t, bool abort);
- struct CaptureInfo {
- uint32_t start;
- uint32_t frames;
- };
-
- vector<CaptureInfo*> capture_info;
- Glib::Mutex capture_info_lock;
-
void init (Diskstream::Flag);
void init_channel (ChannelInfo &chan);
void destroy_channel (ChannelInfo &chan);
int use_new_write_source (uint32_t n=0);
- int use_new_fade_source (uint32_t n=0) { return 0; } // FIXME?
int find_and_use_playlist (const string&);
void allocate_temporary_buffers ();
- int create_input_port () { return 0; } // FIXME?
- int connect_input_port () { return 0; } // FIXME?
- int seek_unlocked (jack_nframes_t which_sample) { return 0; } // FIXME?
-
- int ports_created () { return 0; } // FIXME?
-
- //bool realtime_set_speed (double, bool global_change);
- void non_realtime_set_speed ();
-
- std::list<Region*> _last_capture_regions;
- std::vector<AudioFileSource*> capturing_sources;
int use_pending_capture_data (XMLNode& node);
void get_input_sources ();
@@ -299,10 +248,26 @@ class AudioDiskstream : public Diskstream
void setup_destructive_playlist ();
void use_destructive_playlist ();
- ChannelList channels;
- AudioPlaylist* _playlist;
void engage_record_enable (void* src);
void disengage_record_enable (void* src);
+
+ // Working buffers for do_refill (butler thread)
+ static void allocate_working_buffers();
+ static void free_working_buffers();
+
+ 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);
+
+
+ std::vector<AudioFileSource*> capturing_sources;
+
+ typedef vector<ChannelInfo> ChannelList;
+ ChannelList channels;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index b595879264..ff25127ec9 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000 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
@@ -52,7 +52,6 @@ class AudioEngine;
class Send;
class Session;
class Playlist;
-//class FileSource;
class IO;
/* FIXME: There are (obviously) far too many virtual functions in this ATM.
@@ -71,10 +70,10 @@ class Diskstream : public Stateful, public sigc::trackable
virtual int set_name (string str, void* src);
ARDOUR::IO* io() const { return _io; }
- virtual void set_io (ARDOUR::IO& io) = 0;
+ void set_io (ARDOUR::IO& io);
virtual Diskstream& ref() { _refcnt++; return *this; }
- void unref() { if (_refcnt) _refcnt--; if (_refcnt == 0) delete this; }
+ void unref() { if (_refcnt) _refcnt--; if (_refcnt == 0) delete this; }
uint32_t refcnt() const { return _refcnt; }
virtual float playback_buffer_load() const = 0;
@@ -105,17 +104,15 @@ class Diskstream : public Stateful, public sigc::trackable
virtual void punch_in() {}
virtual void punch_out() {}
- virtual void set_speed (double);
- virtual void non_realtime_set_speed () = 0;
+ void set_speed (double);
+ void non_realtime_set_speed ();
- virtual Playlist *playlist () = 0;
+ Playlist* playlist () { return _playlist; }
+
+ virtual int use_playlist (Playlist *);
virtual int use_new_playlist () = 0;
- virtual int use_playlist (Playlist *) = 0;
virtual int use_copy_playlist () = 0;
- virtual void start_scrub (jack_nframes_t where) = 0;
- virtual void end_scrub () = 0;
-
jack_nframes_t current_capture_start() const { return capture_start_frame; }
jack_nframes_t current_capture_end() const { return capture_start_frame + capture_captured; }
jack_nframes_t get_capture_start_frame (uint32_t n=0);
@@ -123,7 +120,7 @@ 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 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 */
@@ -144,7 +141,7 @@ class Diskstream : public Stateful, public sigc::trackable
std::list<Region*>& last_capture_regions () { return _last_capture_regions; }
- virtual void handle_input_change (IOChange, void *src);
+ void handle_input_change (IOChange, void *src);
sigc::signal<void,void*> RecordEnableChanged;
sigc::signal<void> SpeedChanged;
@@ -170,7 +167,6 @@ class Diskstream : public Stateful, public sigc::trackable
virtual void set_pending_overwrite (bool) = 0;
virtual int overwrite_existing_buffers () = 0;
- virtual void reverse_scrub_buffer (bool to_forward) = 0;
virtual void set_block_size (jack_nframes_t) = 0;
virtual int internal_playback_seek (jack_nframes_t distance) = 0;
virtual int can_internal_playback_seek (jack_nframes_t distance) = 0;
@@ -209,25 +205,21 @@ class Diskstream : public Stateful, public sigc::trackable
jack_nframes_t capture_val;
};
- /* the two central butler operations */
-
- virtual int do_flush (char * workbuf, bool force = false) = 0;
- //int do_refill (Sample *mixdown_buffer, float *gain_buffer, char *workbuf);
+ /* The two central butler operations */
+ virtual int do_flush (Session::RunContext context, bool force = false) = 0;
+ virtual int do_refill () = 0;
- virtual int non_realtime_do_refill() = 0;
+ /** For non-butler contexts (allocates temporary working buffers) */
+ virtual int do_refill_with_alloc() = 0;
- //int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, char * workbuf, jack_nframes_t& start, jack_nframes_t cnt,
- // ChannelInfo& channel_info, int channel, bool reversed);
/* XXX fix this redundancy ... */
virtual void playlist_changed (Change);
virtual void playlist_modified ();
- virtual void playlist_deleted (Playlist*) = 0;
- virtual void session_controls_changed (Session::ControlType) = 0;
+ virtual void playlist_deleted (Playlist*);
virtual void finish_capture (bool rec_monitors_input) = 0;
- virtual void clean_up_capture (struct tm&, time_t, bool abort) = 0;
virtual void transport_stopped (struct tm&, time_t, bool abort) = 0;
struct CaptureInfo {
@@ -237,37 +229,23 @@ class Diskstream : public Stateful, public sigc::trackable
virtual void init (Flag);
- //void init_channel (ChannelInfo &chan);
- //void destroy_channel (ChannelInfo &chan);
-
virtual int use_new_write_source (uint32_t n=0) = 0;
- virtual int use_new_fade_source (uint32_t n=0) = 0;
virtual int find_and_use_playlist (const string&) = 0;
- //void allocate_temporary_buffers ();
-
- virtual int create_input_port () = 0;
- virtual int connect_input_port () = 0;
- virtual int seek_unlocked (jack_nframes_t which_sample) = 0;
-
- virtual int ports_created () = 0;
+ virtual void allocate_temporary_buffers () = 0;
virtual bool realtime_set_speed (double, bool global_change);
- //void non_realtime_set_speed ();
std::list<Region*> _last_capture_regions;
- //std::vector<FileSource*> capturing_sources;
virtual int use_pending_capture_data (XMLNode& node) = 0;
virtual void get_input_sources () = 0;
virtual void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record) = 0;
- //void set_align_style_from_io();
+ virtual void set_align_style_from_io() {}
virtual void setup_destructive_playlist () = 0;
- //void use_destructive_playlist ();
+ virtual void use_destructive_playlist () = 0;
- // Wouldn't hurt for this thing to do on a diet:
-
static jack_nframes_t disk_io_chunk_frames;
vector<CaptureInfo*> capture_info;
Glib::Mutex capture_info_lock;
@@ -279,6 +257,7 @@ class Diskstream : public Stateful, public sigc::trackable
ARDOUR::IO* _io;
uint32_t _n_channels;
PBD::ID _id;
+ Playlist* _playlist;
mutable gint _record_enabled;
double _visible_speed;
@@ -338,7 +317,6 @@ class Diskstream : public Stateful, public sigc::trackable
sigc::connection plgone_connection;
unsigned char _flags;
-
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index b6121d1176..5998363d69 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -80,9 +80,6 @@ class MidiDiskstream : public Diskstream
int use_new_playlist ();
int use_copy_playlist ();
- void start_scrub (jack_nframes_t where) {} // FIXME?
- void end_scrub () {} // FIXME?
-
Playlist *playlist () { return _playlist; }
static sigc::signal<void,list<SMFSource*>*> DeleteSources;
@@ -106,7 +103,6 @@ class MidiDiskstream : public Diskstream
void set_pending_overwrite(bool);
int overwrite_existing_buffers ();
- void reverse_scrub_buffer (bool to_forward) {} // FIXME?
void set_block_size (jack_nframes_t);
int internal_playback_seek (jack_nframes_t distance);
int can_internal_playback_seek (jack_nframes_t distance);
@@ -134,12 +130,11 @@ class MidiDiskstream : public Diskstream
MidiPlaylist* _playlist;
- /* the two central butler operations */
-
- int do_flush (char * workbuf, bool force = false);
- int do_refill (RawMidi *mixdown_buffer, float *gain_buffer, char *workbuf);
+ /*Tthe two central butler operations */
+ int do_flush (Session::RunContext context, bool force = false) { return 0; }
+ int do_refill () { return 0; }
- virtual int non_realtime_do_refill() { return do_refill(0, 0, 0); }
+ 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);
@@ -148,10 +143,8 @@ class MidiDiskstream : public Diskstream
//void playlist_changed (Change);
//void playlist_modified ();
void playlist_deleted (Playlist*);
- void session_controls_changed (Session::ControlType) {} // FIXME?
void finish_capture (bool rec_monitors_input);
- void clean_up_capture (struct tm&, time_t, bool abort) {} // FIXME?
void transport_stopped (struct tm&, time_t, bool abort);
struct CaptureInfo {
@@ -162,18 +155,11 @@ class MidiDiskstream : public Diskstream
void init (Diskstream::Flag);
int use_new_write_source (uint32_t n=0);
- int use_new_fade_source (uint32_t n=0) { return 0; } // FIXME?
int find_and_use_playlist (const string&);
void allocate_temporary_buffers ();
- int create_input_port () { return 0; } // FIXME?
- int connect_input_port () { return 0; } // FIXME?
- int seek_unlocked (jack_nframes_t which_sample) { return 0; } // FIXME?
-
- int ports_created () { return 0; } // FIXME?
-
//bool realtime_set_speed (double, bool global_change);
void non_realtime_set_speed ();
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index ca760a5ad5..add253982f 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -110,16 +110,15 @@ class Playlist : public Stateful, public StateManager {
int set_state (const XMLNode&);
XMLNode& get_template ();
- sigc::signal<void,Region *> RegionAdded;
- sigc::signal<void,Region *> RegionRemoved;
-
+ sigc::signal<void,Region *> RegionAdded;
+ sigc::signal<void,Region *> RegionRemoved;
sigc::signal<void,Playlist*,bool> InUse;
- sigc::signal<void> Modified;
- sigc::signal<void> NameChanged;
- sigc::signal<void> LengthChanged;
- sigc::signal<void> LayeringChanged;
- sigc::signal<void,Playlist *> GoingAway;
- sigc::signal<void> StatePushed;
+ sigc::signal<void> Modified;
+ sigc::signal<void> NameChanged;
+ sigc::signal<void> LengthChanged;
+ sigc::signal<void> LayeringChanged;
+ sigc::signal<void,Playlist *> GoingAway;
+ sigc::signal<void> StatePushed;
static sigc::signal<void,Playlist*> PlaylistCreated;
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 68ac55df67..a138f66042 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -145,6 +145,8 @@ class Region : public Stateful, public StateManager
bool overlap_equivalent (const Region&) const;
bool region_list_equivalent (const Region&) const;
virtual bool source_equivalent (const Region&) const = 0;
+
+ 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,
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 7bd24b96cc..dd8ec4806a 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -938,7 +938,7 @@ class Session : public sigc::trackable, public Stateful
/* buffers for gain and pan */
gain_t* gain_automation_buffer () const { return _gain_automation_buffer; }
- pan_t** pan_automation_buffer() const { return _pan_automation_buffer; }
+ pan_t** pan_automation_buffer () const { return _pan_automation_buffer; }
/* buffers for conversion */
enum RunContext {