audio: rewrote audio cache to write to contiguous segments rather than one long file

Fixes issues with PCM file placement, optimizes some audio-based timeline
and cache operations, just generally a better approach.
This commit is contained in:
itsmattkc
2020-10-11 23:27:40 +11:00
parent 920a15d2ea
commit f7ab0bb640
17 changed files with 575 additions and 226 deletions
+3 -2
View File
@@ -30,6 +30,7 @@ OLIVE_NAMESPACE_ENTER
AudioOutputManager::AudioOutputManager(QObject *parent) :
QObject(parent),
output_(nullptr),
device_proxy_(this),
push_device_(nullptr)
{
}
@@ -87,7 +88,7 @@ void AudioOutputManager::Close()
}
}
void AudioOutputManager::PullFromDevice(const QString &filename, qint64 offset, int playback_speed)
void AudioOutputManager::PullFromDevice(QIODevice *device, qint64 offset, int playback_speed)
{
if (!output_) {
return;
@@ -99,7 +100,7 @@ void AudioOutputManager::PullFromDevice(const QString &filename, qint64 offset,
push_samples_.clear();
// Pull from the device
device_proxy_.SetDevice(filename, offset, playback_speed);
device_proxy_.SetDevice(device, offset, playback_speed);
device_proxy_.open(QIODevice::ReadOnly);
output_->start(&device_proxy_);
}