summaryrefslogtreecommitdiff
path: root/libs/ardour/sndfilesource.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/sndfilesource.cc')
-rw-r--r--libs/ardour/sndfilesource.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 54b9a0135c..2e7df7f918 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -523,6 +523,11 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
error << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5, ret was %6)"), start, file_cnt, _name.val().substr (1), errbuf, _length, ret) << endl;
}
+ if (_gain != 1.f) {
+ for (framecnt_t i = 0; i < ret; ++i) {
+ dst[i] *= _gain;
+ }
+ }
return ret;
}
}
@@ -537,9 +542,16 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
/* stride through the interleaved data */
- for (framecnt_t n = 0; n < nread; ++n) {
- dst[n] = *ptr;
- ptr += _info.channels;
+ if (_gain != 1.f) {
+ for (framecnt_t n = 0; n < nread; ++n) {
+ dst[n] = *ptr * _gain;
+ ptr += _info.channels;
+ }
+ } else {
+ for (framecnt_t n = 0; n < nread; ++n) {
+ dst[n] = *ptr;
+ ptr += _info.channels;
+ }
}
return nread;