diff --git a/app/render/backend/audiorenderworker.cpp b/app/render/backend/audiorenderworker.cpp index f1fa9a3b4..0e9b9b715 100644 --- a/app/render/backend/audiorenderworker.cpp +++ b/app/render/backend/audiorenderworker.cpp @@ -51,6 +51,29 @@ NodeValueTable AudioRenderWorker::RenderBlock(const TrackOutput *track, const Ti int copied_size = 0; if (!samples_from_this_block.isEmpty()) { + // Stretch samples here + if (b->media_length() != b->length()) { + QByteArray speed_adjusted_samples; + double clip_speed = b->speed(); + int sample_count = audio_params_.bytes_to_samples(samples_from_this_block.size()); + + qDebug() << "Adjusting audio to speed" << clip_speed; + + for (double i=0;i= samples_from_this_block.size() || (byte_index + audio_params_.samples_to_bytes(1)) > samples_from_this_block.size()) { + qDebug() << "Tried to access" << byte_index << "-" << (byte_index + audio_params_.samples_to_bytes(1)) << "of" << samples_from_this_block.size(); + } + + QByteArray sample_at_this_index = samples_from_this_block.mid(byte_index, audio_params_.samples_to_bytes(1)); + speed_adjusted_samples.append(sample_at_this_index); + } + + samples_from_this_block = speed_adjusted_samples; + } + copied_size = samples_from_this_block.size(); memcpy(block_range_buffer.data()+destination_offset,