summaryrefslogtreecommitdiff
path: root/libs/ardour/file_source.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-27 18:20:02 +0100
committerRobin Gareus <robin@gareus.org>2016-12-27 18:20:02 +0100
commit54a79639df0a72afaf26ed914901688ecdac8ed4 (patch)
tree364cb613631cc41ab656b7ef2f0af86b3f65ddad /libs/ardour/file_source.cc
parent5bada6d5332937fca4071edc8f2b2f8c093e9af8 (diff)
Allow gain factor for audio sources.
In preparation for archiving files as .flac (fixed point), normalized with gain factor.
Diffstat (limited to 'libs/ardour/file_source.cc')
-rw-r--r--libs/ardour/file_source.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc
index 8b503d4894..f313fde7ba 100644
--- a/libs/ardour/file_source.cc
+++ b/libs/ardour/file_source.cc
@@ -61,6 +61,7 @@ FileSource::FileSource (Session& session, DataType type, const string& path, con
, _file_is_new (!origin.empty()) // if origin is left unspecified (empty string) then file must exist
, _channel (0)
, _origin (origin)
+ , _gain (1.f)
{
set_within_session_from_path (path);
}
@@ -69,6 +70,7 @@ FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist
: Source (session, node)
, _file_is_new (false)
, _channel (0)
+ , _gain (1.f)
{
/* this setting of _path is temporary - we expect derived classes
to call ::init() which will actually locate the file
@@ -142,6 +144,7 @@ FileSource::init (const string& pathstr, bool must_exist)
int
FileSource::set_state (const XMLNode& node, int /*version*/)
{
+ LocaleGuard lg;
XMLProperty const * prop;
if ((prop = node.property (X_("channel"))) != 0) {
@@ -154,6 +157,12 @@ FileSource::set_state (const XMLNode& node, int /*version*/)
_origin = prop->value();
}
+ if ((prop = node.property (X_("gain"))) != 0) {
+ _gain = atof (prop->value());
+ } else {
+ _gain = 1.f;
+ }
+
return 0;
}