diff options
author | Robin Gareus <robin@gareus.org> | 2014-05-26 06:21:05 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-05-26 06:56:04 +0200 |
commit | bb727f4588a5ecdcf750a19bab08db5d6c71653e (patch) | |
tree | 31d3b8700934794608b1ec254de69bff19442fc3 /libs/ardour/thread_buffers.cc | |
parent | 491f3f6e448f5cde73a1af8bac22990dffe55106 (diff) |
allow to set custom thread-buffer size
This is needed for gain and pan automation buffers
as well as silent and scratch buffers when bouncing or
exporting with larger chunk size than the current engine
period.
Diffstat (limited to 'libs/ardour/thread_buffers.cc')
-rw-r--r-- | libs/ardour/thread_buffers.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/ardour/thread_buffers.cc b/libs/ardour/thread_buffers.cc index 94490ca912..b51576bfc9 100644 --- a/libs/ardour/thread_buffers.cc +++ b/libs/ardour/thread_buffers.cc @@ -40,7 +40,7 @@ ThreadBuffers::ThreadBuffers () } void -ThreadBuffers::ensure_buffers (ChanCount howmany) +ThreadBuffers::ensure_buffers (ChanCount howmany, size_t custom) { // std::cerr << "ThreadBuffers " << this << " resize buffers with count = " << howmany << std::endl; @@ -60,9 +60,14 @@ ThreadBuffers::ensure_buffers (ChanCount howmany) for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { size_t count = std::max (scratch_buffers->available().get(*t), howmany.get(*t)); - size_t size = (*t == DataType::MIDI) - ? _engine->raw_buffer_size (*t) - : _engine->raw_buffer_size (*t) / sizeof (Sample); + size_t size; + if (custom > 0) { + size = custom; + } else { + size = (*t == DataType::MIDI) + ? _engine->raw_buffer_size (*t) + : _engine->raw_buffer_size (*t) / sizeof (Sample); + } scratch_buffers->ensure_buffers (*t, count, size); mix_buffers->ensure_buffers (*t, count, size); @@ -70,7 +75,7 @@ ThreadBuffers::ensure_buffers (ChanCount howmany) route_buffers->ensure_buffers (*t, count, size); } - size_t audio_buffer_size = _engine->raw_buffer_size (DataType::AUDIO) / sizeof (Sample); + size_t audio_buffer_size = custom > 0 ? custom : _engine->raw_buffer_size (DataType::AUDIO) / sizeof (Sample); delete [] gain_automation_buffer; gain_automation_buffer = new gain_t[audio_buffer_size]; |