63{
64 if (batch.channel_count <= 0 || batch.left.dimensions <= 0 ||
65 batch.right.dimensions <= 0)
66 throw std::invalid_argument("invalid environment output dimensions");
67 std::size_t required = batch.pair_count;
68 for (const std::size_t extent: {std::size_t(batch.channel_count),
69 std::size_t(batch.left.dimensions) + 1,
70 std::size_t(batch.right.dimensions) + 1}) {
71 if (required > std::numeric_limits<std::size_t>::max() / extent)
72 throw std::length_error("environment output dimensions overflow");
73 required *= extent;
74 }
75 if (output.size() != required)
76 throw std::invalid_argument("environment output size differs");
77 char error[1024]{};
78 if (implementation_->assemble(implementation_->workspace, &batch,
79 output.data(), error, sizeof(error)))
80 throw std::runtime_error(error);
81}