mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 22:55:44 +01:00
fix uninitialized export_range_dialog member in editor; fix peakfile naming screwup with back-compatible hack
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2462 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
71df552f0a
commit
077a598232
7 changed files with 90 additions and 36 deletions
|
|
@ -270,6 +270,7 @@ Editor::Editor ()
|
|||
_show_waveforms_recording = true;
|
||||
first_action_message = 0;
|
||||
export_dialog = 0;
|
||||
export_range_markers_dialog = 0;
|
||||
show_gain_after_trim = false;
|
||||
ignore_route_list_reorder = false;
|
||||
no_route_list_redisplay = false;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class AudioFileSource : public AudioSource {
|
|||
|
||||
Glib::ustring path() const { return _path; }
|
||||
Glib::ustring peak_path (Glib::ustring audio_path);
|
||||
Glib::ustring old_peak_path (Glib::ustring audio_path);
|
||||
Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, Glib::ustring audio_path);
|
||||
|
||||
uint16_t channel() const { return _channel; }
|
||||
|
||||
|
|
@ -165,6 +165,11 @@ class AudioFileSource : public AudioSource {
|
|||
bool find (Glib::ustring& path, bool must_exist, bool& is_new, uint16_t& chan);
|
||||
bool removable() const;
|
||||
bool writable() const { return _flags & Writable; }
|
||||
|
||||
private:
|
||||
Glib::ustring old_peak_path (Glib::ustring audio_path);
|
||||
Glib::ustring broken_peak_path (Glib::ustring audio_path);
|
||||
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
using std::list;
|
||||
using std::vector;
|
||||
using Glib::ustring;
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
|
|
@ -49,7 +48,7 @@ const nframes_t frames_per_peak = 256;
|
|||
class AudioSource : public Source, public boost::enable_shared_from_this<ARDOUR::AudioSource>
|
||||
{
|
||||
public:
|
||||
AudioSource (Session&, ustring name);
|
||||
AudioSource (Session&, Glib::ustring name);
|
||||
AudioSource (Session&, const XMLNode&);
|
||||
virtual ~AudioSource ();
|
||||
|
||||
|
|
@ -78,8 +77,8 @@ const nframes_t frames_per_peak = 256;
|
|||
|
||||
virtual bool can_truncate_peaks() const { return true; }
|
||||
|
||||
void set_captured_for (ustring str) { _captured_for = str; }
|
||||
ustring captured_for() const { return _captured_for; }
|
||||
void set_captured_for (Glib::ustring str) { _captured_for = str; }
|
||||
Glib::ustring captured_for() const { return _captured_for; }
|
||||
|
||||
uint32_t read_data_count() const { return _read_data_count; }
|
||||
uint32_t write_data_count() const { return _write_data_count; }
|
||||
|
|
@ -94,7 +93,7 @@ const nframes_t frames_per_peak = 256;
|
|||
XMLNode& get_state ();
|
||||
int set_state (const XMLNode&);
|
||||
|
||||
int rename_peakfile (ustring newpath);
|
||||
int rename_peakfile (Glib::ustring newpath);
|
||||
void touch_peakfile ();
|
||||
|
||||
static void set_build_missing_peakfiles (bool yn) {
|
||||
|
|
@ -118,13 +117,13 @@ const nframes_t frames_per_peak = 256;
|
|||
mutable Glib::Mutex _lock;
|
||||
mutable Glib::Mutex _peaks_ready_lock;
|
||||
nframes_t _length;
|
||||
ustring peakpath;
|
||||
ustring _captured_for;
|
||||
Glib::ustring peakpath;
|
||||
Glib::ustring _captured_for;
|
||||
|
||||
mutable uint32_t _read_data_count; // modified in read()
|
||||
mutable uint32_t _write_data_count; // modified in write()
|
||||
|
||||
int initialize_peakfile (bool newfile, ustring path);
|
||||
int initialize_peakfile (bool newfile, Glib::ustring path);
|
||||
int build_peaks_from_scratch ();
|
||||
int compute_and_write_peaks (Sample* buf, nframes_t first_frame, nframes_t cnt, bool force, bool intermediate_peaks_ready_signal);
|
||||
void truncate_peakfile();
|
||||
|
|
@ -133,8 +132,8 @@ const nframes_t frames_per_peak = 256;
|
|||
|
||||
virtual nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const = 0;
|
||||
virtual nframes_t write_unlocked (Sample *dst, nframes_t cnt) = 0;
|
||||
virtual ustring peak_path(ustring audio_path) = 0;
|
||||
virtual ustring old_peak_path(ustring audio_path) = 0;
|
||||
virtual Glib::ustring peak_path(Glib::ustring audio_path) = 0;
|
||||
virtual Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, Glib::ustring audio_path) = 0;
|
||||
|
||||
void update_length (nframes_t pos, nframes_t cnt);
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ const nframes_t frames_per_peak = 256;
|
|||
Sample* peak_leftovers;
|
||||
nframes_t peak_leftover_frame;
|
||||
|
||||
bool file_changed (ustring path);
|
||||
bool file_changed (Glib::ustring path);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class Session : public PBD::StatefulDestructible
|
|||
std::string dead_sound_dir () const;
|
||||
std::string automation_dir () const;
|
||||
|
||||
string peak_path_from_audio_path (string) const;
|
||||
Glib::ustring peak_path (Glib::ustring) const;
|
||||
|
||||
static string suffixed_search_path (std::string suffix, bool data);
|
||||
static string control_protocol_path ();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h> // for rename(), sigh
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -154,13 +155,64 @@ AudioFileSource::init (ustring pathstr, bool must_exist)
|
|||
|
||||
ustring
|
||||
AudioFileSource::peak_path (ustring audio_path)
|
||||
{
|
||||
ustring base;
|
||||
|
||||
base = PBD::basename_nosuffix (audio_path);
|
||||
base += '%';
|
||||
base += (char) ('A' + _channel);
|
||||
|
||||
return _session.peak_path (base);
|
||||
}
|
||||
|
||||
ustring
|
||||
AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path)
|
||||
{
|
||||
ustring str;
|
||||
|
||||
/* check for the broken location in use by 2.0 for several months */
|
||||
|
||||
str = broken_peak_path (audio_path);
|
||||
|
||||
if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
|
||||
|
||||
if (is_embedded()) {
|
||||
|
||||
/* it would be nice to rename it but the nature of
|
||||
the bug means that we can't reliably use it.
|
||||
*/
|
||||
|
||||
peak_path = str;
|
||||
|
||||
} else {
|
||||
/* all native files are mono, so we can just rename
|
||||
it.
|
||||
*/
|
||||
::rename (str.c_str(), peak_path.c_str());
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Nasty band-aid for older sessions that were created before we
|
||||
used libsndfile for all audio files.
|
||||
*/
|
||||
|
||||
|
||||
str = old_peak_path (audio_path);
|
||||
if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
|
||||
peak_path = str;
|
||||
}
|
||||
}
|
||||
|
||||
return peak_path;
|
||||
}
|
||||
|
||||
ustring
|
||||
AudioFileSource::broken_peak_path (ustring audio_path)
|
||||
{
|
||||
ustring res;
|
||||
|
||||
res = _session.peak_dir ();
|
||||
res += PBD::basename_nosuffix (audio_path);
|
||||
res += '%';
|
||||
res += (char) ('A' + _channel);
|
||||
res += ".peak";
|
||||
|
||||
return res;
|
||||
|
|
@ -607,14 +659,15 @@ AudioFileSource::set_name (ustring newname, bool destructive)
|
|||
bool
|
||||
AudioFileSource::is_empty (Session& s, ustring path)
|
||||
{
|
||||
bool ret = false;
|
||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (s, path, 0, NoPeakFile, false));
|
||||
|
||||
if (afs) {
|
||||
ret = (afs->length() == 0);
|
||||
SoundFileInfo info;
|
||||
string err;
|
||||
|
||||
if (!get_soundfile_info (path, info, err)) {
|
||||
/* dangerous: we can't get info, so assume that its not empty */
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return info.length == 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using Glib::ustring;
|
||||
|
||||
bool AudioSource::_build_missing_peakfiles = false;
|
||||
bool AudioSource::_build_peakfiles = false;
|
||||
|
|
@ -185,15 +186,10 @@ AudioSource::initialize_peakfile (bool newfile, ustring audio_path)
|
|||
|
||||
peakpath = peak_path (audio_path);
|
||||
|
||||
/* Nasty band-aid for older sessions that were created before we
|
||||
used libsndfile for all audio files.
|
||||
*/
|
||||
/* if the peak file should be there, but isn't .... */
|
||||
|
||||
if (!newfile && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
|
||||
ustring str = old_peak_path (audio_path);
|
||||
if (access (str.c_str(), R_OK) == 0) {
|
||||
peakpath = str;
|
||||
}
|
||||
peakpath = find_broken_peakfile (peakpath, audio_path);
|
||||
}
|
||||
|
||||
if (newfile) {
|
||||
|
|
|
|||
|
|
@ -2884,13 +2884,13 @@ Session::source_by_path_and_channel (const Glib::ustring& path, uint16_t chn)
|
|||
return boost::shared_ptr<Source>();
|
||||
}
|
||||
|
||||
string
|
||||
Session::peak_path_from_audio_path (string audio_path) const
|
||||
Glib::ustring
|
||||
Session::peak_path (Glib::ustring base) const
|
||||
{
|
||||
string res;
|
||||
|
||||
Glib::ustring res;
|
||||
|
||||
res = peak_dir ();
|
||||
res += PBD::basename_nosuffix (audio_path);
|
||||
res += base;
|
||||
res += ".peak";
|
||||
|
||||
return res;
|
||||
|
|
@ -3327,12 +3327,12 @@ Session::remove_empty_sounds ()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (AudioFileSource::is_empty (*this, *(*i))) {
|
||||
if (AudioFileSource::is_empty (*this, **i)) {
|
||||
|
||||
unlink ((*i)->c_str());
|
||||
|
||||
string peak_path = peak_path_from_audio_path (**i);
|
||||
unlink (peak_path.c_str());
|
||||
Glib::ustring peakpath = peak_path (PBD::basename_nosuffix (**i));
|
||||
unlink (peakpath.c_str());
|
||||
}
|
||||
|
||||
delete* i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue