}
-/** Constructor used for existing files via XML. File must exist. If _origin
- * is an absolute path after ::set_state(), then the file is external to the
- * session.
+/** Constructor used for sources listed in session-files (XML)
+ * and missing sources (SilentFileSource).
+ *
+ * If _origin is an absolute path after ::set_state(), then the
+ * file is external to the session.
*/
-AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exist, bool optional_origin)
+AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exist)
: Source (s, node)
, AudioSource (s, node)
, FileSource (s, node, must_exist)
if (Glib::path_is_absolute (_origin)) {
_path = _origin;
- must_exist = !optional_origin;
}
if (init (_path, must_exist)) {
XMLNode&
AudioFileSource::get_state ()
{
+ LocaleGuard lg;
XMLNode& root (AudioSource::get_state());
char buf[32];
snprintf (buf, sizeof (buf), "%u", _channel);
root.add_property (X_("channel"), buf);
- root.add_property (X_("origin"), _origin);
+ root.add_property (X_("origin"), _origin);
+ snprintf (buf, sizeof (buf), "%f", _gain);
+ root.add_property (X_("gain"), buf);
return root;
}
}
}
+void
+AudioFileSource::set_gain (float g, bool temporarily)
+{
+ if (_gain == g) {
+ return;
+ }
+ _gain = g;
+ if (temporarily) {
+ return;
+ }
+ close_peakfile();
+ setup_peakfile ();
+}
+
bool
AudioFileSource::safe_audio_file_extension(const string& file)
{