diff options
author | David Robillard <d@drobilla.net> | 2007-03-18 06:07:08 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-03-18 06:07:08 +0000 |
commit | 99904735e066804358f1d0bd138a84f1e9ecda91 (patch) | |
tree | 71a924cf1660b5b00231275bd481bbd27094dd9b /libs/ardour/ardour/audiofilesource.h | |
parent | eb270e70a12c410cdd98585ad25bb6d8e384a4f5 (diff) |
Merged with trunk R1612.
git-svn-id: svn://localhost/ardour2/branches/midi@1614 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/audiofilesource.h')
-rw-r--r-- | libs/ardour/ardour/audiofilesource.h | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 0e1caf5245..913cd7d5ed 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -20,12 +20,19 @@ #ifndef __ardour_audiofilesource_h__ #define __ardour_audiofilesource_h__ +#include <exception> + #include <time.h> #include <ardour/audiosource.h> namespace ARDOUR { +class non_existent_source : public std::exception { + public: + virtual const char *what() const throw() { return "audio file does not exist"; } +}; + struct SoundFileInfo { float samplerate; uint16_t channels; @@ -49,17 +56,19 @@ class AudioFileSource : public AudioSource { virtual ~AudioFileSource (); - int set_name (string newname, bool destructive); + int set_name (Glib::ustring newname, bool destructive); + + Glib::ustring path() const { return _path; } + Glib::ustring peak_path (Glib::ustring audio_path); + Glib::ustring old_peak_path (Glib::ustring audio_path); - string path() const { return _path; } - string peak_path (string audio_path); - string old_peak_path (string audio_path); + uint16_t channel() const { return _channel; } - static void set_peak_dir (string dir) { peak_dir = dir; } + static void set_peak_dir (Glib::ustring dir) { peak_dir = dir; } - static bool get_soundfile_info (string path, SoundFileInfo& _info, string& error); + static bool get_soundfile_info (Glib::ustring path, SoundFileInfo& _info, std::string& error); - static bool safe_file_extension (string path); + static bool safe_file_extension (Glib::ustring path); void set_allow_remove_if_empty (bool yn); void mark_for_remove(); @@ -76,19 +85,19 @@ class AudioFileSource : public AudioSource { virtual int update_header (nframes_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; - int move_to_trash (const string trash_dir_name); + int move_to_trash (const Glib::ustring& trash_dir_name); - static bool is_empty (Session&, string path); + static bool is_empty (Session&, Glib::ustring path); void mark_streaming_write_completed (); - void mark_take (string); - string take_id() const { return _take_id; } + void mark_take (Glib::ustring); + Glib::ustring take_id() const { return _take_id; } bool is_embedded() const { return _is_embedded; } static void set_bwf_serial_number (int); - static void set_search_path (string); + static void set_search_path (Glib::ustring string); static void set_header_position_offset (nframes_t offset ); int setup_peakfile (); @@ -100,6 +109,7 @@ class AudioFileSource : public AudioSource { bool destructive() const { return (_flags & Destructive); } virtual bool set_destructive (bool yn) { return false; } + bool can_truncate_peaks() const { return !destructive(); } Flag flags() const { return _flags; } @@ -116,31 +126,31 @@ class AudioFileSource : public AudioSource { /* constructor to be called for existing external-to-session files */ - AudioFileSource (Session&, std::string path, Flag flags); + AudioFileSource (Session&, Glib::ustring path, Flag flags); /* constructor to be called for new in-session files */ - AudioFileSource (Session&, std::string path, Flag flags, + AudioFileSource (Session&, Glib::ustring path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format); /* constructor to be called for existing in-session files */ - AudioFileSource (Session&, const XMLNode&); + AudioFileSource (Session&, const XMLNode&, bool must_exit = true); - int init (string idstr, bool must_exist); + int init (Glib::ustring idstr, bool must_exist); - string _path; + Glib::ustring _path; Flag _flags; - string _take_id; + Glib::ustring _take_id; int64_t timeline_position; bool file_is_new; - uint16_t channel; + uint16_t _channel; bool _is_embedded; - static bool determine_embeddedness(string path); + static bool determine_embeddedness(Glib::ustring path); - static string peak_dir; - static string search_path; + static Glib::ustring peak_dir; + static Glib::ustring search_path; static char bwf_country_code[3]; static char bwf_organization_code[4]; @@ -151,7 +161,7 @@ class AudioFileSource : public AudioSource { virtual void set_timeline_position (int64_t pos); virtual void set_header_timeline_position () = 0; - bool find (std::string path, bool must_exist, bool& is_new); + bool find (Glib::ustring& path, bool must_exist, bool& is_new); bool removable() const; bool writable() const { return _flags & Writable; } }; |