Fix playback of sessions with low sample-rate
previously, _chunksize = ``` minimum_disk_read_bytes / sizeof (Sample) ``` can become larger then actual allocated ringbuffer: ``` audio_playback_buffer_seconds * sample-rate ``` In which case the buffer was never filled. The disk writer has similar issues
This commit is contained in:
parent
d60e0e7ade
commit
11f71a3297
@ -113,8 +113,9 @@ DiskReader::ReaderChannelInfo::resize_preloop (samplecnt_t bufsize)
|
||||
int
|
||||
DiskReader::add_channel_to (std::shared_ptr<ChannelList> c, uint32_t how_many)
|
||||
{
|
||||
samplecnt_t bufsz = std::max<samplecnt_t> (_chunk_samples * 2, _session.butler ()->audio_playback_buffer_size ());
|
||||
while (how_many--) {
|
||||
c->push_back (new ReaderChannelInfo (_session.butler ()->audio_playback_buffer_size (), loop_fade_length));
|
||||
c->push_back (new ReaderChannelInfo (bufsz, loop_fade_length));
|
||||
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("'%1': new reader channel, write space = %2 read = %3\n",
|
||||
name (),
|
||||
c->back ()->rbuf->write_space (),
|
||||
@ -236,8 +237,10 @@ DiskReader::adjust_buffering ()
|
||||
{
|
||||
std::shared_ptr<ChannelList const> c = channels.reader ();
|
||||
|
||||
samplecnt_t bufsz = std::max<samplecnt_t> (_chunk_samples * 2, _session.butler ()->audio_playback_buffer_size ());
|
||||
|
||||
for (auto const& chan : *c) {
|
||||
chan->resize (_session.butler ()->audio_playback_buffer_size ());
|
||||
chan->resize (bufsz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,9 @@ DiskWriter::WriterChannelInfo::resize (samplecnt_t bufsize)
|
||||
int
|
||||
DiskWriter::add_channel_to (std::shared_ptr<ChannelList> c, uint32_t how_many)
|
||||
{
|
||||
samplecnt_t bufsz = std::max<samplecnt_t> (_chunk_samples * 2, _session.butler()->audio_capture_buffer_size());
|
||||
while (how_many--) {
|
||||
c->push_back (new WriterChannelInfo (_session.butler()->audio_capture_buffer_size()));
|
||||
c->push_back (new WriterChannelInfo (bufsz));
|
||||
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: new writer channel, write space = %2 read = %3\n",
|
||||
name(),
|
||||
c->back()->wbuf->write_space(),
|
||||
@ -1386,8 +1387,9 @@ DiskWriter::adjust_buffering ()
|
||||
{
|
||||
std::shared_ptr<ChannelList const> c = channels.reader();
|
||||
|
||||
samplecnt_t bufsz = std::max<samplecnt_t> (_chunk_samples * 2, _session.butler()->audio_capture_buffer_size());
|
||||
for (auto const chan : *c) {
|
||||
chan->resize (_session.butler()->audio_capture_buffer_size());
|
||||
chan->resize (bufsz);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user