2 Copyright (C) 2006 Paul Davis
3 Written by Dave Robillard, 2006
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_smf_filesource_h__
22 #define __ardour_smf_filesource_h__
26 #include <ardour/midi_source.h>
30 /** Standard Midi File (Type 0) Source */
31 class SMFSource : public MidiSource {
38 RemovableIfEmpty = 0x10,
39 RemoveAtDestroy = 0x20,
43 /** Constructor for existing external-to-session files */
44 SMFSource (std::string path, Flag flags = Flag(0));
46 /* Constructor for existing in-session files */
47 SMFSource (const XMLNode&);
49 virtual ~SMFSource ();
51 int set_name (string newname, bool destructive);
53 string path() const { return _path; }
55 void set_allow_remove_if_empty (bool yn);
56 void mark_for_remove();
58 int update_header (jack_nframes_t when, struct tm&, time_t);
61 int move_to_trash (const string trash_dir_name);
63 static bool is_empty (string path);
64 void mark_streaming_write_completed ();
66 void mark_take (string);
67 string take_id() const { return _take_id; }
69 static void set_search_path (string);
70 static void set_header_position_offset (jack_nframes_t offset, bool negative);
72 XMLNode& get_state ();
73 int set_state (const XMLNode&);
77 int init (string idstr, bool must_exist);
79 jack_nframes_t read_unlocked (RawMidi* dst, jack_nframes_t start, jack_nframes_t cn) const;
80 jack_nframes_t write_unlocked (RawMidi* dst, jack_nframes_t cnt);
82 bool find (std::string path, bool must_exist, bool& is_new);
83 bool removable() const;
84 bool writable() const { return _flags & Writable; }
90 bool _allow_remove_if_empty;
91 uint64_t _timeline_position;
93 static string _search_path;
96 }; /* namespace ARDOUR */
98 #endif /* __ardour_smf_filesource_h__ */