Skip to content

Commit

Permalink
Specify the fifo size in seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Jun 10, 2024
1 parent ec52f87 commit f6480ed
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ void AudioPipeline::open() {
effect->reset(source->samplerate(), source->blocksize());
}

const size_t fifosize = 10 *
std::max(source->maxblocksize(), sink->maxblocksize()) /
std::min(source->blocksize(), sink->blocksize());
const auto fifosize = 1; // total seconds

source->fifo()->resize(fifosize, source->blocksize());
sink->fifo()->resize(fifosize, sink->blocksize());
source->fifo()->resize(
static_cast<size_t>(fifosize * source->samplerate() / source->blocksize()),
source->blocksize());

sink->fifo()->resize(
static_cast<size_t>(fifosize * sink->samplerate() / sink->blocksize()),
sink->blocksize());

source->subscribe([&](const AudioEventCode code, const std::string& data) {
onevent(code, data);
Expand Down

0 comments on commit f6480ed

Please sign in to comment.