249{
250 auto audio_src = std::dynamic_pointer_cast<AudioBuffer>(source);
251 auto audio_tgt = std::dynamic_pointer_cast<AudioBuffer>(target);
252 auto vk_src = std::dynamic_pointer_cast<VKBuffer>(source);
253 auto vk_tgt = std::dynamic_pointer_cast<VKBuffer>(target);
254
255
257
258
259
260 }
261
262 if (!
can_transfer(source, src_token, target, tgt_token)) {
263 return DistributionDecision {
265 .transfer_processor = nullptr,
267 .reason = "Transfer not supported between these buffer types and tokens"
268 };
269 }
270
271 std::shared_ptr<TransferProcessor> processor;
273
274 if (audio_src && vk_tgt) {
276 processor = std::make_shared<TransferProcessor>(audio_src, vk_tgt, direction);
277 } else if (vk_src && audio_tgt) {
279 processor = std::make_shared<TransferProcessor>(audio_tgt, vk_src, direction);
280 } else if (audio_src && audio_tgt) {
282 processor = std::make_shared<TransferProcessor>();
283 processor->connect_audio_to_gpu(audio_src, nullptr);
284 } else if (vk_src && vk_tgt) {
286 processor = std::make_shared<TransferProcessor>();
287 }
288
289 if (!processor) {
290 return DistributionDecision {
292 .transfer_processor = nullptr,
294 .reason = "Failed to create transfer processor"
295 };
296 }
297
298 if (audio_tgt) {
299 audio_tgt->force_internal_usage(false);
300 }
301
302 return DistributionDecision {
304 .transfer_processor = processor,
305 .transfer_direction = tgt_token,
306 .reason = "Transfer processor created"
307 };
308}
static bool can_transfer(const std::shared_ptr< Buffer > &source, ProcessingToken src_token, const std::shared_ptr< Buffer > &target, ProcessingToken tgt_token)
static bool has_gpu(ProcessingToken token)
static bool has_cpu(ProcessingToken token)
static bool has_sample_rate(ProcessingToken token)
@ AUDIO_BACKEND
Standard audio processing backend configuration.
TransferDirection
Specifies the direction of data transfer.