21 #include "libardour-config.h"
45 #include <glib/gstdio.h>
46 #include <glibmm/miscutils.h>
47 #include <glibmm/fileutils.h>
48 #include <glibmm/threads.h>
51 #include "ardour/debug.h"
60 #include <AudioToolbox/ExtendedAudioFile.h>
61 #include <AudioToolbox/AudioFormat.h>
62 #endif // HAVE_COREAUDIO
71 string AudioFileSource::peak_dir =
"";
73 PBD::Signal0<void> AudioFileSource::HeaderPositionOffsetChanged;
74 framecnt_t AudioFileSource::header_position_offset = 0;
77 char AudioFileSource::bwf_serial_number[13] =
"000000000000";
101 if (
init (_path,
true)) {
115 if (
init (_path,
false)) {
123 AudioFileSource::AudioFileSource (
Session& s,
const string& path,
Source::Flag flags,
bool )
130 if (
init (_path,
true)) {
137 AudioFileSource::AudioFileSource (
Session& s,
const XMLNode& node,
bool must_exist)
155 ::g_unlink (
_path.c_str());
187 if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
201 ::rename (str.c_str(), peak_path.c_str());
208 #ifndef PLATFORM_WINDOWS // there's no old_peak_path() for windows
210 if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
230 struct stat stat_file;
231 struct stat stat_mount;
235 stat (audio_path.c_str(), &stat_file);
236 stat (mp.c_str(), &stat_mount);
240 snprintf (buf,
sizeof (buf),
"%llu-%llu-%d.peak",
241 (
unsigned long long)stat_mount.st_ino,
242 (
unsigned long long)stat_file.st_ino,
245 snprintf (buf,
sizeof (buf),
"%" PRId64
"-%" PRId64
"-%d.peak", (int64_t) stat_mount.st_ino, (int64_t) stat_file.st_ino,
_channel);
266 #ifdef HAVE_COREAUDIO
270 #endif // HAVE_COREAUDIO
280 snprintf (buf,
sizeof (buf),
"%u",
_channel);
317 return ::g_unlink (
peakpath.c_str());
354 const char* suffixes[] = {
378 #ifdef HAVE_COREAUDIO
391 #endif // HAVE_COREAUDIO
394 for (
size_t n = 0; n <
sizeof(suffixes)/
sizeof(suffixes[0]); ++n) {
395 if (file.rfind (suffixes[n]) == file.length() - strlen (suffixes[n])) {
413 if (ssb->
size < size) {
static int get_soundfile_info(const std::string &path, SoundFileInfo &_info, std::string &error_msg)
ARDOUR::Session & _session
std::string find_broken_peakfile(std::string missing_peak_path, std::string audio_path)
Glib::Threads::Mutex::Lock Lock
string mountpoint(string path)
LIBARDOUR_API uint64_t Destruction
static framecnt_t header_position_offset
void mark_streaming_write_completed(const Lock &lock)
std::string old_peak_path(std::string audio_path)
LIBARDOUR_API const char *const peakfile_suffix
int rename(const std::string &name)
virtual ~AudioFileSource()
int set_state(const XMLNode &, int version)
bool within_session() const
static bool safe_audio_file_extension(const std::string &path)
static std::string peak_dir
int initialize_peakfile(std::string path)
static PBD::Signal0< void > HeaderPositionOffsetChanged
int set_state(const XMLNode &, int version)
virtual void mark_streaming_write_completed(const Lock &lock)
int init(const std::string &idstr, bool must_exist)
#define DEBUG_TRACE(bits, str)
static int loading_state_version
static int get_soundfile_info(string path, SoundFileInfo &_info, string &error_msg)
virtual int init(const std::string &idstr, bool must_exist)
LIBPBD_API Transmitter info
static Sample * get_interleave_buffer(framecnt_t size)
static bool get_soundfile_info(std::string path, SoundFileInfo &_info, std::string &error)
std::string broken_peak_path(std::string audio_path)
static bool is_empty(Session &, std::string path)
XMLProperty * add_property(const char *name, const std::string &value)
LIBPBD_API Glib::ustring basename_nosuffix(Glib::ustring)
SizedSampleBuffer(framecnt_t sz)
static void set_header_position_offset(framecnt_t offset)
Glib::Threads::Private< SizedSampleBuffer > thread_interleave_buffer
int set_state(const XMLNode &, int version)
std::string peak_path(std::string) const
int set_state(const XMLNode &, int version)
int move_dependents_to_trash()
LIBARDOUR_API bool init(bool with_vst, bool try_optimization, const char *localedir)
std::string peak_path(std::string audio_path)
std::string string_compose(const std::string &fmt, const T1 &o1)