13
0

baby steps to virtualize AudioRegion

git-svn-id: svn://localhost/ardour2/trunk@1853 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-05-16 12:54:21 +00:00
parent 770dc73cde
commit 9b226f8eb6
5 changed files with 44 additions and 32 deletions

View File

@ -71,20 +71,20 @@ class AudioRegion : public Region
Curve& fade_out() { return _fade_out; }
Curve& envelope() { return _envelope; }
nframes_t read_peaks (PeakData *buf, nframes_t npeaks,
nframes_t offset, nframes_t cnt,
uint32_t chan_n=0, double samples_per_unit= 1.0) const;
virtual nframes_t read_peaks (PeakData *buf, nframes_t npeaks,
nframes_t offset, nframes_t cnt,
uint32_t chan_n=0, double samples_per_unit= 1.0) const;
virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf,
float *gain_buf, nframes_t position, nframes_t cnt,
uint32_t chan_n = 0,
nframes_t read_frames = 0,
nframes_t skip_frames = 0) const;
nframes_t master_read_at (Sample *buf, Sample *mixdown_buf,
float *gain_buf,
nframes_t position, nframes_t cnt, uint32_t chan_n=0) const;
float *gain_buf, nframes_t position, nframes_t cnt,
uint32_t chan_n = 0,
nframes_t read_frames = 0,
nframes_t skip_frames = 0) const;
virtual nframes_t master_read_at (Sample *buf, Sample *mixdown_buf,
float *gain_buf,
nframes_t position, nframes_t cnt, uint32_t chan_n=0) const;
XMLNode& state (bool);
int set_state (const XMLNode&);
@ -182,6 +182,8 @@ class AudioRegion : public Region
virtual bool verify_length (nframes_t);
/*virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;*/
virtual nframes_t read_raw_internal (Sample*, nframes_t, nframes_t) const;
};
} /* namespace ARDOUR */

View File

@ -141,6 +141,7 @@ CONFIG_VARIABLE (uint32_t, saved_history_depth, "save-history-depth", 100)
CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", false)
CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true)
CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)
CONFIG_VARIABLE (string, possible_audio_file_regexp, "possible-audio-file-regexp", "\\.(wav|aiff|caf|w64|L|R)$")
/* BWAV */

View File

@ -627,26 +627,29 @@ bool
AudioFileSource::safe_file_extension(ustring file)
{
return !(file.rfind(".wav") == ustring::npos &&
file.rfind(".aiff")== ustring::npos &&
file.rfind(".aif") == ustring::npos &&
file.rfind(".snd") == ustring::npos &&
file.rfind(".au") == ustring::npos &&
file.rfind(".raw") == ustring::npos &&
file.rfind(".sf") == ustring::npos &&
file.rfind(".cdr") == ustring::npos &&
file.rfind(".smp") == ustring::npos &&
file.rfind(".maud")== ustring::npos &&
file.rfind(".vwe") == ustring::npos &&
file.rfind(".paf") == ustring::npos &&
file.rfind(".aiff")== ustring::npos &&
file.rfind(".aif") == ustring::npos &&
file.rfind(".snd") == ustring::npos &&
file.rfind(".au") == ustring::npos &&
file.rfind(".raw") == ustring::npos &&
file.rfind(".sf") == ustring::npos &&
file.rfind(".cdr") == ustring::npos &&
file.rfind(".smp") == ustring::npos &&
file.rfind(".maud")== ustring::npos &&
file.rfind(".vwe") == ustring::npos &&
file.rfind(".paf") == ustring::npos &&
/* protools convention */
file.rfind(".L") == ustring::npos &&
file.rfind(".R") == ustring::npos &&
#ifdef HAVE_FLAC
file.rfind(".flac")== ustring::npos &&
file.rfind(".flac")== ustring::npos &&
#endif // HAVE_FLAC
#ifdef HAVE_COREAUDIO
file.rfind(".mp3") == ustring::npos &&
file.rfind(".aac") == ustring::npos &&
file.rfind(".mp4") == ustring::npos &&
file.rfind(".mp3") == ustring::npos &&
file.rfind(".aac") == ustring::npos &&
file.rfind(".mp4") == ustring::npos &&
#endif // HAVE_COREAUDIO
file.rfind(".voc") == ustring::npos);
file.rfind(".voc") == ustring::npos);
}
void

View File

@ -981,6 +981,12 @@ AudioRegion::apply (AudioFilter& filter)
return filter.run (ar);
}
nframes_t
AudioRegion::read_raw_internal (Sample* buf, nframes_t pos, nframes_t cnt) const
{
return audio_source()->read (buf, pos, cnt);
}
int
AudioRegion::exportme (Session& session, AudioExportSpecification& spec)
{
@ -1006,7 +1012,7 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec)
if (spec.channels == 1) {
if (audio_source()->read (spec.dataF, _start + spec.pos, to_read) != to_read) {
if (read_raw_internal (spec.dataF, _start + spec.pos, to_read) != to_read) {
goto out;
}
@ -1096,7 +1102,7 @@ AudioRegion::normalize_to (float target_dB)
/* read it in */
if (audio_source (n)->read (buf, fpos, to_read) != to_read) {
if (read_raw_internal (buf, fpos, to_read) != to_read) {
return;
}

View File

@ -3501,7 +3501,7 @@ Session::remove_empty_sounds ()
{
PathScanner scanner;
vector<string *>* possible_audiofiles = scanner (sound_dir(), "\\.(wav|aiff|caf|w64|L|R)$", false, true);
vector<string *>* possible_audiofiles = scanner (sound_dir(), Config->get_possible_audio_file_regexp (), false, true);
Glib::Mutex::Lock lm (source_lock);